# salt --version
salt 2015.5.8 (Lithium)
[root@localhost salt]# salt --version-report
Usage: salt [options] ‘<target>‘ <function> [arguments]
salt: error: no such option: --version-report
# salt --versions-report
Salt: 2015.5.8
Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
Jinja2: unknown
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: 0.3.4
Tornado: Not Installed
timelib: Not Installed
dateutil: Not Installed
# salt-key –L
Accepted Keys:
192.168.10.110
192.168.43.218
Denied Keys:
Unaccepted Keys:
192.168.10.110
Rejected Keys:
# salt-key –a id
# salt-key -a 192.168.10.110
The following keys are going to be accepted:
Unaccepted Keys:
192.168.10.110
Proceed? [n/Y] Y
# salt-key -A
# salt-key –d id
# salt-key -d 192.168.10.110
The following keys are going to be deleted:
Accepted Keys:
192.168.10.110
Proceed? [N/y] y
Key for minion 192.168.10.110 deleted.
# salt-key -D
The following keys are going to be deleted:
Accepted Keys:
192.168.10.110
192.168.43.218
Proceed? [N/y] y
Key for minion 192.168.10.110 deleted.
Key for minion 192.168.43.218 deleted.
# salt-key –r id
# salt-key -R
The following keys are going to be rejected:
Unaccepted Keys:
192.168.10.110
Proceed? [n/Y] Y
Key for minion 192.168.10.110 rejected.
# salt-run manage.up
- 192.168.10.249
#salt-run manage.down
# salt-run manage.down removekeys=True
# salt-run manage.status
# salt-run manage.status
down:
up:
- 192.168.10.249
# salt-run manage.versions
# salt-run manage.versions
Master:
2015.5.8
2016.Up to date:
----------
192.168.10.249:
2015.5.8
分组规则:
G --针对Grains做单个匹配,例如:G@os:Ubuntu
E --针对minion针对正则表达式匹婚配,例如:E@webd+.(dev|qa|prod).loc
P --针对Grains做正则表达式匹配,例如:P@os:(RedHat|Fedora|CentOS)
L --针对minion做列表匹配,例如:L@minion1.test.com,minion3.domain.com or bl*.domain.com
I --针对 Pillar 做单个匹配,例如:I@pdata:foobar
S --针对子网或是IP做匹配,例如:S@192.168.1.0/24 or S@192.168.1.100
R --针对客户端范围做匹配,例如:R@%foo.bar
编辑master配置文件,注意组名前有两个空格,后有一个空格
# vi /etc/salt/master
nodegroups:
web: ‘L@192.168.10.110,192.168.10.111‘
# salt -N ‘web’ test.ping
192.168.10.110:
True
首先要保证组员在master的列表中,否则对分组进行操作时会不成功:
# salt -N group1 test.ping
No minions matched the target. No command was sent, no jid was assigned.
ERROR: No return received
原文地址:http://blog.51cto.com/showing/2090354