salt.resources.ssh.modules.state#

State module for the ssh resource type.

Implements state.highstate, state.sls, and state.apply for SSH resources by replicating the salt-ssh state-execution pipeline on the managing minion:

  1. CompileSSHHighState reads state and pillar files from the master via the minion's RemoteClient. The resource ID is used as the top-file target, so only states mapped to that ID are compiled.

  2. Packageprep_trans_tar bundles the compiled low state, all referenced salt:// files, and the rendered pillar into a transport tar (salt_state.tgz).

  3. Execute — The tar is SCP'd to the remote host's thin_dir and state.pkg is invoked via the salt-thin bundle, returning structured JSON results.

This mirrors what salt-ssh state.highstate does when invoked from the master, but runs from the managing minion's process so the salt-ssh initiator is the minion, not the master.

salt.resources.ssh.modules.state.apply_(mods=None, **kwargs)#

Apply states to the SSH resource — state.highstate if no mods are given, state.sls otherwise.

CLI Example:

salt -C 'T@ssh:node1' state.apply
salt -C 'T@ssh:node1' state.apply node1
salt.resources.ssh.modules.state.highstate(test=None, **kwargs)#

Apply the highstate to the targeted SSH resource.

Compiles the highstate on the managing minion using the resource ID as the top-file target, packages all state files into a transport tar, SCPs the tar to the remote host, and runs state.pkg via the salt-thin bundle.

CLI Example:

salt -C 'T@ssh:node1' state.highstate
salt -C 'T@ssh:node1' state.highstate test=True
salt.resources.ssh.modules.state.sls(mods, saltenv='base', test=None, **kwargs)#

Apply one or more state SLS files to the targeted SSH resource.

CLI Example:

salt -C 'T@ssh:node1' state.sls node1
salt -C 'T@ssh:node1' state.sls node1,common test=True