问题
I am currently working on a system that the only way to become root is via the command "sudo bash". My intentions are to use Ansible to install dependencies and configure files, and the currently documented methods of privilege escalation do not work with my current system setup.
回答1:
If only sudo bash
is available for you, then ansible with a controler <-> remote host connection is not a good candidate as this is a known limitation of the privilege escalation feature.
To explain a bit further, Ansible module commands are sent to the remote host using the current remote_user
as temporary python serialized files. For privilege escalation, those files are run with sudo
. See a more detailed description of how this works here.
You can still run ansible after becoming root directly on the host (targeting localhost in you playbook). You may want to have a look at ansible pull which will let you fetch and run a playbook out of a VCS like git.
来源:https://stackoverflow.com/questions/56008555/using-sudo-bash-to-elevate-user-permission-with-ansible