Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for become_flags #691

Open
CarstenGrohmann opened this issue Apr 3, 2023 · 1 comment
Open

Please add support for become_flags #691

CarstenGrohmann opened this issue Apr 3, 2023 · 1 comment

Comments

@CarstenGrohmann
Copy link
Contributor

The Ansible sudo module provides the ability to pass additional options to the sudo command with the become_flags option.

This option is useful to open a login shell with -i, for example.

In my case, this is necessary to execute the command with the correct settings (path and environment variables).

My current workaround is:

with ansiblehost.sudo(user="root"):
	cmd = f"""su - {user} -c 'python {check_script}'"""
	result = ansiblehost.run(cmd)

instead of

with ansiblehost.sudo(user="root", flags="-i"):
	cmd = f"""python {check_script}"""
	result = ansiblehost.run(cmd)

Please add support for become_flags.

Thank you,
Carsten

@CarstenGrohmann
Copy link
Contributor Author

CarstenGrohmann commented Apr 4, 2023

See #336 also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant