HI:
    
Ansible Version:

[vagrant@master ansible]$ ansible --version

 

ansible 1.9.2 

  configured module search path = None


Environment: 
client is same as master.

[vagrant@master ansible]$ cat /etc/redhat-release 
CentOS release 6.6 (Final)

[vagrant@master ansible]$ locale

LANG=zh_CN.UTF-8

LC_CTYPE="zh_CN.UTF-8"

LC_NUMERIC="zh_CN.UTF-8"

LC_TIME="zh_CN.UTF-8"

LC_COLLATE="zh_CN.UTF-8"

LC_MONETARY="zh_CN.UTF-8"

LC_MESSAGES="zh_CN.UTF-8"

LC_PAPER="zh_CN.UTF-8"

LC_NAME="zh_CN.UTF-8"

LC_ADDRESS="zh_CN.UTF-8"

LC_TELEPHONE="zh_CN.UTF-8"

LC_MEASUREMENT="zh_CN.UTF-8"

LC_IDENTIFICATION="zh_CN.UTF-8"

LC_ALL=






*Problem:*
*when I run like this:*

[vagrant@master ansible]$ ansible all -m shell  -a 'whoami' -u vagrant --su 
 --su-user=root --ask-su-pass -k -vvv 
SSH password:  
SU password[defaults to SSH password]:  
<192.168.33.101> ESTABLISH CONNECTION FOR USER: vagrant 
<192.168.33.101> REMOTE_MODULE command whoami #USE_SHELL 
<192.168.33.101> EXEC sshpass -d6 ssh -C -tt -v -o ControlMaster=auto -o 
ControlPersist=60s -o ControlPath=
"/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o GSSAPIAuthentication=no 
-o PubkeyAuthentication=no -o ConnectTimeout=10 192.168.33.101 /bin/sh -c 
'mkdir 
-p $HOME/.ansible/tmp/ansible-tmp-1439290735.17-42884376805584 && chmod 
a+rx $HOME/.ansible/tmp/ansible-tmp-1439290735.17-42884376805584 && echo 
$HOME/.ansible/tmp/ansible-tmp-1439290735.17-42884376805584' 
<192.168.33.101> PUT /tmp/tmpqXDswp TO /home/vagrant/.ansible/tmp/ansible-
tmp-1439290735.17-42884376805584/command 
<192.168.33.101> EXEC sshpass -d6 ssh -C -tt -v -o ControlMaster=auto -o 
ControlPersist=60s -o ControlPath=
"/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r" -o GSSAPIAuthentication=no 
-o PubkeyAuthentication=no -o ConnectTimeout=10 192.168.33.101 /bin/sh -c 'su 
root -c "/bin/sh -c '"'"'echo 
BECOME-SUCCESS-erjxmrwbinqrhshhjhnvurorvvvchdwu; LANG=C LC_CTYPE=C 
/usr/bin/python 
/home/vagrant/.ansible/tmp/ansible-tmp-1439290735.17-42884376805584/command; 
rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1439290735.17-42884376805584/ 
>/dev/null 2>&1'"'"'"' 

 

* it would hang here. and nothing happened.*



*but after  add "-c paramiko"  it  worked fine.*


[vagrant@master ansible]$ ansible all -m shell  -a 'whoami' -u vagrant --su 
--ask-su-pass  --su-user=root  -k -vvv -c paramiko
SSH password:  
SU password[defaults to SSH password]:  
<192.168.33.101> ESTABLISH CONNECTION FOR USER: vagrant on PORT 22 TO 
192.168.33.101 
<192.168.33.101> REMOTE_MODULE command whoami #USE_SHELL 
<192.168.33.101> EXEC /bin/sh -c 'mkdir -p 
$HOME/.ansible/tmp/ansible-tmp-1439291679.85-56991589093799 && chmod a+rx 
$HOME/.ansible/tmp/ansible-tmp-1439291679.85-56991589093799 && echo 
$HOME/.ansible/tmp/ansible-tmp-1439291679.85-56991589093799' 
<192.168.33.101> PUT /tmp/tmpI15Pt9 TO /home/vagrant/.ansible/tmp/ansible-
tmp-1439291679.85-56991589093799/command 
<192.168.33.101> EXEC /bin/sh -c 'su root -c "/bin/sh -c '"'"'echo 
BECOME-SUCCESS-phfsumyntqcookmrpodqpvbtyrngtlgw; LANG=C LC_CTYPE=C 
/usr/bin/python 
/home/vagrant/.ansible/tmp/ansible-tmp-1439291679.85-56991589093799/command; 
rm -rf /home/vagrant/.ansible/tmp/ansible-tmp-1439291679.85-56991589093799/ 
>/dev/null 2>&1'"'"'"' 

node1 | success | rc=0 >> 
root 





*I have try*

ansible all -m shell  -a 'whoami' -u vagrant --become --ask-become-pass --
become-method=su -k -vvv
*it would hang too.*


*but this worked fine.*

ansible all -m shell  -a 'whoami' -u vagrant --become --ask-become-pass --
become-method=su -k -vvv -c paramiko





*does "su command" can't work with sshpass ? or this is a bug ?*





*thanks*



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0c61591d-a1a1-46ae-afb8-2b66b671a358%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to