Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saltstack - Preview Highstate

Tags:

salt-stack

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?

like image 807
feus4177 Avatar asked Dec 11 '14 18:12

feus4177


People also ask

What is Highstate in SaltStack?

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”.

What is state SaltStack?

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.

What is pillar in SaltStack?

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.

What is top SLS?

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.


1 Answers

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.

like image 163
pajaja Avatar answered Oct 11 '22 07:10

pajaja