Is there a way to preview what files will be served to a minion on a state.highstate
? I know that you can run state.show_highstate
, but that is not the output I am looking for. For example, inside /path/to/recurse/dir/
I have foo.txt
and bar.txt
and in my sls file I have
/path/to/recurse/dir/:
file.recurse:
- source: salt://dir/
I would like to run state.preview_highstate
and it would show me the contents of foo.txt
and bar.txt
. Does anyone know how to go about this without just running state.highstate
?
A “highstate” is a way for Salt to dynamically determine which Salt Formulas should be applied to a certain minion. To start with you execute a “highstate” like this: salt 'minion01' state.highstate. This command causes the Minion to download and examine a file from the Salt Master called the “top file”.
To solve this, SaltStack configuration management lets you create a re-usable configuration template, called a state, that describes everything required to put a system component or application into a known configuration. States are much easier to understand when you see them in action, so let's make one.
Salt pillar is a system that lets you define secure data that are 'assigned' to one or more minions using targets. Salt pillar data stores values such as ports, file paths, configuration parameters, and passwords.
In Salt, the file which contains a mapping between groups of machines on a network and the configuration roles that should be applied to them is called a top file . Top files are named top. sls by default and they are so-named because they always exist in the "top" of a directory hierarchy that contains state files.
If you are able to run the state on the minion but just don't want to apply any changes you can append the test=True
to your command:
salt '*' state.highstate test=True
This will run the highstate on the minion but will not make any changes to the system. Changes that would be applied are shown in yellow.
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