saltstack-gdlwolf自学总结第一篇:saltstack的安装部署(YUM安装):
http://gdlwolf.blog.51cto.com/343866/1786901
saltstack-gdlwolf自学总结第二篇:salt常用帮助查找命令:
http://gdlwolf.blog.51cto.com/343866/1786904
内容整理先到这里,随后会再补充(学无止境,很多东西无法一触而就,需要慢慢积累)
1、显示版本号:
[[email protected] salt]#salt --version salt 2015.5.8 (Lithium)
2、显示依赖关系及版本号:
[[email protected] salt]#salt --versions-report Salt: 2015.5.8 Python: 2.6.6 (r266:84292, Jul 232015, 15:22:56) Jinja2: 2.2.1 M2Crypto: 0.20.2 msgpack-python: 0.4.6 msgpack-pure: Not Installed pycrypto: 2.0.1 libnacl: Not Installed PyYAML: 3.10 ioflo: Not Installed PyZMQ: 14.3.1 RAET: Not Installed ZMQ: 3.2.5 Mako: Not Installed Tornado: Not Installed timelib: Not Installed dateutil: Not Installed
3、所有操作目标参数:
3.1、正则匹配的方式去管理
[[email protected] init]#salt -E ‘salt*‘ test.ping salt03: True salt02: True
3.2、列表匹配
[[email protected] init]#salt -L ‘salt02,salt03‘ test.ping salt02: True salt03: True
3.3、Grians匹配
[[email protected] init]#salt -G ‘os:CentOS‘ test.ping salt03: True salt02: True
3.4、组匹配
[email protected]: salt -N groups test.ping Minion: True Minion1: True
3.5、复合匹配
[email protected]: salt -C ‘[email protected]:MacOS or [email protected]‘ test.ping Minion: True Minion1: True 提示:os:MacOS or [email protected]是一个复合组合,支持使用and和or关联多个条件。
3.6、Pillar值匹配
[email protected]: salt -I ‘key:value‘ test.ping Minion: True Minion1: True
3.7、CIDR匹配
[email protected]: salt -S ‘192.168.1.0/24‘ test.ping Minion: True Minion1: True
4、文件的传送
salt ‘*‘cp.get_file salt://apache-tomcat-7.0.41.tar.gz/home/jack/apache-tomcat-7.0.41.tar.gz #将salt目录下apache-tomcat-7.0.41.tar.gz复制到所有minion的/home/jack目录下
5、显示当前活着的minion
[[email protected] salt]#salt-run manage.up - salt02 - salt03
6、显示未存活的minion
salt-run manage.down
7、显示未存活的minion,并将其删除
salt-run manage.downremovekeys=True
8、显示当前up和down的minion
salt-run manage.status
9、显示Master和所有minion的版本,可以通过此命令找到版本不一致的minion
[[email protected] init]#salt-run manage.versions Master: 2015.5.8 Up to date: ---------- salt02: 2015.5.8 salt03: 2015.5.8
时间: 2024-11-03 22:27:32