Execute orchestration functions
salt.runners.state.
event
(tagmatch='*', count=-1, quiet=False, sock_dir=None, pretty=False, node='master')¶Watch Salt's event bus and block until the given tag is matched
2014.7.0 新版功能.
This is useful for utilizing Salt's event bus from shell scripts or for taking simple actions directly from the CLI.
Enable debug logging to see ignored events.
参数: |
|
---|
CLI范例:
# Reboot a minion and run highstate when it comes back online
salt 'jerry' system.reboot && \\
salt-run state.event 'salt/minion/jerry/start' count=1 quiet=True && \\
salt 'jerry' state.highstate
# Reboot multiple minions and run highstate when all are back online
salt -L 'kevin,stewart,dave' system.reboot && \\
salt-run state.event 'salt/minion/*/start' count=3 quiet=True && \\
salt -L 'kevin,stewart,dave' state.highstate
# Watch the event bus forever in a shell while-loop.
salt-run state.event | while read -r tag data; do
echo $tag
echo $data | jq -colour-output .
done
参见
See https://github.com/saltstack/salt/blob/develop/tests/eventlisten.sh for an example of usage within a shell script.
salt.runners.state.
orchestrate
(mods, saltenv='base', test=None, exclude=None, pillar=None)¶0.17.0 新版功能.
Execute a state run from the master, used as a powerful orchestration system.
CLI范例:
salt-run state.orchestrate webserver
salt-run state.orchestrate webserver saltenv=dev test=True
在 2014.1.1 版更改: Runner renamed from state.sls
to state.orchestrate
在 2014.7.0 版更改: Runner uses the pillar variable
salt.runners.state.
orchestrate_high
(data, test=None, queue=False, pillar=None, **kwargs)¶Execute a single state orchestration routine
2015.5.0 新版功能.
CLI Example:
salt-run state.orchestrate_high '{
stage_one:
{salt.state: [{tgt: "db*"}, {sls: postgres_setup}]},
stage_two:
{salt.state: [{tgt: "web*"}, {sls: apache_setup}, {
require: [{salt: stage_one}],
}]},
}'
salt.runners.state.
orchestrate_single
(fun, name, test=None, queue=False, pillar=None, **kwargs)¶Execute a single state orchestration routine
2015.5.0 新版功能.
CLI Example:
salt-run state.orchestrate_single fun=salt.wheel name=key.list_all