caracal
caracal

Reputation: 53

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

Upvotes: 2

Views: 3163

Answers (2)

Sufiyan Ghori
Sufiyan Ghori

Reputation: 18753

From CLI, you can exclude minion as follows,

salt -C 'not minion-id' test.ping

Above pattern is available since version 2015.8.0. If you are using older version then,

salt -C '* and not minion-id' test.ping

Please read more about Compound matchers here.

Upvotes: 4

Gijs Brandsma
Gijs Brandsma

Reputation: 983

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

Upvotes: 3

Related Questions