adding sudo exec module docs

This commit is contained in:
Justin Findlay 2015-06-30 01:26:43 -06:00
parent e4a40b7bd8
commit a9269c072a

View file

@ -1,6 +1,31 @@
# -*- coding: utf-8 -*-
'''
Allow for the calling of execution modules via 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:
.. code-block:: yaml
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,
.. code-block:: bash
salt sudo_minion cmd.run 'cat /etc/sudoers'
is equivalent to
.. code-block:: bash
sudo -u saltdev salt-call cmd.run 'cat /etc/sudoers'
being run on ``sudo_minion``.
'''
# Import python libs
import json
@ -21,9 +46,17 @@ def salt_call(runas, fun, *args, **kwargs):
'''
Wrap a shell execution out to salt call with sudo
CLI Example::
Example:
salt '*' sudo.salt_call root test.ping
/etc/salt/minion
.. code-block:: yaml
sudo_user: saltdev
.. code-block:: bash
salt '*' test.ping # is run as saltdev user
'''
cmd = ['sudo',
'-u', runas,