# cannot login to cisco switch using ansible

**URL:** <https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295>\
**Category:** Ansible Project\
**Created:** [August 8, 2018, 3:32pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295 "2018-08-08T15:32:19Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 8, 2018, 3:32pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/1 "2018-08-08T15:32:19Z")

</div>

test@TESTVM:/etc/ansible$ ansible-playbook ios\_facts.yml  
[WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.

PLAY [Collect IOS Device Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.208.0.17]: FAILED! =\> {“msg”: " [WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.\n{"socket\_path": "/home/test/.ansible/pc/12ac842f48", "exception": "Traceback (most recent call last):\n File \"/usr/bin/ansible-connection\", line 87, in start\n self.connection.\_connect()\n File \"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network\_cli.py\", line 302, in \_connect\n self.\_ssh\_shell = ssh.ssh.invoke\_shell()\nNameError: global name ‘ssh’ is not defined\n", "messages": ["local domain socket does not exist, starting it", "control socket path is /home/test/.ansible/pc/12ac842f48", ""], "error": "global name ‘ssh’ is not defined"}"}  
to retry, use: --limit @/etc/ansible/ios\_facts.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.208.0.17 : ok=0 changed=0 unreachable=0 failed=1

test@TESTVM:/etc/ansible$

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 8, 2018, 7:35pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/2 "2018-08-08T19:35:22Z")

</div>

This might solve your issue: [https://medium.com/@andrewhowdencom/the-curious-case-of-sudden-ansible-build-failures-eef1cf9ad1d0](https://medium.com/@andrewhowdencom/the-curious-case-of-sudden-ansible-build-failures-eef1cf9ad1d0)

If it doesn’t, can you also post the file permissions and content of ansible.cfg and ios\_facts.yml?

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 8, 2018, 10:23pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/3 "2018-08-08T22:23:59Z")

</div>

I cannot understand what to do from the link you sent me, I am still new in Ansible.

Here is the permission and content of ansible.cfg file

1.Permission:

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 9, 2018, 12:13am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/4 "2018-08-09T00:13:22Z")

</div>

First of all, try executing this command: “chmod 700 /etc/ansible” and run the playbook again (since you are using network\_cli as connection type, I assume you also defined ansible\_network\_os as ios)

Suggestions:

1. Don’t use the default ansible.cfg file, it’s too big to track all the changes we made
2. “[https://docs.ansible.com/ansible/latest/network/index.html](https://docs.ansible.com/ansible/latest/network/index.html)” is a good place to start if you haven’t checked already

_“I think I have a problem with ssh but i do not understand how to fix it” -_ Can you directly ssh to the device from the VM you are using?

Let me know if that works.

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 9, 2018, 12:24am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/5 "2018-08-09T00:24:21Z")

</div>

Hi Ajay,

- Tried to chmod 700, it gave me the following error

test@TESTVM:/etc$ sudo chmod 700 /etc/ansible

sudo: /etc/sudoers is world writable

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

- I think I have bigger issue than Ansible now, it is a permission issue on Ubuntu box, any suggestions?

Thanks,

Michael

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 9, 2018, 3:48am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/6 "2018-08-09T03:48:32Z")

</div>

I was able to fix the permission on Ubuntu, now back to the original error:

ansible all -i \<switch\_ip\>, -c network\_cli -u -m ios\_command\_1.yml

[WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.

10.11.32.100 | FAILED! =\> {

“msg”: " [WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.\n{"socket\_path": "/home/test/.ansible/pc/c5b7c67eba", "exception": "Traceback (most recent call last):\n File \"/usr/bin/ansible-connection\", line 87, in start\n self.connection.\_connect()\n File \"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network\_cli.py\", line 302, in \_connect\n self.\_ssh\_shell = ssh.ssh.invoke\_shell()\nNameError: global name ‘ssh’ is not defined\n", "messages": ["local domain socket does not exist, starting it", "control socket path is /home/test/.ansible/pc/c5b7c67eba", ""], "error": "global name ‘ssh’ is not defined"}"

}

Do you know any straight forward fix?

Thanks,

Michael

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 9, 2018, 2:44pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/7 "2018-08-09T14:44:23Z")

</div>

Hi Michael,

I don’t know any straight forward fix.

So, did chmod 700 on /etc/ansible work? Is the playbook still giving the same error after the file permissions were changed?

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 9, 2018, 3:01pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/8 "2018-08-09T15:01:45Z")

</div>

Hi Ajay,

I was able to build a new machine, still having same issue ansible & ssh permission issue:

netadmin@netadmin-Virtual-Machine:/etc/ansible/myplatform$ ansible --version  
ansible 2.5.7  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/home/netadmin/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]  
netadmin@netadmin-Virtual-Machine:/etc/ansible/myplatform$ ls  
ios.retry ios.yml  
netadmin@netadmin-Virtual-Machine:/etc/ansible/myplatform$ ansible --version  
ansible 2.5.7  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/home/netadmin/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible  
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]  
netadmin@netadmin-Virtual-Machine:/etc/ansible/myplatform$ ansible-playbook ios.yml

PLAY [10.11.32.100] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [10.11.32.100]: UNREACHABLE! =\> {“changed”: false, “msg”: “Failed to connect to the host via ssh: [60081064@10.11.32.100](mailto:60081064@10.11.32.100): Permission denied (publickey,keyboard-interactive,password).\r\n”, “unreachable”: true}  
[WARNING]: Could not create retry file ‘/etc/ansible/myplatform/ios.retry’. [Errno 13] Permission denied: u’/etc/ansible/myplatform/ios.retry’

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.11.32.100 : ok=0 changed=0 unreachable=1 failed=0

netadmin@netadmin-Virtual-Machine:/etc/ansible/myplatform$ cat ios.yml

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 9, 2018, 6:40pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/9 "2018-08-09T18:40:20Z")

</div>

Hi Michael,

By looking at this error : _“msg”: “Failed to connect to the host via ssh: [60081064@10.11.32.100](mailto:60081064@10.11.32.100): Permission denied (publickey,keyboard-interactive,password).\r\n”, “unreachable”: true_ it seems like your ansible VM can not SSH to the cisco switch in the first place.

Does normal SSH to the switch work? like if you do _ssh [username@10.11.32.100](mailto:username@10.11.32.100) ._ If it doesn’t work, you have to fix that first. Maybe the switch is allowing connections only from particular IP addresses.

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 9, 2018, 8:34pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/10 "2018-08-09T20:34:52Z")

</div>

Hi Ajay,

If username is 60081064, it works, if root, it does not.

Thanks,  
Michael

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 9, 2018, 11:58pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/11 "2018-08-09T23:58:24Z")

</div>

Hi Michael,

_“ansble all -m ping , it gives the same error Permission denied (publickey,keyboard-interactive,password)”_ doesn’t work because ansible ping module requires the remote node to run python. You can find more about it here: [https://docs.ansible.com/ansible/latest/modules/ping\_module.html#ping-module](https://docs.ansible.com/ansible/latest/modules/ping_module.html#ping-module)

So, it works for your username, and based on "_Failed to connect to the host via ssh: [60081064@10.11.32.100](mailto:60081064@10.11.32.100): Permission denied (publickey,keyboard-interactive,password)"_ ansible is using the correct username. Where are you defining your password? In the hosts file? If that is the case, hash the password in the hosts file and use -k option instead ( ansible-playbook ios.yml -k ) and enter the password manually just to eliminate one source of the problem.

If that doesn’t work, revert the changes and get the output of _"ansible-playbook ios.yml -vvvv "_ command. It could help us find the source of the issue.

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 10, 2018, 12:03am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/12 "2018-08-10T00:03:41Z")

</div>

Hi Ajay,

I tried with -k, it does not work:

netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -k

SSH password:

PLAY [10.11.32.100] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

[WARNING]: sftp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE\_DEBUG=1 to see detailed information

[WARNING]: scp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE\_DEBUG=1 to see detailed information

fatal: [10.11.32.100]: UNREACHABLE! =\> {“changed”: false, “msg”: “SSH Error: data could not be sent to remote host "10.11.32.100". Make sure this host can be reached over ssh”, “unreachable”: true}

[WARNING]: Could not create retry file ‘/etc/ansible/ios.retry’. [Errno 13] Permission denied: u’/etc/ansible/ios.retry’

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

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

Here is the output of -vvv

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 10, 2018, 12:04am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/13 "2018-08-10T00:04:25Z")

</div>

Hi Ajay,

I tried with -k, it does not work

netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -k

SSH password:

PLAY [10.11.32.100] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

[WARNING]: sftp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE\_DEBUG=1 to see detailed information

[WARNING]: scp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE\_DEBUG=1 to see detailed information

fatal: [10.11.32.100]: UNREACHABLE! =\> {“changed”: false, “msg”: “SSH Error: data could not be sent to remote host "10.11.32.100". Make sure this host can be reached over ssh”, “unreachable”: true}

[WARNING]: Could not create retry file ‘/etc/ansible/ios.retry’. [Errno 13] Permission denied: u’/etc/ansible/ios.retry’

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

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

Here is the output of -vvv

netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -vvv

ansible-playbook 2.5.7

config file = /etc/ansible/ansible.cfg

configured module search path = [u’/home/netadmin/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]

ansible python module location = /usr/lib/python2.7/dist-packages/ansible

executable location = /usr/bin/ansible-playbook

python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]

Using /etc/ansible/ansible.cfg as config file

Parsed /etc/ansible/hosts inventory source with ini plugin

PLAYBOOK: ios.yml \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

1 plays in ios.yml

PLAY [10.11.32.100] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

TASK [Gathering Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

task path: /etc/ansible/ios.yml:2

Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py

\<10.11.32.100\> ESTABLISH SSH CONNECTION FOR USER: 60081064

\<10.11.32.100\> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=60081064 -o ConnectTimeout=10 -o ControlPath=/home/netadmin/.ansible/cp/e0e6fa081f 10.11.32.100 ‘/bin/sh -c ‘"’“‘echo ~60081064 && sleep 0’”’"‘’

\<10.11.32.100\> (255, ‘’, ‘60081064@10.11.32.100: Permission denied (publickey,keyboard-interactive,password).\r\n’)

fatal: [10.11.32.100]: UNREACHABLE! =\> {

“changed”: false,

“msg”: “Failed to connect to the host via ssh: [60081064@10.11.32.100](mailto:60081064@10.11.32.100): Permission denied (publickey,keyboard-interactive,password).\r\n”,

“unreachable”: true

}

[WARNING]: Could not create retry file ‘/etc/ansible/ios.retry’. [Errno 13] Permission denied: u’/etc/ansible/ios.retry’

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

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

netadmin@netadmin-Virtual-Machine:/etc/ansible$

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 10, 2018, 12:22am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/14 "2018-08-10T00:22:53Z")

</div>

At this point, I am almost out of ideas. I am sorry, I couldn’t be of much help.

One last thing you might want to try is turning of “gathering facts”. Some devices have issues with that. You can do that by entering “gathering = explicit” in the ansible.cfg file.

Regards,  
Ajay

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 10, 2018, 5:20am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/15 "2018-08-10T05:20:59Z")

</div>

Thanks Ajay very much.

I managed to get some logging , but still cannot find where the issue is:

root@netadmin-Virtual-Machine:/etc/ansible# ansible-playbook ios\_command\_1.yml -vvvv  
1903 1533876596.09467: starting run  
ansible-playbook 2.5.7  
config file = /etc/ansible/ansible.cfg  
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible-playbook  
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]  
Using /etc/ansible/ansible.cfg as config file  
1903 1533876596.34001: Added group all to inventory  
1903 1533876596.34044: Added group ungrouped to inventory  
1903 1533876596.34086: Group all now contains ungrouped  
setting up inventory plugins  
1903 1533876596.34433: Loading InventoryModule ‘host\_list’ from /usr/lib/python2.7/dist-packages/ansible/plugins/inventory/host\_list.py  
1903 1533876596.34638: assigned :doc  
1903 1533876596.34679: assigned :plainexamples  
1903 1533876596.34763: Loading InventoryModule ‘script’ from /usr/lib/python2.7/dist-packages/ansible/plugins/inventory/script.py  
1903 1533876596.35214: assigned :doc  
1903 1533876596.35278: Loaded config def from plugin (inventory/script)  
1903 1533876596.35376: Loading InventoryModule ‘yaml’ from /usr/lib/python2.7/dist-packages/ansible/plugins/inventory/yaml.py  
1903 1533876596.35778: assigned :doc  
1903 1533876596.35834: assigned :plainexamples  
1903 1533876596.35906: Loaded config def from plugin (inventory/yaml)  
1903 1533876596.36043: Loading InventoryModule ‘ini’ from /usr/lib/python2.7/dist-packages/ansible/plugins/inventory/ini.py  
1903 1533876596.36778: assigned :doc  
1903 1533876596.36845: assigned :plainexamples  
1903 1533876596.36982: Loading InventoryModule ‘auto’ from /usr/lib/python2.7/dist-packages/ansible/plugins/inventory/auto.py  
1903 1533876596.37186: assigned :doc  
1903 1533876596.37248: assigned :plainexamples  
1903 1533876596.37323: Examining possible inventory source: /etc/ansible/hosts  
1903 1533876596.37387: Attempting to use plugin host\_list (/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/host\_list.py)  
1903 1533876596.37440: /etc/ansible/hosts did not meet host\_list requirements  
1903 1533876596.37488: Attempting to use plugin script (/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/script.py)  
1903 1533876596.38834: /etc/ansible/hosts was not parsable by script  
1903 1533876596.38956: Attempting to use plugin yaml (/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/yaml.py)  
1903 1533876596.39089: Loading data from /etc/ansible/hosts  
1903 1533876596.39455: /etc/ansible/hosts was not parsable by yaml  
1903 1533876596.39525: Attempting to use plugin ini (/usr/lib/python2.7/dist-packages/ansible/plugins/inventory/ini.py)  
1903 1533876596.39988: Added group switches to inventory  
1903 1533876596.40120: set inventory\_file for 10.11.32.100  
1903 1533876596.40190: set inventory\_dir for 10.11.32.100  
1903 1533876596.40245: Added host 10.11.32.100 to inventory  
1903 1533876596.40307: Added host 10.11.32.100 to group switches  
Parsed /etc/ansible/hosts inventory source with ini plugin  
1903 1533876596.40417: Reconcile groups and hosts in inventory.  
1903 1533876596.40485: Group all now contains switches  
1903 1533876596.40814: Loading CacheModule ‘memory’ from /usr/lib/python2.7/dist-packages/ansible/plugins/cache/memory.py  
1903 1533876596.41029: assigned :doc  
1903 1533876596.43485: Loading data from /etc/ansible/ios\_command\_1.yml  
1903 1533876596.74245: Loading CallbackModule ‘default’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.py  
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.pyc  
1903 1533876596.81133: assigned :doc  
1903 1533876596.81993: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py  
1903 1533876596.82200: Loaded config def from plugin (callback/default)  
1903 1533876596.82402: Loading CallbackModule ‘actionable’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/actionable.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.82606: assigned :doc  
1903 1533876596.82684: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876596.82844: Loaded config def from plugin (callback/actionable)  
1903 1533876596.82983: Loading CallbackModule ‘context\_demo’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/context\_demo.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.83226: assigned :doc  
1903 1533876596.83367: Loading CallbackModule ‘debug’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/debug.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.83591: assigned :doc  
1903 1533876596.83677: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876596.83953: Loaded config def from plugin (callback/debug)  
1903 1533876596.84033: Loading CallbackModule ‘default’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/default.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.84737: assigned :doc  
1903 1533876596.84830: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876596.84993: Loaded config def from plugin (callback/default)  
1903 1533876596.85119: Loading CallbackModule ‘dense’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/dense.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.85846: assigned :doc  
1903 1533876596.85944: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876596.86098: Loaded config def from plugin (callback/dense)  
1903 1533876596.86257: Loading CallbackModule ‘foreman’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/foreman.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.86834: assigned :doc  
1903 1533876596.87038: Loaded config def from plugin (callback/foreman)  
1903 1533876596.87165: Loading CallbackModule ‘full\_skip’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/full\_skip.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.87347: assigned :doc  
1903 1533876596.87411: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876596.87613: Loaded config def from plugin (callback/full\_skip)  
1903 1533876596.90800: Loading CallbackModule ‘hipchat’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/hipchat.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.91576: assigned :doc  
1903 1533876596.91653: Loaded config def from plugin (callback/hipchat)  
1903 1533876596.91788: Loading CallbackModule ‘jabber’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/jabber.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.92196: assigned :doc  
1903 1533876596.92269: Loaded config def from plugin (callback/jabber)  
1903 1533876596.92365: Loading CallbackModule ‘json’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/json.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.92580: assigned :doc  
1903 1533876596.92747: Loading CallbackModule ‘junit’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/junit.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.93611: assigned :doc  
1903 1533876596.93737: Loaded config def from plugin (callback/junit)  
1903 1533876596.93852: Loading CallbackModule ‘log\_plays’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/log\_plays.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.94096: assigned :doc  
1903 1533876596.94321: Loading CallbackModule ‘logentries’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/logentries.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.95452: assigned :doc  
1903 1533876596.95525: assigned :plainexamples  
1903 1533876596.95612: Loaded config def from plugin (callback/logentries)  
1903 1533876596.95756: Loading CallbackModule ‘logstash’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/logstash.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.96249: assigned :doc  
1903 1533876596.96328: Loaded config def from plugin (callback/logstash)  
1903 1533876596.96579: Loading CallbackModule ‘mail’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/mail.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.97908: assigned :doc  
1903 1533876596.98010: Loaded config def from plugin (callback/mail)  
1903 1533876596.98116: Loading CallbackModule ‘minimal’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/minimal.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.98416: assigned :doc  
1903 1533876596.98523: Loading CallbackModule ‘null’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/null.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.98733: assigned :doc  
1903 1533876596.98890: Loading CallbackModule ‘oneline’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/oneline.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.99347: assigned :doc  
1903 1533876596.99543: Loading CallbackModule ‘osx\_say’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/osx\_say.py (found\_in\_cache=False, class\_only=True)  
1903 1533876596.99927: assigned :doc  
1903 1533876597.00057: Loading CallbackModule ‘profile\_roles’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/profile\_roles.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.00361: assigned :doc  
1903 1533876597.00482: Loading CallbackModule ‘profile\_tasks’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/profile\_tasks.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.00966: assigned :doc  
1903 1533876597.01023: assigned :plainexamples  
1903 1533876597.01100: Loaded config def from plugin (callback/profile\_tasks)  
1903 1533876597.01210: Loading CallbackModule ‘selective’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/selective.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.01918: assigned :doc  
1903 1533876597.01977: assigned :plainexamples  
1903 1533876597.02068: Loaded config def from plugin (callback/selective)  
1903 1533876597.02166: Loading CallbackModule ‘skippy’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/skippy.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.02314: assigned :doc  
1903 1533876597.02377: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.02559: Loaded config def from plugin (callback/skippy)  
1903 1533876597.02702: Loading CallbackModule ‘slack’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/slack.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.03272: assigned :doc  
1903 1533876597.03358: Loaded config def from plugin (callback/slack)  
1903 1533876597.03458: Loading CallbackModule ‘stderr’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/stderr.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.03686: assigned :doc  
1903 1533876597.03760: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.03951: Loaded config def from plugin (callback/stderr)  
1903 1533876597.04239: Loading CallbackModule ‘syslog\_json’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/syslog\_json.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.04659: assigned :doc  
1903 1533876597.04818: Loaded config def from plugin (callback/syslog\_json)  
1903 1533876597.05027: Loading CallbackModule ‘timer’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/timer.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.05265: assigned :doc  
1903 1533876597.05382: Loading CallbackModule ‘tree’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/tree.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.05585: assigned :doc  
1903 1533876597.05705: Loading CallbackModule ‘unixy’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/unixy.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.06200: assigned :doc  
1903 1533876597.06289: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.06470: Loaded config def from plugin (callback/unixy)  
1903 1533876597.06615: Loading CallbackModule ‘yaml’ from /usr/lib/python2.7/dist-packages/ansible/plugins/callback/yaml.py (found\_in\_cache=False, class\_only=True)  
1903 1533876597.06935: assigned :doc  
1903 1533876597.07020: Loading ModuleDocFragment ‘default\_callback’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/default\_callback.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.07207: Loaded config def from plugin (callback/yaml)

PLAYBOOK: ios\_command\_1.yml \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
1 plays in ios\_command\_1.yml  
1903 1533876597.07395: in VariableManager get\_vars()  
1903 1533876597.08112: Loading FilterModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/core.py  
1903 1533876597.08265: Loading FilterModule ‘ipaddr’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/ipaddr.py  
1903 1533876597.08379: Loading FilterModule ‘json\_query’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/json\_query.py  
1903 1533876597.08504: Loading FilterModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/mathstuff.py  
1903 1533876597.09315: Loading FilterModule ‘network’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/network.py  
1903 1533876597.09447: Loading FilterModule ‘urlsplit’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/urlsplit.py  
1903 1533876597.09776: Loading TestModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/core.py  
1903 1533876597.09881: Loading TestModule ‘files’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/files.py  
1903 1533876597.09999: Loading TestModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/mathstuff.py  
1903 1533876597.11120: done with get\_vars()  
1903 1533876597.11253: in VariableManager get\_vars()  
1903 1533876597.11375: Loading FilterModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/core.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11440: Loading FilterModule ‘ipaddr’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/ipaddr.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11498: Loading FilterModule ‘json\_query’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/json\_query.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11552: Loading FilterModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/mathstuff.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11607: Loading FilterModule ‘network’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/network.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11664: Loading FilterModule ‘urlsplit’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/urlsplit.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11761: Loading TestModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/core.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11825: Loading TestModule ‘files’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/files.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.11882: Loading TestModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/mathstuff.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.12114: done with get\_vars()

PLAY [Collect IOS Device Facts] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
1903 1533876597.14129: Loading StrategyModule ‘linear’ from /usr/lib/python2.7/dist-packages/ansible/plugins/strategy/linear.py  
1903 1533876597.14376: getting the remaining hosts for this loop  
1903 1533876597.14510: done getting the remaining hosts for this loop  
1903 1533876597.14581: building list of next tasks for hosts  
1903 1533876597.14633: getting the next task for host 10.11.32.100  
1903 1533876597.14694: done getting next task for host 10.11.32.100  
1903 1533876597.14751: ^ task is: TASK: meta (flush\_handlers)  
1903 1533876597.14810: ^ state is: HOST STATE: block=1, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876597.14878: done building task lists  
1903 1533876597.14931: counting tasks in each state of execution  
1903 1533876597.14991: done counting tasks in each state of execution:  
num\_setups: 0  
num\_tasks: 1  
num\_rescue: 0  
num\_always: 0  
1903 1533876597.15160: advancing hosts in ITERATING\_TASKS  
1903 1533876597.15212: starting to advance hosts  
1903 1533876597.15268: getting the next task for host 10.11.32.100  
1903 1533876597.15338: done getting next task for host 10.11.32.100  
1903 1533876597.15405: ^ task is: TASK: meta (flush\_handlers)  
1903 1533876597.15460: ^ state is: HOST STATE: block=1, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876597.15518: done advancing hosts to next task  
META: ran handlers  
1903 1533876597.15628: done queuing things up, now waiting for results queue to drain  
1903 1533876597.15673: results queue empty  
1903 1533876597.15718: checking for any\_errors\_fatal  
1903 1533876597.15767: done checking for any\_errors\_fatal  
1903 1533876597.15812: checking for max\_fail\_percentage  
1903 1533876597.15854: done checking for max\_fail\_percentage  
1903 1533876597.15893: checking to see if all hosts have failed and the running result is not ok  
1903 1533876597.15939: done checking to see if all hosts have failed  
1903 1533876597.15982: getting the remaining hosts for this loop  
1903 1533876597.16031: done getting the remaining hosts for this loop  
1903 1533876597.16083: building list of next tasks for hosts  
1903 1533876597.16128: getting the next task for host 10.11.32.100  
1903 1533876597.16181: done getting next task for host 10.11.32.100  
1903 1533876597.16229: ^ task is: TASK: run show version on remote devices  
1903 1533876597.16272: ^ state is: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876597.16319: done building task lists  
1903 1533876597.16365: counting tasks in each state of execution  
1903 1533876597.16407: done counting tasks in each state of execution:  
num\_setups: 0  
num\_tasks: 1  
num\_rescue: 0  
num\_always: 0  
1903 1533876597.16542: advancing hosts in ITERATING\_TASKS  
1903 1533876597.16592: starting to advance hosts  
1903 1533876597.16638: getting the next task for host 10.11.32.100  
1903 1533876597.16686: done getting next task for host 10.11.32.100  
1903 1533876597.16733: ^ task is: TASK: run show version on remote devices  
1903 1533876597.16779: ^ state is: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876597.16823: done advancing hosts to next task  
1903 1533876597.16887: getting variables  
1903 1533876597.16956: in VariableManager get\_vars()  
1903 1533876597.17182: Loading FilterModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/core.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17283: Loading FilterModule ‘ipaddr’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/ipaddr.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17346: Loading FilterModule ‘json\_query’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/json\_query.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17401: Loading FilterModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/mathstuff.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17450: Loading FilterModule ‘network’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/network.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17498: Loading FilterModule ‘urlsplit’ from /usr/lib/python2.7/dist-packages/ansible/plugins/filter/urlsplit.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17590: Loading TestModule ‘core’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/core.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17643: Loading TestModule ‘files’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/files.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17693: Loading TestModule ‘mathstuff’ from /usr/lib/python2.7/dist-packages/ansible/plugins/test/mathstuff.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.17923: Calling all\_inventory to load vars for 10.11.32.100  
1903 1533876597.17975: Calling groups\_inventory to load vars for 10.11.32.100  
1903 1533876597.18025: Calling all\_plugins\_inventory to load vars for 10.11.32.100  
1903 1533876597.18240: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py  
1903 1533876597.18313: Calling all\_plugins\_play to load vars for 10.11.32.100  
1903 1533876597.18388: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.18468: Calling groups\_plugins\_inventory to load vars for 10.11.32.100  
1903 1533876597.18551: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.18632: Calling groups\_plugins\_play to load vars for 10.11.32.100  
1903 1533876597.18706: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.18814: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.18907: Loading VarsModule ‘host\_group\_vars’ from /usr/lib/python2.7/dist-packages/ansible/plugins/vars/host\_group\_vars.py (found\_in\_cache=True, class\_only=False)  
1903 1533876597.19006: done with get\_vars()  
1903 1533876597.19076: done getting variables  
1903 1533876597.19125: sending task start callback, copying the task so we can template it temporarily  
1903 1533876597.19173: done copying, going to template now  
1903 1533876597.19218: done templating  
1903 1533876597.19260: here goes the callback…

TASK [run show version on remote devices] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /etc/ansible/ios\_command\_1.yml:8  
1903 1533876597.19443: sending task start callback  
1903 1533876597.19526: entering \_queue\_task() for [10.11.32.100/ios\_command](http://10.11.32.100/ios_command)  
1903 1533876597.19599: Creating lock for ios\_command  
1903 1533876597.19923: worker is 1 (out of 1 available)  
1903 1533876597.20192: exiting \_queue\_task() for [10.11.32.100/ios\_command](http://10.11.32.100/ios_command)  
1903 1533876597.20647: done queuing things up, now waiting for results queue to drain  
1903 1533876597.20698: waiting for pending results…  
1911 1533876597.21677: running TaskExecutor() for [10.11.32.100/TASK](http://10.11.32.100/TASK): run show version on remote devices  
1911 1533876597.21866: in run() - task 00155d24-6f11-11bb-3aca-000000000008  
1911 1533876597.22030: calling self.\_execute()  
1911 1533876597.22999: Loading Connection ‘network\_cli’ from /usr/lib/python2.7/dist-packages/ansible/plugins/connection/network\_cli.py  
1911 1533876597.23340: Loading ShellModule ‘sh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py  
1911 1533876597.23831: assigned :doc  
1911 1533876597.23962: Loading ModuleDocFragment ‘shell\_common’ from /usr/lib/python2.7/dist-packages/ansible/utils/module\_docs\_fragments/shell\_common.py  
1911 1533876597.24377: Loaded config def from plugin (shell/sh)  
1911 1533876597.24431: Loading ShellModule ‘sh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found\_in\_cache=True, class\_only=False)  
1911 1533876597.25023: Loading Connection ‘local’ from /usr/lib/python2.7/dist-packages/ansible/plugins/connection/local.py  
1911 1533876597.25083: Loading ShellModule ‘sh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found\_in\_cache=True, class\_only=False)  
1911 1533876597.25144: Loading ShellModule ‘sh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/shell/sh.py (found\_in\_cache=True, class\_only=False)  
1911 1533876597.25602: assigned :doc  
1911 1533876597.25855: Loading Connection ‘ssh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py (found\_in\_cache=False, class\_only=True)  
1911 1533876597.28924: assigned :doc  
1911 1533876597.29123: Loaded config def from plugin (connection/ssh)  
1911 1533876597.30727: assigned :doc  
1911 1533876597.30861: Loaded config def from plugin (connection/network\_cli)  
\<10.11.32.100\> attempting to start connection  
\<10.11.32.100\> using connection plugin network\_cli  
\<10.11.32.100\> local domain socket does not exist, starting it  
\<10.11.32.100\> control socket path is /root/.ansible/pc/2e6a38f446  
\<10.11.32.100\> 1912 1533876598.40468: Loading Connection ‘ssh’ from /usr/lib/python2.7/dist-packages/ansible/plugins/connection/ssh.py (found\_in\_cache=False, class\_only=True)  
1912 1533876598.43470: assigned :doc  
1912 1533876598.43656: Loaded config def from plugin (connection/ssh)  
The full traceback is:  
Traceback (most recent call last):  
File “/usr/bin/ansible-connection”, line 87, in start  
self.connection.\_connect()  
File “/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network\_cli.py”, line 292, in \_connect  
ssh = self.paramiko\_conn.\_connect()  
File “/usr/lib/python2.7/dist-packages/ansible/plugins/connection/paramiko\_ssh.py”, line 240, in \_connect  
self.ssh = SSH\_CONNECTION\_CACHE[cache\_key] = self.\_connect\_uncached()  
File “/usr/lib/python2.7/dist-packages/ansible/plugins/connection/paramiko\_ssh.py”, line 348, in \_connect\_uncached  
raise AnsibleConnectionFailure(msg)  
AnsibleConnectionFailure: Authentication failed.  
1911 1533876601.49185: done running TaskExecutor() for [10.11.32.100/TASK](http://10.11.32.100/TASK): run show version on remote devices [00155d24-6f11-11bb-3aca-000000000008]  
1911 1533876601.49288: sending task result for task 00155d24-6f11-11bb-3aca-000000000008  
1911 1533876601.49810: done sending task result for task 00155d24-6f11-11bb-3aca-000000000008  
1911 1533876601.50225: WORKER PROCESS EXITING  
1903 1533876601.50541: marking 10.11.32.100 as failed  
1903 1533876601.51035: marking host 10.11.32.100 failed, current state: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_TASKS, fail\_state=FAILED\_NONE, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876601.51100: ^ failed state is now: HOST STATE: block=2, task=1, rescue=0, always=0, run\_state=ITERATING\_COMPLETE, fail\_state=FAILED\_TASKS, pending\_setup=False, tasks child state? (None), rescue child state? (None), always child state? (None), did rescue? False, did start at task? False  
1903 1533876601.51166: getting the next task for host 10.11.32.100  
1903 1533876601.51220: host 10.11.32.100 is done iterating, returning  
fatal: [10.11.32.100]: FAILED! =\> {  
“msg”: “Authentication failed.”  
}  
1903 1533876601.52450: no more pending results, returning what we have  
1903 1533876601.52513: results queue empty  
1903 1533876601.52569: checking for any\_errors\_fatal  
1903 1533876601.52625: done checking for any\_errors\_fatal  
1903 1533876601.52682: checking for max\_fail\_percentage  
1903 1533876601.52735: done checking for max\_fail\_percentage  
1903 1533876601.52783: checking to see if all hosts have failed and the running result is not ok  
1903 1533876601.52855: done checking to see if all hosts have failed  
1903 1533876601.52907: getting the remaining hosts for this loop  
1903 1533876601.53017: done getting the remaining hosts for this loop  
1903 1533876601.53416: building list of next tasks for hosts  
1903 1533876601.53470: getting the next task for host 10.11.32.100  
1903 1533876601.53524: host 10.11.32.100 is done iterating, returning  
1903 1533876601.53573: done building task lists  
1903 1533876601.53626: counting tasks in each state of execution  
1903 1533876601.53678: done counting tasks in each state of execution:  
num\_setups: 0  
num\_tasks: 0  
num\_rescue: 0  
num\_always: 0  
1903 1533876601.53840: all hosts are done, so returning None’s for all hosts  
1903 1533876601.53892: done queuing things up, now waiting for results queue to drain  
1903 1533876601.53943: results queue empty  
1903 1533876601.54608: checking for any\_errors\_fatal  
1903 1533876601.54661: done checking for any\_errors\_fatal  
1903 1533876601.54712: checking for max\_fail\_percentage  
1903 1533876601.54763: done checking for max\_fail\_percentage  
1903 1533876601.54817: checking to see if all hosts have failed and the running result is not ok  
1903 1533876601.54872: done checking to see if all hosts have failed  
1903 1533876601.54928: getting the next task for host 10.11.32.100  
1903 1533876601.54987: host 10.11.32.100 is done iterating, returning  
1903 1533876601.55042: running handlers  
to retry, use: --limit @/etc/ansible/ios\_command\_1.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
10.11.32.100 : ok=0 changed=0 unreachable=0 failed=1

1903 1533876601.55926: RUNNING CLEANUP

---

<div class="post-metadata">

**Author:** ![Michael\_Ikram](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Michael\_Ikram](https://forum.ansible.com/u/Michael_Ikram)\
**Post date:** [August 15, 2018, 2:13am UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/16 "2018-08-15T02:13:03Z")

</div>

Hi Ajay,

I managed to fix my script as below:

---

<div class="post-metadata">

**Author:** ![Ajay1](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@Ajay1](https://forum.ansible.com/u/Ajay1)\
**Post date:** [August 16, 2018, 5:43pm UTC](https://forum.ansible.com/t/cannot-login-to-cisco-switch-using-ansible/28295/17 "2018-08-16T17:43:09Z")

</div>

Hi Michael,

I am glad you found a solution. I see that you are only taking the output of stdout[0] under copy task. Since your config will have the output of multiple commands you might need config.stdout[1] and config.stdout[2] as well.

You can use something like the following to capture all your output in one file,

- copy:  
content: “{{ config.stdout[0] }}”  
dest: “_your destination_”
- blockinfile: |  
dest: “_your destination_”  
content= “{{ config.stdout[1] }}”
- blockinfile: |  
dest: “_your destination_”  
content=“{{ output.stdout[2] }}”

There might be a more efficient and better solution than this, but this is what I found so far.

Regards,  
Ajay
