7、saltstack学习 远程执行


https://www.unixhot.com/docs/saltstack/topics/tutorials/modules.html#arguments

全局匹配

[root@master-1 web]# salt "node-[1-2]" test.ping
node-1:
True
node-2:
True

正则
[root@master-1 web]# salt -E '(master|node)-1' test.ping
node-1:
True
master-1:
True

List方式

[root@master-1 web]# salt -L 'master-1,node-1' test.ping
master-1:
True
node-1:
True

salt所有模块

https://www.unixhot.com/docs/saltstack/ref/modules/all/index.html

测试所有tcp

network模块

salt '*' network.active_tcp

service模块

https://www.unixhot.com/docs/saltstack/ref/modules/all/salt.modules.service.html#module-salt.modules.service

[root@master-1 web]# salt '*' service.available sshd

salt '*' service.reload