Most of the examples -- and also the documentation -- of SaltStack put the states files under
/srv/salt and the pillars files under
This means if I want to track the files using a source control (Mercurial or Git), I have to create two repositories.
Now, I want place the states files and the pillars files as subdirectories under
/srv/salt. Or, in other words, I will get the following directory structure (after
hg init on
/srv/salt + .hg/ + states/ + pillars/
Will this cause any problems with SaltStack?
Or do you have a better recommendation so that I can have only one source control repository for both the states and the pillars?
You can define additional file roots for both files in
By default Salt does something that is very confusing: it combines all of the pillar roots together. You avoid this by running salt against the root that containts your repository
sudo salt '*' state.highstate test=True saltenv=joe
The only problem is that your top-level routes won't be visible. The documenation suggests
base, but it can be anything, including template variables:
base doesn't need to exist at all, but you can access it again by specifying
saltenv when you run a state file:
sudo salt 'www1*' state.sls wordpress saltenv=base