Runners and orchestration

Salt runners are convenience applications executed with the salt-run command. Salt runners work similarly to Salt execution modules however they execute on the Salt master itself instead of remote Salt minions. A Salt runner can be a simple client call or a complex application.

Salt runners system

Interesting Salt runners
event Module for sending events using the runner system.
jobs A convenience system to manage jobs, both active and already run.
mine Module for sending events using the runner system.
pillar Functions to interact with the pillar compiler on the master


More information at Salt documentation: runners reference.


Orchestration is accomplished in salt primarily through the Orchestrate Runner. This Salt Runner can use the full suite of requisites available in states, and can also execute states/functions using salt-ssh.

The orchestrate runner generalizes the Salt state system to a Salt master context. The state.sls, state.highstate, et al functions are concurrently and independently executed on each Salt minion, the state.orchestrate runner is executed on the master, giving it a master-level view and control over requisites, such as state ordering and conditionals. This allows for inter minion requisites, like ordering the application of states on different minions that must not happen simultaneously, or for halting the state run on all minions if a minion fails one of its states.

If you want to setup a load balancer in front of a cluster of web servers, for example, you can ensure the load balancer is setup before the web servers or stop the state run altogether if one of the minions does not set up correctly.

Many states/functions can be configured in a single file, which when combined with the full suite of requisites, can be used to easily configure complex orchestration tasks. Additionally, the states/functions will be executed in the order in which they are defined, unless prevented from doing so by any requisites.

Lab: Create an orchestration configuration

To execute a functions on given nodes, use salt.function resource.

Create salt.function at /srv/salt/orch/clean_foo.sls:
    - tgt: '*'
    - arg:
      - rm -rf /tmp/foo

To execute a state on given nodes, use salt.state resource.

salt-run state.orchestrate orch.cleanfoo

Create the salt.state example at /srv/salt/orch/webserver.sls.

    - tgt: 'web*'
    - sls:
      - nginx