# \-K, --ask-sudo-pass deprecated but --become doesn't functioning properly?

**URL:** <https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907>\
**Category:** Ansible Developer\
**Created:** [July 31, 2015, 7:54am UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907 "2015-07-31T07:54:48Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 7:54am UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/1 "2015-07-31T07:54:48Z")

</div>

This is related to [#11808](https://github.com/ansible/ansible/issues/11808)

Making the move from -K to --become and running into many problems.

Since the first day of running the git devel branch I haven’t had this many problems so I feel like the problems are “personal problems” 🙂 Given no one else is posting here this type of problem or opening similar issues on github I again feel like this is a “personal problem”.

Many of my roles are like this:

roles:

- { role: bootstrap, sudo: yes }

Side note, shouldn’t this be something like:

- { role: bootstrap, become: yes }

or

- { role: bootstrap, become\_method: sudo }

Many roles that work with -K fail with --become, like a simple hostname setup? It just hangs.

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 8:36am UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/2 "2015-07-31T08:36:38Z")

</div>

Guessing my debugging skills aren’t very good.

roles:

- { role: bootstrap, become: yes }

Seems to resolve a lot of my problems.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 31, 2015, 1:18pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/3 "2015-07-31T13:18:20Z")

</div>

responses inline

> This is related to #11808
> 
> Making the move from -K to --become and running into many problems.

-K is --sudo-ask-pass, which is equivalent to --become-ask-pass, not --become  
-s is --sudo which is equivalent to --become (and -S --su)

> roles:  
> &nbsp;&nbsp;- { role: bootstrap, sudo: yes }
> 
> Side note, shouldn't this be something like:
> 
> &nbsp;&nbsp;- { role: bootstrap, become: yes }
> 
> or
> 
> &nbsp;&nbsp;- { role: bootstrap, become\_method: sudo }

setting the method does not imply become=true, it just sets the  
default for when become=true

> Many roles that work with -K fail with --become, like a simple hostname  
> setup? It just hangs.

it hangs because you are not providing a password, which -K prompts  
for but --become does not as per my first reply above.

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 6:39pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/4 "2015-07-31T18:39:23Z")

</div>

I used to invoke ansible like this:

$ ansible-playbook -i blah-inventory -K -k blah-playbook.yml

and not I invoke it like this:

$ ansible-playbook -i blah-inventory --ask-become-pass --become -i blah-inventory

Correct?

IF that is the correct invocation then I’m back to the template module hanging (as documented in [https://github.com/ansible/ansible/issues/11808](https://github.com/ansible/ansible/issues/11808)). Another example. Different role using template module.

- name: apticron.conf  
template: \>  
src={{ ansible\_lsb.codename }}/apticron.conf.j2  
dest=/etc/apticron/apticron.conf  
owner=root  
group=root  
mode=0644  
tags: apticron

ansible-playbook -i ~/projects/ansible.git/playbooks/vagrant-inventory ~/projects/ansible.git/playbooks/vagrant.yml --ask-become-pass --become -vvvv  
Using ~/projects/ansible.git/playbooks/ansible.cfg as config file  
SUDO password:

TASK [apticron : apticron.conf] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 mkdir -p “$HOME/.ansible/tmp/ansible-tmp-1438366902.71-207412673011801” && chmod a+rx “$HOME/.ansible/tmp/ansible-tmp-1438366902.71-207412673011801” && echo “$HOME/.ansible/tmp/ansible-tmp-1438366902.71-207412673011801”  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=tcskruuzdkrswczrlhqwlrptvdtiikjs] password: " -u root /bin/sh -c '”’“'echo BECOME-SUCCESS-tcskruuzdkrswczrlhqwlrptvdtiikjs; rc=flag; [-r /etc/apticron/apticron.conf] || rc=2; [-f /etc/apticron/apticron.conf] || rc=1; [-d /etc/apticron/apticron.conf] && rc=3; python -V 2\>/dev/null || rc=4; [x”$rc" != “xflag”] && echo “${rc} “/etc/apticron/apticron.conf && exit 0; (python -c '”'”‘"’“'”‘"’“'”‘import hashlib; BLOCKSIZE = 65536; hasher = hashlib.sha1();  
afile = open("’“'”‘"’“'”‘"’“'”‘/etc/apticron/apticron.conf’“'”‘"’“'”‘"’“'”‘", “rb”)  
buf = afile.read(BLOCKSIZE)  
while len(buf) \> 0:  
hasher.update(buf)  
buf = afile.read(BLOCKSIZE)  
afile.close()  
print(hasher.hexdigest())’“'”‘"’“'”‘"’“'”’ 2\>/dev/null) || (python -c ‘"’“'”‘"’“'”‘"’“'import sha; BLOCKSIZE = 65536; hasher = sha.sha();  
afile = open(”‘"’“'”‘"’“'”‘"’“‘/etc/apticron/apticron.conf’”‘"’“'”‘"’“'”‘"’“, “rb”)  
buf = afile.read(BLOCKSIZE)  
while len(buf) \> 0:  
hasher.update(buf)  
buf = afile.read(BLOCKSIZE)  
afile.close()  
print(hasher.hexdigest())'”‘"’“'”‘"’“'”‘"’ 2\>/dev/null) || (echo ‘"’“'”‘"’“'”‘"’“'0 '”‘"’“'”‘"’“'”‘"’/etc/apticron/apticron.conf)‘"’"‘’

**HANGS**

On the remote side the “sudo -H -S -p [sudo via ansible, key=tcskruuzdkrswczrlhqwlrptvdtiikjs] password:” is waiting on a read.

$ sudo strace -p 6283  
[sudo] password for ansible:  
Process 6283 attached  
read(0,

On the control host the "ssh -C -tt -vvv -o ControlMaster=auto " is … don’t know what this is telling me. Little GoogleFu tells me we are waiting on a BSD system call to return but I have no idea what system API is being called.

$ sudo dtruss -p 14453  
Password:  
SYSCALL(args) = return

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 8:25pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/5 "2015-07-31T20:25:02Z")

</div>

More (personal?) issues?

ANSIBLE\_KEEP\_REMOTE\_FILES=1 and setup works as expected.

% ANSIBLE\_KEEP\_REMOTE\_FILES=1 ansible-playbook -i ~/projects/ansible.git/playbooks/vagrant-inventory ~/projects/ansible.git/playbooks/vagrant.yml -vvvv  
Using ~/projects/ansible.git/playbooks/ansible.cfg as config file  
1 plays in ~/projects/ansible.git/playbooks/vagrant.yml  
Loaded callback default of type stdout, v2.0

PLAY \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 mkdir -p “$HOME/.ansible/tmp/ansible-tmp-1438373803.07-183638808056090” && chmod a+rx “$HOME/.ansible/tmp/ansible-tmp-1438373803.07-183638808056090” && echo “$HOME/.ansible/tmp/ansible-tmp-1438373803.07-183638808056090”  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> PUT /var/folders/d\_/bm7rvz154jb\_2djkqybb503h0000gp/T/tmpIuLWJX TO /home/ansible/.ansible/tmp/ansible-tmp-1438373803.07-183638808056090/setup  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 LANG=C LC\_MESSAGES=C LC\_CTYPE=C /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1438373803.07-183638808056090/setup  
ok: [testing]

ANSIBLE\_KEEP\_REMOTE\_FILES=1 with --become and --ask-become-pass and setup hangs

% ANSIBLE\_KEEP\_REMOTE\_FILES=1 ansible-playbook -i ~/projects/ansible.git/playbooks/vagrant-inventory ~/projects/ansible.git/playbooks/vagrant.yml --ask-become-pass --become -vvvv  
Using ~/projects/ansible.git/playbooks/ansible.cfg as config file  
SUDO password:

plays in ~/projects/ansible.git/playbooks/vagrant.yml  
Loaded callback default of type stdout, v2.0

PLAY \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
TASK [setup] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 mkdir -p “$HOME/.ansible/tmp/ansible-tmp-1438374066.58-129658387415852” && chmod a+rx “$HOME/.ansible/tmp/ansible-tmp-1438374066.58-129658387415852” && echo “$HOME/.ansible/tmp/ansible-tmp-1438374066.58-129658387415852”  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> PUT /var/folders/d\_/bm7rvz154jb\_2djkqybb503h0000gp/T/tmpfcw1XC TO /home/ansible/.ansible/tmp/ansible-tmp-1438374066.58-129658387415852/setup  
\<10.X.X.193\> ESTABLISH SSH CONNECTION FOR USER: ansible  
\<10.X.X.193\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=600s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=avmjfmpzrimdtudrpdcayejzjmvgahpj] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-avmjfmpzrimdtudrpdcayejzjmvgahpj; LANG=C LC\_MESSAGES=C LC\_CTYPE=C /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1438374066.58-129658387415852/setup’”‘"’’

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 9:40pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/6 "2015-07-31T21:40:23Z")

</div>

Breaking down the play.

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=benehbanetqnytmmkklumnbvsiyukasg] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-benehbanetqnytmmkklumnbvsiyukasg; LANG=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1438377089.9-208037963158211/hostname’”‘"’’  
OpenSSH\_6.2p2, OSSLShim 0.9.8r 8 Dec 2011  
debug1: Reading configuration data /etc/ssh\_config  
debug1: /etc/ssh\_config line 20: Applying options for \*  
debug1: auto-mux: Trying existing master  
debug2: fd 3 setting O\_NONBLOCK  
debug2: mux\_client\_hello\_exchange: master version 4  
debug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote  
debug3: mux\_client\_request\_session: entering  
debug3: mux\_client\_request\_alive: entering  
debug3: mux\_client\_request\_alive: done pid = 1474  
debug3: mux\_client\_request\_session: session request sent  
debug1: mux\_client\_request\_session: master session id: 12  
usage: sudo -h | -K | -k | -V  
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]  
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]  
[command]  
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] [VAR=value] [-i|-s] []  
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] file …  
debug3: mux\_client\_read\_packet: read header failed: Broken pipe

Odd, improper invocation of sudo? Break down of the sudo commands.

$ /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=benehbanetqnytmmkklumnbvsiyukasg] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-benehbanetqnytmmkklumnbvsiyukasg; LANG=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1438377089.9-208037963158211/hostname’”‘"’’

[sudo via ansible, key=benehbanetqnytmmkklumnbvsiyukasg] password:

BECOME-SUCCESS-benehbanetqnytmmkklumnbvsiyukasg  
{“changed”: false, “name”: “tester”, “ansible\_facts”: {“ansible\_hostname”: “tester”}}

That seems to work.

Test the ssh command.

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193

OpenSSH\_6.2p2, OSSLShim 0.9.8r 8 Dec 2011  
debug1: Reading configuration data /etc/ssh\_config  
debug1: /etc/ssh\_config line 20: Applying options for \*  
debug1: auto-mux: Trying existing master  
debug2: fd 3 setting O\_NONBLOCK  
debug2: mux\_client\_hello\_exchange: master version 4  
debug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote  
debug3: mux\_client\_request\_session: entering  
debug3: mux\_client\_request\_alive: entering  
debug3: mux\_client\_request\_alive: done pid = 1474  
debug3: mux\_client\_request\_session: session request sent  
debug1: mux\_client\_request\_session: master session id: 12  
Last login: Fri Jul 31 16:33:09 2015 from 172.X.X.100  
ansible@tester:~$

That seems to work.

Test the first sudo command, /bin/sh -c ‘sudo -k’

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 /bin/sh -c ‘sudo -k’  
OpenSSH\_6.2p2, OSSLShim 0.9.8r 8 Dec 2011  
debug1: Reading configuration data /etc/ssh\_config  
debug1: /etc/ssh\_config line 20: Applying options for \*  
debug1: auto-mux: Trying existing master  
debug2: fd 3 setting O\_NONBLOCK  
debug2: mux\_client\_hello\_exchange: master version 4  
debug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote  
debug3: mux\_client\_request\_session: entering  
debug3: mux\_client\_request\_alive: entering  
debug3: mux\_client\_request\_alive: done pid = 1474  
debug3: mux\_client\_request\_session: session request sent  
debug1: mux\_client\_request\_session: master session id: 12  
usage: sudo -h | -K | -k | -V  
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]  
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]  
[command]  
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] [VAR=value] [-i|-s] []  
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] file …  
debug3: mux\_client\_read\_packet: read header failed: Broken pipe  
debug2: Received exit status from master 1

Not expected! Just over to the target system.

$ /bin/sh -c ‘sudo -k’  
$ echo $?  
0

So something about executing /bin/sh -c ‘sudo -k’ via ssh is breaking thing?

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 9:49pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/7 "2015-07-31T21:49:41Z")

</div>

Is it the sudo -k?

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 /bin/sh -c ‘sudo -h’

usage: sudo -h | -K | -k | -V  
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]  
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]  
[command]  
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] [VAR=value] [-i|-s] []  
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p  
prompt] [-u user] file …

Nope.

Is it the /bin/sh -c?

ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 sudo -h

Options:  
-A, --askpass use a helper program for password prompting  
-b, --background run command in the background  
-C, --close-from=num close all file descriptors \>= num  
-E, --preserve-env preserve user environment when running command  
-e, --edit edit files instead of running a command  
-g, --group=group run command as the specified group name or ID  
-H, --set-home set HOME variable to target user’s home dir  
-h, --help display help message and exit

Yes!

What is ssh treating differently between /bin/sh -c ‘sudo -k’ vs sudo -k ?

---

<div class="post-metadata">

**Author:** ![Bob\_Tanner](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Bob\_Tanner](https://forum.ansible.com/u/Bob_Tanner)\
**Post date:** [July 31, 2015, 10:33pm UTC](https://forum.ansible.com/t/k-ask-sudo-pass-deprecated-but-become-doesnt-functioning-properly/18907/8 "2015-07-31T22:33:55Z")

</div>

I was able to get the ssh and sudo commands to work properly from the control host like this

$ ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/tmp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 10.X.X.193 ‘/bin/sh -c “sudo -k && sudo -H -S -p "[sudo via ansible, key=oyhepruyffgwmikqvhscueppmxdhrrrs] password: " -u root /bin/sh -c "/usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1438379820.92-121855719831019/hostname"”’

At least under Ubuntu 14.04 you need to quote the whole command passed via ssh.

I’ll post this to the issue as well.
