ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
我们可以在/etc/salt/master配置文件中,定义组 nodegroups: group1: 'L@foo.domain.com,bar.domain.com,baz.domain.com or bl*.domain.com' group2: 'G@os:Debian and foo.domain.com' group3: 'G@os:Debian and N@group1' group4: - 'G@foo:bar' - 'or' - 'G@foo:baz' 使用场景 1)使用-N,在命令行执行 salt -N group1 test.ping 2)top.sls中配置 base: group1: - match: nodegroup - webserver 案例2: 编写/etc/salt/master配置文件 nodegroups: web: 'node2.51yuki.cn,node3.51yuki.cn' [admin@master /srv/salt ]$ sudo salt -N web cmd.run 'w' node2.51yuki.cn: 20:53:29 up 1 day, 8:44, 1 user, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT admin pts/0 10.2.11.176 09:48 2:51m 0.09s 0.09s -bash node3.51yuki.cn: 20:53:29 up 1 day, 8:49, 1 user, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT admin pts/1 10.2.11.176 09:48 11:04m 0.01s 0.01s -bash 案例3: 编写/etc/salt/master配置文件 nodegroups: proxyserver: 'L@node2.51yuki.cn,node3.51yuki.cn' haserver: 'L@node2.51yuki.cn,node3.51yuki.cn' webserver: 'L@node4.51yuki.cn,node5.51yuki.cn' nodegroups: proxyserver: 'L@node2.51yuki.cn,node3.51yuki.cn' haserver: 'L@node2.51yuki.cn,node3.51yuki.cn' webserver: 'L@node4.51yuki.cn,node5.51yuki.cn'