Linux自动化工具之SaltStack正则表达式
2020-02-24自动化运维90root434°c
A+ A- 1 . -E(PCRE Minion id匹配)
ps: 笔者添加了一台minion端机器.
[[email protected] ~]# salt -E '(node2|node3).90root.com' cmd.run 'ping -c 2 www.90root.com'

2 . 通过top文件进行正则匹配
[[email protected] ~]# cd /etc/salt/states/
[[email protected] states]# vim top.sls
base:
'(node2|node3).90root.com':
- match: pcre #指定正则表达式
- init.pkg
- init.limit
[[email protected] states]#salt '*' state.highstate
3 . -S 通过IP地址匹配
[[email protected] states]# salt -S 192.168.15.0/24 test.ping

4 . -L 通过列表匹配
[[email protected] states]# salt -L 'node2.90root.com,node3.90root.com' test.ping

5 . -G 通过系统匹配
[[email protected] states]# salt -G os:CentOS test.ping
