Open MaxDXDX opened 4 months ago
See the comments under issue #1082.
Basically, you need to use the cmdline
keyword argument available in the ansible_runner.run()
method to pass along options to do privilege escalation (example: cmdline="-K -b"
). For the password prompt handling, you'll have to utilize the env/passwords
file in the private data directory (see https://ansible.readthedocs.io/projects/runner/en/stable/intro/#env-passwords).
I'm using runner in my python project as a python module (not via command line tool). And I do not use playbook files. I pass required parameters of tasks by
module
andmodule_args
arguments ofansible_runner.run
function. So far so good. But i got stuck then I needed to run tasks as root user. I connect to host under user with sudo rights, but i do not understand how to execute operations under sudo mode. I usedremote_user=root become=true
earlier in my playbooks files (then i used ansible in CLI mode). How implement that pattern in ansible-runner?