Authentication issue between Router and ansible "ad-hoc"

hello dears ,

1-i have issue when i need to use ios_ping , i got this message

[mohamed@localhost proj]$ ansible -m ios_ping -a “dest=”
[WARNING]: ansible-pylibssh not installed, falling back to paramiko | FAILED! => {
“changed”: false,
“msg”: “Failed to authenticate: Authentication failed: transport shut down or saw EOF”

2-i can ping this ip and ssh from ansible linux

3-this is my config file
inventory = cisco
ask_pass = false
gathering = explicit
interpreter_python = /usr/bin/python
command_timeout = 200
connect_timeout = 200
connect_retry_timeout = 100
this is the inventory
group_varr file

4-device configuration

hostname R1
vrf definition MGMT
address-family ipv4
no ip domain lookup
ip domain name
ip ssh version 2
crypto key generate rsa modulus 1024
username root password admin
interface Ethernet0/0
vrf forwarding MGMT
ip address
no shutdown

line vty 0 4
login local
transport input all
transport output all




6-groub_var “usa.yaml”

ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.ios.ios
ansible_user: root
ansible_password: admin

Hello @mo.mostafa

Does ~/.ssh/id_rsa exist?
If it exists, could you try adding the following settings to ansible.cfg?

look_for_keys = False

I also have experienced authentication errors even though the password is correct. The following blog is about my experiences. (Japanese)


One other thing I noticed is that the format of the inventory file does not appear to be correct.

To make it correct, first amend the inventory file as follows.




Then run ansible-inventory -i <inventory-file-name> --list and check that the correct ansible_user and ansible_password are assigned to host


Thanks, i will try this solution and feedback

1 Like

I had the same issue, and your post just solved my problem. I have spent more than 20 hours trying to resolve this problem, but I couldn’t. And I just saw your post and solved my problem. If you are around Sydney, I would buy a coffee. Now, I am very thankful and grateful to you.

1 Like