当前位置:网站首页>saltstack学习3模块
saltstack学习3模块
2022-07-30 11:31:00 【daydayup9527】
module
查看所有的module列表
[[email protected] ~]# salt '*' sys.list_modules
node1:
- acl
- aliases
- alternatives
...
查看指定module的所有function
[[email protected] ~]# salt '*' sys.list_functions
查看指定module的所有用法列表
[[email protected] ~]# salt '*' sys.list_functions cmd
node1:
...
- cmd.retcode
- cmd.run
...
查看指定module的指定用法的介绍
[[email protected] ~]# salt '*' sys.doc cmd.run
cmd.run:
...
salt '*' cmd.run cmd='sed -e s/=/:/g'
常用的module
看官方文档https://docs.saltproject.io/en/latest/ref/modules/all/
network service cmd cp pkg cron dnsutil
pkg
# salt '*' pkg.install nmap
# salt '*' pkg.file_list nmap
network
[[email protected] ~]# salt '*' network.connect www.baidu.com 80
master:
----------
comment:
Successfully connected to www.baidu.com (14.215.177.38) on tcp port 80
result:
True
node1:
----------
comment:
Successfully connected to www.baidu.com (14.215.177.38) on tcp port 80
result:
True
service
[[email protected] ~]# salt '*' service.available sshd
node1:
True
[[email protected] ~]# salt '*' service.get_all
node1:
- NetworkManager
- NetworkManager-dispatcher
...
[roo[email protected] ~]# salt '*' service.restart httpd
[[email protected] ~]# salt '*' service.run postgresql
[[email protected] ~]# salt '*' service.reload postgresql #status stpp
cp模块
# salt '*' cp.get_dir salt://hellotest /data
# salt '*' cp.get_file salt://hellotest/test.txt /root/test.txt
# salt '*' cp.get_url http://*.com/download/files.tgz /root/files.tgz
cron模块
为指定的被控主机、root用户添加crontab信息
# salt '*' cron.set_job root '*/5' '*' '*' '*' '*' 'date >/dev/null 2>&1'
# salt '*' cron.raw_cron root
## 删除指定的被控主机、root用户的crontab信息
# salt '*' cron.rm_job root 'date >/dev/null 2>&1'
# salt '*' cron.raw_cron root
cmd模块
salt '*' cmd.run "ls -l | awk '/foo/{print $2}'"
salt '*' cmd.exec_code python2 'print("hello world")'
salt '*' cmd.script salt://scripts/runme.sh 'arg1 arg2 "arg 3"'
file模块
# salt '*' file.get_sum /etc/resolv.conf md5
# salt '*' file.stats /etc/resolv.conf
nginx模块
批量操作nginx服务器
salt '*' nginx.configtest
salt '*' nginx.signal reload
salt '*' nginx.status
salt '*' nginx.version
states
#查看state的列表
[[email protected] ~]# salt '*' sys.list_state_modules
...
- file
#查看指定state的函数
[[email protected] ~]# salt '*' sys.list_state_functions file
node1:
- file.absent
- file.accumulated
- file.append
#查看指定state的用法
[[email protected] ~]# salt '*' sys.state_doc file.append
https://www.cnblogs.com/davygeek/p/7754207.html
边栏推荐
猜你喜欢

MySQL——数据库基础

Explain the problem of change exchange in simple terms - the shell of the backpack problem

LeetCode_235_二叉搜索树的最近公共祖先

高能产出!腾讯内部的MyCat中间件手册,理论实操齐下

Verilog grammar basics HDL Bits training 08

Typroa 替代工具marktext

程序环境和预处理(详解)

contentDocument contentWindow, canvas, svg, iframe

IO/多路复用(select/poll/epoll)

High energy output!Tencent's internal MyCat middleware manual, both theoretical and practical
随机推荐
Matlab绘图(1)——二维绘图
Reverse linked list - recursive inversion method
Microsoft SQL服务器被黑客入侵 带宽被窃取
Taobao/Tmall taobao comments q&a list interface API
TensorFlow custom training function
又爆神作!阿里爆款MySQL高级宝典开源,直抵P7
Apifox 生成接口文档 教程与操作步骤
Reverse linked list - iterative inversion method
电压继电器SRMUVS-100VAC-2H2D
基于MySQL数据库,Redis缓存,MQ消息中间件,ES搜索引擎的高可用方案解析
概率论的学习和整理7:理解期望和方差还是要回到随机试验本身,期望不是平均值,方差的公式不同情况不同
[ASP.NET Core] Dependency Injection for Option Classes
云原生应用的概念和云原生应用的 15 个特征
Get the original data API on 1688app
Assembly to implement bubble sort
Hu-cang integrated e-commerce project (1): project background and structure introduction
Matlab基础(3)——元胞与结构体
idea的package没有空心
Summary of text alignment, line height, space, etc.
反转链表-迭代反转法