-★出爺;3 发表于 2018-7-31 13:26:10

saltstack分组

  salt -C 'P@os:CentOS' test.ping
  测试minion中所有为CentOS系统的连通性
  可以使用and、or及no等操作如:salt -C 'P@os:CentOS and S@192.168.10.0/24' test.ping
  位monion分组需要修改/etc/salt/master
  nodegroups:
  web: 'L@host172,host174'
  db: 'S@192.168.10.172'
  test: 'P@os:CentOS'
  之后可以使用salt -N web test.ping来执行
  nodegroup分组时可以用到的语法关键字有G、E、P、L、I、S、R、D几个,几者的意义和用法如下
  G   Grains glob匹配   G@os:Ubuntu

  E   PCRE Minion>  P   Grains PCRE匹配   P@os:(RedHat|Fedora|CentOS)
  L   minion列表    L@minion1.example.com,minion3.domain.com or bl*.domain.com
  I   Pillar glob匹配   I@pdata:foobar
  S   子网/IP地址匹配   S@192.168.1.0/24 or S@192.168.10.100
  R   Range cluster匹配   R@%foo.bar
  D   Minion Data匹配   D@key:value
页: [1]
查看完整版本: saltstack分组