在使用 SaltStack 对主机进行批量管理的时候,因为不同的服务器组所做的业务功能不同,因此为了更加方便的管理,需要对主机进行分组管理
一. 编辑配置文件
[root@salt-master ~]# vim /etc/salt/master
二. 分组方式
G -- 针对 Grains 做单个匹配,例如:G@os:Ubuntu
E -- 针对 minion 针对正则表达式做匹配,例如:E@web\d+.(dev|qa|prod).loc
P -- 针对 Grains 做正则表达式匹配,例如:P@os:(RedHat|Fedora|CentOS)
L -- 针对 minion 做列表匹配,例如:L@minion1.example.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
© 走过岁月...... | Powered by LOFTER