Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2016 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/67a8c3a795462d0b6fb82fd8044cdd86 to your computer and use it in GitHub Desktop.
Save anonymous/67a8c3a795462d0b6fb82fd8044cdd86 to your computer and use it in GitHub Desktop.
salt compound matchers
documentation: https://docs.saltstack.com/en/latest/topics/targeting/compound.html
## All minions:
# salt '*' test.ping --output=txt|sort -n|wc -l
46
--> ok!
## All minions in patchgroup a:
# salt -C 'I@tc:patch:patch_a' test.ping --output=txt|sort -n|wc -l
1
--> ok!
## All minions in patchgroup a and c:
# salt -C 'J@tc:patch:(patch_a|patch_c)$' test.ping --output=txt |sort -n |wc -l
2
--> ok!
# salt -C 'I@tc:patch:patch_a or I@tc:patch:patch_c' test.ping --output=txt |sort -n |wc -l
2
--> ok!
## All minions, exept those in patchgroup a:
# salt -C 'not I@tc:patch:patch_a' test.ping --output=txt|sort -n|wc -l
45
--> ok!
## All minions, exept those in patchgroup a and patchgroup c
# salt -C 'not J@tc:patch:(patch_a|patch_c)$' test.ping --output=txt|sort -n|wc -l
44
--> ok!
# salt -C 'not (I@tc:patch:patch_a or I@tc:patch:patch_c)' test.ping --output=txt |sort -n |wc -l
46
--> NOT OK!
^^^bug?
# salt --versions-report
Salt Version:
Salt: 2016.3.0
Dependency Versions:
cffi: Not Installed
cherrypy: 3.2.2
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: 0.21.1
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.4
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-86-generic
system: Linux
version: Ubuntu 14.04 trusty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment