You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 and module_args arguments of ansible_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 used remote_user=root become=true earlier in my playbooks files (then i used ansible in CLI mode). How implement that pattern in ansible-runner?
The text was updated successfully, but these errors were encountered:
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 used
remote_user=root become=true
earlier in my playbooks files (then i used ansible in CLI mode). How implement that pattern in ansible-runner?The text was updated successfully, but these errors were encountered: