The Salt fileserver supports multiple environments, allowing for SLS files and other files to be isolated for better organization.
For the default backend (called
environments are defined using the
Other backends (such as
environments in their own ways. For a list of available fileserver backends,
salt:// file URL can specify its fileserver environment using a
querystring syntax, like so:
In Reactor configurations, this method must be used to pull
files from an environment other than
Minions can be instructed which environment to use both globally, and for a single state, and multiple methods for each are available:
A minion can be pinned to an environment using the
option in the minion config file.
Additionally, the environment can be set for a single call to the following functions:
Within an individual state, there are two ways of specifying the environment.
The first is to add a
saltenv argument to the state. This example will pull
the file from the
/etc/foo/bar.conf: file.managed: - source: salt://foo/bar.conf - user: foo - mode: 600 - saltenv: config
Another way of doing the same thing is to use the querystring syntax described above:
/etc/foo/bar.conf: file.managed: - source: salt://foo/bar.conf?saltenv=config - user: foo - mode: 600
Specifying the environment using either of the above methods is only
necessary in cases where a state from one environment needs to access files
from another environment. If the SLS file containing this state was in the
config environment, then it would look in that environment by default.