I have a specific task run "shell: sudo script" in a playbook, where the 
script on the remote host must be executed via sudo but we can’t access the 
shell as root. The task is specified as the following:

     shell: sudo /usr/local/sbin/script {{ dir_path }}/{{ item }}

     with_items:

       - "{{ dirs.stdout_lines }}"

 

With Ansible 1.7,  I am getting the "failed to parse: [sudo] password" 
error when running ansible-playbook with -K -vvvv. 


ESTABLISH CONNECTION FOR USER: me

REMOTE_MODULE command sudo /usr/local/sbin/script /data/builds/175 
#USE_SHELL

EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'KbdInteractiveAuthentication=no', 
'-o', 
'PreferredAuthentications=gssapi-with-mic,gssapi-eyex,hostbased,publickey', 
'-o', 'PasswordAuthentication=no', '-o', 'User=me', '-o', 
'ConnectTimeout=10', 'ap.uw.edu', "/bin/sh -c 'mkdir -p 
$HOME/.ansible/tmp/ansible-tmp-1428972729.79-247009978596627 && chmod a+rx 
$HOME/.ansible/tmp/ansible-tmp-1428972729.79-247009978596627 && echo $
HOME/.ansible/tmp/ansible-tmp-1428972729.79-247009978596627'"]


PUT /tmp/tmp75nx9A TO /usr/lusers/me/.ansible/tmp/ansible-tmp-142
8972729.79-247009978596627/command


EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'KbdInteractiveAuthentication=no', 
'-o', 
'PreferredAuthentications=gssapi-with-mic,gssapi-eyex,hostbased,publickey', 
'-o', 'PasswordAuthentication=no', '-o', 'User=me', '-o', 
'ConnectTimeout=10', 'ap.uw.edu', u"/bin/sh -c 'LANG=en_US.UTF-8 
C_CTYPE=en_US.UTF-8 /usr/bin/python /usr/luse
rs/me/.ansible/tmp/ansible-tmp-1428972729.79-247009978596627/command'"]


fatal: [ap.uw.edu] => failed to parse: [sudo] password for me:

{"changed": true, "end": "2015-04-13 17:57:11.391966", "stdout": "", "cmd": 
"sudo /usr/local/sbin/script /data/builds/175 ", "start": "2015-04-13 
17:52:11.282850", "delta": "0:05:00.109116", "stderr": "", "rc": 1}


Would Ansible allow doing "shell: sudo script" in a playbook? 

 

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e2d24dd5-3c16-430c-a6fc-32e8627248b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to