Reputation: 151
Is anyone aware of a way to filter salt modules usage per host/group/etc. Is there a way to filter it like salt pillar's top.sls
?
For example I have module to manage haproxy which is depends on haproxyctl
and thats only require to run on host with haproxy role.
Upvotes: 0
Views: 482
Reputation: 953
If your roles are assigned in minion configuration - then they are available for your salt
command as a regular grains.
E.g. if you have a minion configuration like:
<some config here>
grains:
roles:
- haproxy
You can use the following command to execute state only on the nodes with haproxy
role:
salt -C 'G@roles:haproxy' <your state here>
basically, with syntax salt - C 'G@<grain>'
you can match on any grain.
Upvotes: 0