salt.modules.saltutil

The Saltutil module is used to manage the state of the salt minion itself. It is used to manage minion modules as well as automate updates to the salt minion.

depends:
  • esky Python module for update functionality
salt.modules.saltutil.cmd(tgt, fun, arg=(), timeout=None, expr_form='glob', ret='', kwarg=None, ssh=False, **kwargs)

Assuming this minion is a master, execute a salt command

CLI Example:

salt '*' saltutil.cmd
salt.modules.saltutil.cmd_iter(tgt, fun, arg=(), timeout=None, expr_form='glob', ret='', kwarg=None, ssh=False, **kwargs)

Assuming this minion is a master, execute a salt command

CLI Example:

salt '*' saltutil.cmd
salt.modules.saltutil.find_job(jid)

Return the data for a specific job id

CLI Example:

salt '*' saltutil.find_job <job id>
salt.modules.saltutil.is_running(fun)

If the named function is running return the data associated with it/them. The argument can be a glob

CLI Example:

salt '*' saltutil.is_running state.highstate
salt.modules.saltutil.kill_job(jid)

Sends a kill signal (SIGKILL 9) to the named salt job's process

CLI Example:

salt '*' saltutil.kill_job <job id>
salt.modules.saltutil.refresh_modules()

Signal the minion to refresh the module and grain data

CLI Example:

salt '*' saltutil.refresh_modules
salt.modules.saltutil.refresh_pillar()

Signal the minion to refresh the pillar data.

CLI Example:

salt '*' saltutil.refresh_pillar
salt.modules.saltutil.regen_keys()

Used to regenerate the minion keys.

CLI Example:

salt '*' saltutil.regen_keys
salt.modules.saltutil.revoke_auth()

The minion sends a request to the master to revoke its own key. Note that the minion session will be revoked and the minion may not be able to return the result of this command back to the master.

CLI Example:

salt '*' saltutil.revoke_auth
salt.modules.saltutil.running()

Return the data on all running salt processes on the minion

CLI Example:

salt '*' saltutil.running
salt.modules.saltutil.signal_job(jid, sig)

Sends a signal to the named salt job's process

CLI Example:

salt '*' saltutil.signal_job <job id> 15
salt.modules.saltutil.sync_all(env=None, refresh=True)

Sync down all of the dynamic modules from the file server for a specific environment

CLI Example:

salt '*' saltutil.sync_all
salt.modules.saltutil.sync_grains(env=None, refresh=True)

Sync the grains from the _grains directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _grains directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_grains
salt.modules.saltutil.sync_modules(env=None, refresh=True)

Sync the modules from the _modules directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _modules directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_modules
salt.modules.saltutil.sync_outputters(env=None, refresh=True)

Sync the outputters from the _outputters directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _outputters directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_outputters
salt.modules.saltutil.sync_renderers(env=None, refresh=True)

Sync the renderers from the _renderers directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _renderers directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_renderers
salt.modules.saltutil.sync_returners(env=None, refresh=True)

Sync the returners from the _returners directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _returners directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_returners
salt.modules.saltutil.sync_states(env=None, refresh=True)

Sync the states from the _states directory on the salt master file server. This function is environment aware, pass the desired environment to grab the contents of the _states directory, base is the default environment.

CLI Example:

salt '*' saltutil.sync_states
salt.modules.saltutil.term_job(jid)

Sends a termination signal (SIGTERM 15) to the named salt job's process

CLI Example:

salt '*' saltutil.term_job <job id>
salt.modules.saltutil.update(version=None)

Update the salt minion from the URL defined in opts['update_url']

This feature requires the minion to be running a bdist_esky build.

The version number is optional and will default to the most recent version available at opts['update_url'].

Returns details about the transaction upon completion.

CLI Example:

salt '*' saltutil.update 0.10.3