Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run state.highstate for a particular environment?

Tags:

salt-stack

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?

like image 372
Suraj HK Avatar asked Mar 25 '15 09:03

Suraj HK


1 Answers

You have this capacity but the correct command is:

salt '*' state.highstate saltenv=stg

Salt state documentation

like image 197
jakcam Avatar answered Sep 22 '22 04:09

jakcam