lbdbzj110 发表于 2018-1-3 20:46:41

03-saltstack 基本管理与操作

1.globbing 默认  
salt '*' test.ping               # 匹配所以
  
salt 'test*' test.ping            # 匹配test1,test..
  
salt '*.test.com' test.ping    # 匹配a.test.com,b.test.com....
  
salt 'test?.xx.com' test.ping # 匹配test1.xx.com,test2.xx.com...
  
salt 'web' test.ping       # 匹配web1到web
  
salt 'web-' test.ping      # 匹配web-x,web-y,web-z
  

  
2.RE 正则
  
salt -E 'web1-(pro|devel)' test.ping# 匹配web1-pro,web2-devel
  

  
3.List 列表
  
salt -L 'web1, test1' test.ping          # 匹配web1,test1
  

  
4.grains
  
salt -G 'os:CentOS' test.ping          # 匹配centos系统
  
salt 'test*' grains.items                  # 查看所有grains键/值
  
salt 'test*' grains.ls                        # 查看所有grains项
  
salt 'test*' grains.item num_cpus   # 查看某个grains的值
  
页: [1]
查看完整版本: 03-saltstack 基本管理与操作