salt.modules.state

Control the state system on the minion

salt.modules.state.clear_cache()

Clear out cached state files, forcing even cache runs to refresh the cache on the next state execution.

Remember that the state cache is completely disabled by default, this execution only applies if cache=True is used in states

CLI Example:

salt '*' state.clear_cache
salt.modules.state.high(data, queue=False, **kwargs)

Execute the compound calls stored in a single set of high data This function is mostly intended for testing the state system

CLI Example:

salt '*' state.high '{"vim": {"pkg": ["installed"]}}'
salt.modules.state.highstate(test=None, queue=False, **kwargs)

Retrieve the state data from the salt master for this minion and execute it

CLI Example:

salt '*' state.highstate

salt '*' state.highstate exclude=sls_to_exclude
salt '*' state.highstate exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
salt.modules.state.low(data, queue=False, **kwargs)

Execute a single low data call This function is mostly intended for testing the state system

CLI Example:

salt '*' state.low '{"state": "pkg", "fun": "installed", "name": "vi"}'
salt.modules.state.pkg(pkg_path, test=False, **kwargs)

Execute a packaged state run, the packaged state run will exist in a tarball available locally. This packaged state can be generated using salt-ssh.

CLI Example:

salt '*' state.pkg /tmp/state_pkg.tgz
salt.modules.state.running()

Return a dict of state return data if a state function is already running. This function is used to prevent multiple state calls from being run at the same time.

CLI Example:

salt '*' state.running
salt.modules.state.show_highstate(queue=False, **kwargs)

Retrieve the highstate data from the salt master and display it

CLI Example:

salt '*' state.show_highstate
salt.modules.state.show_lowstate(queue=False, **kwargs)

List out the low data that will be applied to this minion

CLI Example:

salt '*' state.show_lowstate
salt.modules.state.show_sls(mods, env='base', test=None, queue=False, **kwargs)

Display the state data from a specific sls or list of sls files on the master

CLI Example:

salt '*' state.show_sls core,edit.vim dev
salt.modules.state.show_top(queue=False, **kwargs)

Return the top data that the minion will use for a highstate

CLI Example:

salt '*' state.show_top
salt.modules.state.single(fun, name, test=None, queue=False, **kwargs)

Execute a single state function with the named kwargs, returns False if insufficient data is sent to the command

By default, the values of the kwargs will be parsed as YAML. So, you can specify lists values, or lists of single entry key-value maps, as you would in a YAML salt file. Alternatively, JSON format of keyword values is also supported.

CLI Example:

salt '*' state.single pkg.installed name=vim
salt.modules.state.sls(mods, env='base', test=None, exclude=None, queue=False, **kwargs)

Execute a set list of state modules from an environment, default environment is base

CLI Example:

salt '*' state.sls core,edit.vim dev
salt '*' state.sls core exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"
salt.modules.state.template(tem, queue=False, **kwargs)

Execute the information stored in a template file on the minion

CLI Example:

salt '*' state.template '<Path to template on the minion>'
salt.modules.state.template_str(tem, queue=False, **kwargs)

Execute the information stored in a string from an sls template

CLI Example:

salt '*' state.template_str '<Template String>'
salt.modules.state.top(topfn, test=None, queue=False, **kwargs)

Execute a specific top file instead of the default

CLI Example:

salt '*' state.top reverse_top.sls
salt '*' state.top reverse_top.sls exclude=sls_to_exclude
salt '*' state.top reverse_top.sls exclude="[{'id': 'id_to_exclude'}, {'sls': 'sls_to_exclude'}]"