salt.modules.sudo

Allow for the calling of execution modules via sudo.

This module is invoked by the minion if the sudo_user minion config is present.

Example minion config:

sudo_user: saltdev

Once this setting is made, any execution module call done by the minion will be run under sudo -u <sudo_user> salt-call. For example, with the above minion config,

salt sudo_minion cmd.run 'cat /etc/sudoers'

is equivalent to

sudo -u saltdev salt-call cmd.run 'cat /etc/sudoers'

being run on sudo_minion.

salt.modules.sudo.salt_call(runas, fun, *args, **kwargs)

Wrap a shell execution out to salt call with sudo

Example:

/etc/salt/minion

sudo_user: saltdev
salt '*' test.ping  # is run as saltdev user