ansible-playbook error using --su

70 views
Skip to first unread message

Kessia Pinheiro

unread,
Jan 14, 2015, 11:29:37 AM1/14/15
to ansible...@googlegroups.com
I'm trying to run a simple playbook (actually it's another one, but I created that for tests), but it keep giving me the error below in any server I've tried:

---
- hosts: ideia3
  tasks
:
 
- shell: whoami


$ ansible-playbook test.yml -i production/inventory  --user=inadmin --ask-pass --su --ask-su-pass -vvvv
SSH password:
su password: 

PLAY [server3] ***************************************************************** 

TASK: [shell whoami] ********************************************************** 
<mail.server3.com> ESTABLISH CONNECTION FOR USER: inadmin
<mail.server3.com> REMOTE_MODULE command whoami #USE_SHELL
<mail.server3.com> EXEC sshpass -d4 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/kessia/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=5822 -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=inadmin -o ConnectTimeout=10 mail.server3.com /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681 && echo $HOME/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681'
<mail.server3.com> PUT /tmp/tmpSw53ph TO /home/inadmin/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681/command
<mail.server3.com> EXEC sshpass -d4 ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/kessia/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=5822 -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=inadmin -o ConnectTimeout=10 mail.server3.com /bin/sh -c 'su root -c "/bin/sh -c '"'"'echo SUDO-SUCCESS-wvyzlalvnjhasqemychsrmkysnhzkbsv; LANG=C LC_CTYPE=C /usr/bin/python /home/inadmin/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681/command; rm -rf /home/inadmin/.ansible/tmp/ansible-tmp-1421252635.58-1623863376681/ >/dev/null 2>&1'"'"'"'
fatal: [server3] => Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 590, in _executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 792, in _executor_internal
    return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 1025, in _executor_internal_inner
    result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
  File "/usr/lib/python2.7/site-packages/ansible/runner/action_plugins/normal.py", line 57, in run
    return self.runner._execute_module(conn, tmp, module_name, module_args, inject=inject, complex_args=complex_args)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 553, in _execute_module
    res = self._low_level_exec_command(conn, cmd, tmp, su=True, in_data=in_data)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 1166, in _low_level_exec_command
    in_data=in_data)
  File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 337, in exec_command
    elif sudo_errput.endswith(prompt):
TypeError: endswith first arg must be str, unicode, or tuple, not NoneType


FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/kessia/test.retry

server3                     : ok=0    changed=0    unreachable=1    failed=0   

David Moore

unread,
Jan 28, 2015, 3:23:08 PM1/28/15
to ansible...@googlegroups.com


On Thursday, 15 January 2015 05:29:37 UTC+13, Kessia Pinheiro wrote:
I'm trying to run a simple playbook (actually it's another one, but I created that for tests), but it keep giving me the error below in any server I've tried:
...
$ ansible-playbook test.yml -i production/inventory  --user=inadmin --ask-pass --su --ask-su-pass -vvvv
 ...
 
  File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 337, in exec_command
    elif sudo_errput.endswith(prompt):
TypeError: endswith first arg must be str, unicode, or tuple, not NoneType



I've just been struggling with the same problem.  (using v 1.8.2).

What I have discovered is it is the extra verbose logging -vvvv that seems to cause the error.  Try changing that to -vvv and see if it helps.


Reply all
Reply to author
Forward
0 new messages