11-26-2023 09:11 PM - edited 11-26-2023 09:13 PM
Hi Team,
I am Trying to connect the cisco switch to ansible getting below error
[cb350]
cb350 anisble_host=10.2.200.49 ansible_connection=network_cli ansible_network_os=ios ansible_user=cisco ansible_pass=XXXXX@XXXX
qcold ansible_host=10.2.3.6 ansible_connection=network_cli ansible_network_os=ios ansible_ssh_user=cisco ansible_ssh_pass=XYYYYY*RRR
PLAY [ping cisco switch] ****************************************************************************************************************
TASK [Test reachability to 10.2.200.49 using default vrf] ****************************************************************************
fatal: [cb350]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "[Errno -2] Name or service not known"}
fatal: [qcold]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "Failed to authenticate: Authentication failed."}
PLAY RECAP ******************************************************************************************************************************
cb350 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
qcold : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Cat ping2.yml
---
- name: ping cisco switch
hosts: all
remote_user: cisco
gather_facts: false
tasks:
- name: Test reachability to 10.2.200.49 using default vrf
ios_ping:
dest: 10.2.200.49
11-29-2023 01:38 AM - edited 11-29-2023 01:39 AM
what happens if you manually ssh into the device from the same computer with user cisco and password
if this is successful, ansible may not like this password containg the "@"character
(it sends the password without "@") -> check by changing the password
11-29-2023 02:42 AM
i would focus on
"msg": "Failed to authenticate: Authentication failed."}
as asked do the authenticaiton works normally with putty SSH connection ?
what logs you see when the ansible connection intiated time on switch ?
below guide help you :
https://github.com/ansible-collections/community.ciscosmb/blob/main/README.md
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide