需要-C参数: salt -C

saltstack之混合匹配

## 使用grains属性来匹配
[root@hadoop0 pillar]# salt -C 'G@os:Ubuntu' test.ping
uadoop1:
    True
## 使用Minion ID的正则表达式来匹配    
[root@hadoop0 pillar]# salt -C 'E@uadoop\d+' test.ping           
uadoop2:
    True
uadoop3:
    True
uadoop1:
    True
## 使用grains属性的正则表达式来匹配    
[root@hadoop0 pillar]# salt -C 'P@os:(RedHat|Ubuntu|CentOS)' test.ping             
uadoop2:
    True
uadoop3:
    True
uadoop1:
    True
## 使用Minion ID来匹配    
[root@hadoop0 pillar]# salt -C 'L@uadoop2,uadoop3' test.ping                            
uadoop2:
    True
uadoop3:
    True
## 使用pillar定义的属性来匹配    
[root@hadoop0 pillar]# salt -C 'I@users:foway:1200' test.ping
uadoop2:
    True
uadoop1:
    True
uadoop3:
    True
## 使用IP段匹配    
[root@hadoop0 pillar]# salt -C 'S@192.168.0.0/24' test.ping                   
uadoop3:
    True
uadoop2:
    True
uadoop1:
    True

相关文章:

  • 2021-08-30
  • 2022-12-23
  • 2021-11-07
  • 2022-01-09
  • 2022-01-01
  • 2021-12-14
  • 2021-07-17
猜你喜欢
  • 2022-02-11
  • 2021-10-29
  • 2021-12-30
  • 2021-05-17
  • 2022-03-09
  • 2021-07-31
  • 2021-12-12
相关资源
相似解决方案