SaltStak用下面的方式来远程执行命令(run shell commands, update packages, and distribute files to all managed systems simultaneously. ):
cmd 模块是常用的执行远程命令模块,具有强大的功能
1
2
3
4
5[root@Automation ~]# salt 192.168.244.130 cmd.run 'ls /etc/salt'
192.168.244.130:
minion
minion.d
pkisys.doc: 类似linux的man命令,可以显示minion支持的模块的详细操作说明
1
2
3
4
5
6
7
8
9
10
11[root@Automation ~]# salt 192.168.244.130 sys.doc pkg.version
'pkg.version:'
Returns a string representing the package version or an empty string if not
installed. If more than one package name is specified, a dict of
name/version pairs is returned.
CLI Example:
salt '*' pkg.version <package name>
salt '*' pkg.version <package1> <package2> <package3> ...安装package
1
2
3
4
5
6
7
8[root@Automation ~]# salt 192.168.244.130 pkg.install cowsay
192.168.244.130:
----------
cowsay:
----------
new:
3.03-8.el6
old:
只是简单介绍一下命令执行,saltstack有非常多的模块来进行服务器管理,有需要再深入。