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

playbook ignores command line become-method and overwrites with config default #13362

Closed
8191 opened this issue Nov 30, 2015 · 13 comments
Closed
Labels
bsd BSD community bug This issue/PR relates to a bug.

Comments

@8191
Copy link
Contributor

8191 commented Nov 30, 2015

I try to use become-method=su to execute privileged commands on a FreeBSD host, but the command fails with sudo: not found:

- hosts: rio32
  tasks:
    - name: install vim
      package: name=vim state=present
      become: yes

Output:_

% ansible-playbook -i production test.yml --become-method=su -K -vvvv
Using /home/mf/cm/ansible.cfg as config file
SU password:
1 plays in test.yml
Loaded callback default of type stdout, v2.0

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 (umask 22 && mkdir -p "`echo $HOME/.ansible/tmp/ansible-tmp-1448915630.14-36944948795781`" && echo "`echo $HOME/.ansible/tmp/ansible-tmp-1448915630.14-36944948795781`")
<10.2.1.14> PUT /tmp/tmpQh089m TO /home/mf/.ansible/tmp/ansible-tmp-1448915630.14-36944948795781/setup
<10.2.1.14> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [10.2.1.14]
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1448915630.14-36944948795781/setup; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1448915630.14-36944948795781/" > /dev/null 2>&1
ok: [rio32]

TASK [install vim] *************************************************************
task path: /home/mf/cm/test.yml:5
Running pkgng
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 (umask 22 && mkdir -p "`echo $HOME/.ansible/tmp/ansible-tmp-1448915631.78-259327113304949`" && echo "`echo $HOME/.ansible/tmp/ansible-tmp-1448915631.78-259327113304949`")
<10.2.1.14> PUT /tmp/tmpugm5XP TO /home/mf/.ansible/tmp/ansible-tmp-1448915631.78-259327113304949/pkgng
<10.2.1.14> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [10.2.1.14]
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 /bin/sh -c 'sudo -H -S  -p "[sudo via ansible, key=nznhoevimlfazscxeponxpxbdlrgiose] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-nznhoevimlfazscxeponxpxbdlrgiose; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1448915631.78-259327113304949/pkgng; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1448915631.78-259327113304949/" > /dev/null 2>&1'"'"''
fatal: [rio32]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"name": "vim", "state": "present"}, "module_name": "package"}, "msg": "sudo: not found\r\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /home/mf/.ssh/config\r\ndebug1: /home/mf/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 23018\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 127\r\nShared connection to 10.2.1.14 closed.\r\n", "parsed": false}

PLAY RECAP *********************************************************************
rio32                      : ok=1    changed=0    unreachable=0    failed=1

Using ansible devel (cc36eed).

@amenonsen
Copy link
Contributor

I don't see become-method=su anywhere. How are you setting it?

@mscherer
Copy link
Contributor

mscherer commented Dec 1, 2015

In the command line it seems: --become-method=su

@amenonsen
Copy link
Contributor

Oh, right. So then don't use -K, but --ask-su-pass instead.

@8191
Copy link
Contributor Author

8191 commented Dec 1, 2015

But anyway, when specifying -K Ansible asks for the SU password.

From: Abhijit Menon-Sen notifications@github.com
Sent: 1 Dec 2015 11:45
To: ansible/ansible
Cc: 8191
Subject: Re: [ansible] become method 'su' requires sudo (#13362)

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.

@jimi-c jimi-c modified the milestones: v2, next Dec 1, 2015
@bcoca
Copy link
Member

bcoca commented Dec 1, 2015

so i cannot reproduce with my testing

#> ansible -m shell -a "whoami" fbsd10test -vvvv --become --become-method=su --ask-su-pass
Using /home/bcoca/.ansible.cfg as config file
SU password: 
Loaded callback minimal of type stdout, v2.0
<192.168.1.26> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.1.26> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/bcoca/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.1.26 (umask 22 && mkdir -p "`echo $HOME/.ansible/tmp/ansible-tmp-1448986220.19-244786759458839`" && echo "`echo $HOME/.ansible/tmp/ansible-tmp-1448986220.19-244786759458839`")
<192.168.1.26> PUT /tmp/tmpHv7Gn6 TO /home/bcoca/.ansible/tmp/ansible-tmp-1448986220.19-244786759458839/command
<192.168.1.26> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/bcoca/.ansible/cp/ansible-ssh-%h-%p-%r [192.168.1.26]
<192.168.1.26> ESTABLISH SSH CONNECTION FOR USER: None
<192.168.1.26> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/bcoca/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.1.26 /bin/sh -c 'su  root -c "/bin/sh -c '"'"'echo BECOME-SUCCESS-pttyhpnyyayhggmfcanzktpntivqlsbw; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/bcoca/.ansible/tmp/ansible-tmp-1448986220.19-244786759458839/command; rm -rf "/home/bcoca/.ansible/tmp/ansible-tmp-1448986220.19-244786759458839/" > /dev/null 2>&1'"'"'"'
fbsd10test | SUCCESS | rc=0 >>
root

@8191
Copy link
Contributor Author

8191 commented Dec 1, 2015

@bcoca When running your command I receive an error:

ansible: error: Sudo arguments ('--sudo', '--sudo-user', and '--ask-sudo-pass') and su arguments ('-su', '--su-user', and '--ask-su-pass') and become arguments ('--become', '--become-user', and '--ask-become-pass') are exclusive of each other

Nevertheless, when using --ask-become-pass instead of --ask-su-pass the command executes successfully.

Even though, the problem seems only to occur with playbooks, since changing the -K in my initial command to --ask-become-pass still fails with sudo not found:

% ansible-playbook -i production test.yml --become-method=su --ask-become-pass -vvvv 
Using /home/mf/cm/ansible.cfg as config file
SU password: 
1 plays in test.yml
Loaded callback default of type stdout, v2.0

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 (umask 22 && mkdir -p "`echo $HOME/.ansible/tmp/ansible-tmp-1448993882.28-148986560388726`" && echo "`echo $HOME/.ansible/tmp/ansible-tmp-1448993882.28-148986560388726`")
<10.2.1.14> PUT /tmp/tmpmfFjmX TO /home/mf/.ansible/tmp/ansible-tmp-1448993882.28-148986560388726/setup
<10.2.1.14> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [10.2.1.14]
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1448993882.28-148986560388726/setup; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1448993882.28-148986560388726/" > /dev/null 2>&1
ok: [rio32]

TASK [install vim] *************************************************************
task path: /home/mf/cm/test.yml:5
Running pkgng
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 (umask 22 && mkdir -p "`echo $HOME/.ansible/tmp/ansible-tmp-1448993883.89-131842805765806`" && echo "`echo $HOME/.ansible/tmp/ansible-tmp-1448993883.89-131842805765806`")
<10.2.1.14> PUT /tmp/tmplhxwVG TO /home/mf/.ansible/tmp/ansible-tmp-1448993883.89-131842805765806/pkgng
<10.2.1.14> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [10.2.1.14]
<10.2.1.14> ESTABLISH SSH CONNECTION FOR USER: None
<10.2.1.14> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt 10.2.1.14 /bin/sh -c 'sudo -H -S  -p "[sudo via ansible, key=kxfatqkvtdyixpecvdlusvfcybnlqxzh] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-kxfatqkvtdyixpecvdlusvfcybnlqxzh; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1448993883.89-131842805765806/pkgng; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1448993883.89-131842805765806/" > /dev/null 2>&1'"'"''
fatal: [rio32]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"name": "vim", "state": "present"}, "module_name": "package"}, "msg": "sudo: not found\r\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /home/mf/.ssh/config\r\ndebug1: /home/mf/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 20540\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 127\r\nShared connection to 10.2.1.14 closed.\r\n", "parsed": false}

PLAY RECAP *********************************************************************
rio32                      : ok=1    changed=0    unreachable=0    failed=1   

@bcoca bcoca removed this from the next milestone Dec 1, 2015
@bcoca
Copy link
Member

bcoca commented Dec 1, 2015

do you have any sudo/become vars set in inventory group/host vars?

@8191
Copy link
Contributor Author

8191 commented Dec 1, 2015

nope. I've just created a separate, empty play environment without any variables set then ansible_ssh_host and ansible_python_interpreter.

Can you reproduce this one with ansible-playbook?

@8191
Copy link
Contributor Author

8191 commented Dec 5, 2015

@bcoca Could you test it with ansible-playbook?

Just tried the same for a different system without sudo (OpenBSD):

test.yml:

---
# This is it
- hosts: all
  tasks:
    - name: install vim
      command: /usr/bin/whoami
      become: yes

test: (inventory)

hanoi ansible_ssh_host=hanoi ansible_python_interpreter=/usr/local/bin/python2.7
% ansible-playbook -i test test.yml -l hanoi --ask-become-pass --become-method=su -vvvv
No config file found; using defaults
SU password:
Loaded callback default of type stdout, v2.0
1 plays in test.yml

PLAY ***************************************************************************

TASK [setup] *******************************************************************
<hanoi> ESTABLISH SSH CONNECTION FOR USER: None
<hanoi> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt hanoi ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1449345756.61-176309372776055 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1449345756.61-176309372776055 )" )
<hanoi> PUT /tmp/tmpT1TENf TO /home/mf/.ansible/tmp/ansible-tmp-1449345756.61-176309372776055/setup
<hanoi> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [hanoi]
<hanoi> ESTABLISH SSH CONNECTION FOR USER: None
<hanoi> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt hanoi LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1449345756.61-176309372776055/setup; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1449345756.61-176309372776055/" > /dev/null 2>&1
ok: [hanoi]

TASK [install vim] *************************************************************
task path: /home/mf/cm/test/test.yml:5
<hanoi> ESTABLISH SSH CONNECTION FOR USER: None
<hanoi> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt hanoi ( umask 22 && mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1449345761.13-144772997934224 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1449345761.13-144772997934224 )" )
<hanoi> PUT /tmp/tmpTJq7xX TO /home/mf/.ansible/tmp/ansible-tmp-1449345761.13-144772997934224/command
<hanoi> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r [hanoi]
<hanoi> ESTABLISH SSH CONNECTION FOR USER: None
<hanoi> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/mf/.ansible/cp/ansible-ssh-%h-%p-%r -tt hanoi /bin/sh -c 'sudo -H -S  -p "[sudo via ansible, key=wmnmoryifzysqaysixrkkfudwogocgml] password: " -u root /bin/sh -c '"'"'echo BECOME-SUCCESS-wmnmoryifzysqaysixrkkfudwogocgml; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/local/bin/python2.7 /home/mf/.ansible/tmp/ansible-tmp-1449345761.13-144772997934224/command; rm -rf "/home/mf/.ansible/tmp/ansible-tmp-1449345761.13-144772997934224/" > /dev/null 2>&1'"'"''
fatal: [hanoi]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"_raw_params": "/usr/bin/whoami"}, "module_name": "command"}, "msg": "/bin/sh: sudo: not found\r\nOpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /home/mf/.ssh/config\r\ndebug1: /home/mf/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 56: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 31890\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 127\r\nShared connection to hanoi closed.\r\n", "parsed": false}

Why does ansible-playbook try to execute ssh (...) hanoi /bin/sh -c 'sudo -H -S (...) even I've passed --become-method=su and even if the prompt asks for SU password?

@8191 8191 changed the title become method 'su' requires sudo become-method parameter of ansible-playbook ignored Dec 5, 2015
@8191 8191 changed the title become-method parameter of ansible-playbook ignored become method 'su' requires sudo Dec 5, 2015
@8191
Copy link
Contributor Author

8191 commented Dec 5, 2015

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.

@8191 8191 closed this as completed Dec 5, 2015
@bcoca
Copy link
Member

bcoca commented Dec 5, 2015

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.

@bcoca bcoca reopened this Dec 5, 2015
@bcoca bcoca changed the title become method 'su' requires sudo playbook ignores command line become-method and overwrites with config default Dec 5, 2015
bcoca added a commit that referenced this issue Dec 5, 2015
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
@bcoca bcoca closed this as completed in 9557102 Dec 5, 2015
@8191
Copy link
Contributor Author

8191 commented Dec 5, 2015

See also #13447

@8191
Copy link
Contributor Author

8191 commented Dec 5, 2015

Great, works for me.

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@dagwieers dagwieers added the bsd BSD community label Jan 18, 2019
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bsd BSD community bug This issue/PR relates to a bug.
Projects
None yet
Development

No branches or pull requests

7 participants