ansible.builtin.sudo – Substitute User DO

Note

This module is part of ansible-base and included in all Ansible installations. In most cases, you can use the short module name sudo even without specifying the collections: keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.

New in version 2.8: of ansible.builtin

Synopsis

  • This become plugins allows your remote/login user to execute commands as another user via the sudo utility.

Parameters

Parameter Choices/Defaults Configuration Comments
become_exe
string
Default:
"sudo"
ini entries:

[privilege_escalation]
become_exe = sudo

[sudo_become_plugin]
executable = sudo

env:ANSIBLE_BECOME_EXE
env:ANSIBLE_SUDO_EXE
var: ansible_become_exe
var: ansible_sudo_exe
Sudo executable
become_flags
string
Default:
"-H -S -n"
ini entries:

[privilege_escalation]
become_flags = -H -S -n

[sudo_become_plugin]
flags = -H -S -n

env:ANSIBLE_BECOME_FLAGS
env:ANSIBLE_SUDO_FLAGS
var: ansible_become_flags
var: ansible_sudo_flags
Options to pass to sudo
become_pass
string
ini entries:

[sudo_become_plugin]
password = None

env:ANSIBLE_BECOME_PASS
env:ANSIBLE_SUDO_PASS
var: ansible_become_password
var: ansible_become_pass
var: ansible_sudo_pass
Password to pass to sudo
become_user
string
Default:
"root"
ini entries:

[privilege_escalation]
become_user = root

[sudo_become_plugin]
user = root

env:ANSIBLE_BECOME_USER
env:ANSIBLE_SUDO_USER
var: ansible_become_user
var: ansible_sudo_user
User you 'become' to execute the task

Authors

  • ansible (@core)

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/sudo_become.html