IndexError: list index out of range

582 views
Skip to first unread message

Amol Shende

unread,
Feb 12, 2015, 1:18:26 AM2/12/15
to ansible...@googlegroups.com
Hi Everyone, I am using ansible since 2 months. It was working fine uptill now. But, now it is giving error to every ansible command.
For Ex. I am running ping command it is giving following error

ansible -vvvv 172.27.59.27 -m ping

<172.27.59.27> ESTABLISH CONNECTION FOR USER: root
<172.27.59.27> REMOTE_MODULE ping
<172.27.59.27> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 172.27.59.27 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1423718954.13-54115388015450 && echo $HOME/.ansible/tmp/ansible-tmp-1423718954.13-54115388015450'
172.27.59.27 | FAILED => 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 475, in _execute_module
    tmp = self._make_tmp_path(conn)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 1267, in _make_tmp_path
    result = self._low_level_exec_command(conn, cmd, None, sudoable=False)
  File "/usr/lib/python2.7/site-packages/ansible/runner/__init__.py", line 1173, in _low_level_exec_command
    in_data=in_data)
  File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 291, in exec_command
    not_in_host_file = self.not_in_host_file(self.host)
  File "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py", line 236, in not_in_host_file
    if tokens[0].find(self.HASHED_KEY_MAGIC) == 0:
IndexError: list index out of range


Giovanni Tirloni

unread,
Feb 12, 2015, 8:24:09 PM2/12/15
to ansible...@googlegroups.com
On Wed, 11 Feb 2015 22:18 -0800, Amol Shende <shend...@gmail.com>
wrote:
> Hi Everyone, I am using ansible since 2 months. It was working fine
> uptill
> now. But, now it is giving error to every ansible command.
> For Ex. I am running ping command it is giving following error

[...]

> "/usr/lib/python2.7/site-packages/ansible/runner/connection_plugins/ssh.py",
> line 236, in not_in_host_file
> if tokens[0].find(self.HASHED_KEY_MAGIC) == 0:
> *IndexError: list index out of range*

Something is wrong with your "~/.ssh/known_hosts" file?

Giovanni

Amol Shende

unread,
Feb 13, 2015, 5:14:52 AM2/13/15
to ansible...@googlegroups.com
Hi Giovanni ,
Thanks for your valuable solution. I deleted all entries in known_hosts file and it resolved my issue.

Daniel

unread,
Feb 13, 2015, 10:19:17 AM2/13/15
to ansible...@googlegroups.com
From the "not_in_host_file" it sounds like possibly something on the ssh side. Are you able to ssh to 172.27.59.27 manually (either with a password or with the certificate that command is trying to use)?

Cheers,
Daniel

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/f96e5253-3497-451b-9167-afa7b8933ad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
Feb 13, 2015, 10:56:13 AM2/13/15
to ansible...@googlegroups.com
A stacktrace is still a bug in our opinion, this PR https://github.com/ansible/ansible/pull/10238 should skip bad data in the file.
Reply all
Reply to author
Forward
0 new messages