I’ve tried a few connections:
It seems that ansible_user is not honoured with the network_cli plugin so make sure you’re not using that still:
$ ansible cisco -m ios_command -a “commands=‘sh ip int br’” -e ‘ansible_connection=network_cli’ -e ‘ansible_network_os=ios’ -e ‘ansible_user=ansible’ -k
SSH password:
rtr1 | FAILED! => {
“changed”: false,
“msg”: “Failed to authenticate: Authentication failed.”
}
Both remote_user and -u username work for me:
$ ansible cisco -m ios_command -a “commands=‘sh ip int br’” -e ‘ansible_connection=network_cli’ -e ‘ansible_network_os=ios’ -u ansible -k
SSH password:
rtr1 | SUCCESS => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“stdout”: [
“Interface IP-Address OK? Method Status Protocol\nGigabitEthernet1 172.16.253.234 YES DHCP up up \nLoopback0 192.168.1.1 YES manual up up \nTunnel0 10.100.100.1 YES manual up up \nTunnel1 10.200.200.1 YES manual up up \nVirtualPortGroup0 192.168.35.101 YES TFTP up up”
],
“stdout_lines”: [
[
“Interface IP-Address OK? Method Status Protocol”,
"GigabitEthernet1 172.16.253.234 YES DHCP up up ",
"Loopback0 192.168.1.1 YES manual up up ",
"Tunnel0 10.100.100.1 YES manual up up ",
"Tunnel1 10.200.200.1 YES manual up up ",
“VirtualPortGroup0 192.168.35.101 YES TFTP up up”
]
]
}
$ ansible cisco -m ios_command -a “commands=‘sh ip int br’” -e ‘ansible_connection=network_cli’ -e ‘ansible_network_os=ios’ -e ‘remote_user=ansible’ -k
SSH password:
[WARNING]: Found variable using reserved name: remote_user
rtr1 | SUCCESS => {
“ansible_facts”: {
“discovered_interpreter_python”: “/usr/bin/python”
},
“changed”: false,
“stdout”: [
“Interface IP-Address OK? Method Status Protocol\nGigabitEthernet1 172.16.253.234 YES DHCP up up \nLoopback0 192.168.1.1 YES manual up up \nTunnel0 10.100.100.1 YES manual up up \nTunnel1 10.200.200.1 YES manual up up \nVirtualPortGroup0 192.168.35.101 YES TFTP up up”
],
“stdout_lines”: [
[
“Interface IP-Address OK? Method Status Protocol”,
"GigabitEthernet1 172.16.253.234 YES DHCP up up ",
"Loopback0 192.168.1.1 YES manual up up ",
"Tunnel0 10.100.100.1 YES manual up up ",
"Tunnel1 10.200.200.1 YES manual up up ",
“VirtualPortGroup0 192.168.35.101 YES TFTP up up”
]
]
}
Note that I had to remove/disable the valid SSH keys in the router, as the first auth method is publckey. Until I did this I could still connect.
I think you’re hitting this bug: https://github.com/ansible/ansible/issues/59381 which refers to https://github.com/paramiko/paramiko/issues/1390