This runner makes Salt's execution modules available on the salt master.

New in version 2016.11.0.

Salt's execution modules are normally available on the salt minion. Use this runner to call execution modules on the salt master. Salt execution modules are the functions called by the salt command.

Execution modules can be called with salt-run:

salt-run salt.cmd
# call functions with arguments and keyword arguments
salt-run salt.cmd test.arg 1 2 3 key=value a=1

Execution modules are also available to salt runners:

__salt__['salt.cmd'](fun=fun, args=args, kwargs=kwargs)
salt.runners.salt.cmd(fun, *args, **kwargs)

Changed in version 2018.3.0: Added with_pillar argument

Execute fun with the given args and kwargs. Parameter fun should be the string name of the execution module to call.


Execution modules will be loaded every time this function is called. Additionally, keep in mind that since runners execute on the master, custom execution modules will need to be synced to the master using salt-run saltutil.sync_modules, otherwise they will not be available.

: False

If True, pillar data will be compiled for the master


To target the master in the pillar top file, keep in mind that the default id for the master is <hostname>_master. This can be overridden by setting an id configuration parameter in the master config file.

CLI example:

salt-run salt.cmd
# call functions with arguments and keyword arguments
salt-run salt.cmd test.arg 1 2 3 a=1
salt-run salt.cmd mymod.myfunc with_pillar=True
salt.runners.salt.execute(tgt, fun, arg=(), timeout=None, tgt_type=u'glob', ret=u'', jid=u'', kwarg=None, **kwargs)

New in version 2017.7.0.

Execute fun on all minions matched by tgt and tgt_type. Parameter fun is the name of execution module function to call.

This function should mainly be used as a helper for runner modules, in order to avoid redundant code. For example, when inside a runner one needs to execute a certain function on arbitrary groups of minions, only has to:

ret1 = __salt__['salt.execute']('*', '')
ret2 = __salt__['salt.execute']('my_nodegroup', 'mod2.fun2', tgt_type='nodegroup')

It can also be used to schedule jobs directly on the master, for example:

        function: salt.execute
            - edge-routers
            - bgp.neighbors
            tgt_type: nodegroup
        days: 1
        returner: redis