My environments structure in /etc/salt/master looks like this
file_roots:
  base:
    - /srv/salt
  dev:
    - /srv/salt/dev
  stg:
    - /srv/salt/stg
  prod:
    - /srv/salt/prod
And my top.sls file is in /srv/salt
dev:
  'ip-10-1-1-28':
    - devtest
stg:
  'ip-10-1-1-252':
    - stgtest
prod:
  'ip-10-1-1-200':
    - prodtest
Now I want to run state.highstate for a particular environment, say 'stg'. I am looking for something like this,
salt '*' state.highstate env=stg
How do I achieve this? My requirement is that every time I run the command, I don't want minions in all the environments to run the SLS files. Any solution?
You have this capacity but the correct command is:
salt '*' state.highstate saltenv=stg
Salt state documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With