-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
playbook ignores command line become-method and overwrites with config default #13362
Comments
I don't see become-method=su anywhere. How are you setting it? |
In the command line it seems: --become-method=su |
Oh, right. So then don't use -K, but --ask-su-pass instead. |
But anyway, when specifying -K Ansible asks for the SU password. From: Abhijit Menon-Sen notifications@github.com Oh, right. So then don't use -K, but --ask-su-pass instead. Reply to this email directly or view it on GitHubhttps://github.com//issues/13362#issuecomment-160931104. |
so i cannot reproduce with my testing
|
@bcoca When running your command I receive an error:
Nevertheless, when using Even though, the problem seems only to occur with playbooks, since changing the
|
do you have any sudo/become vars set in inventory group/host vars? |
nope. I've just created a separate, empty play environment without any variables set then Can you reproduce this one with |
@bcoca Could you test it with Just tried the same for a different system without test.yml: ---
# This is it
- hosts: all
tasks:
- name: install vim
command: /usr/bin/whoami
become: yes test: (inventory)
Why does ansible-playbook try to execute |
The bug seems to be a little different: the become-method parameter is simply ignored by ansible-playbook. The only thing that's changing is the password prompt, but not the become logic itself. I'll close this one and open a new issue. |
I was not sure why this was hitting playbook but not adhoc since both use the same code. i was finally able to reproduce and traced it to setting defaults a bit aggressively and overriding the command line with them. PR incoming. |
tasks were overriding commandline with their defaults, not with the explicit setting, removed the setting of defaults from task init and pushed down to play context at last possible moment. fixes #13362
See also #13447 |
Great, works for me. |
I try to use
become-method=su
to execute privileged commands on a FreeBSD host, but the command fails withsudo: not found
:Output:_
Using ansible devel (cc36eed).
The text was updated successfully, but these errors were encountered: