Search code examples
salt-project

Salt-Stack exclude minions from salt '*' state.apply in top.sls


Is there a way to exclude minions from being targeted even if I run salt '*' state.apply on CLI?

Ideally the exclusion should be declared somewhere in top.sls


Solution

  • You want to use compound matching. Targetting all the minions for the webserver states except minion_id_1 can be done like this.

    base:
      'not minion_id_1':
        - match: compound
        - webserver
    

    Documentation on compound matching can be found here: docs.saltstack.com/en/latest/topics/targeting/compound.html