I am getting authentication errors, I can ping and ssh from my vm but ansible won’t run, I did put on a github repo so not sure if that has anything to do with it wondering if anyone has any iedas. let me know if you need any other files
my inventory file
[devices]
R1 ansible_host=10.46.194.253 ansible_network_os=ios ansible_connection=network_cli
R2 ansible_host=10.46.194.249 ansible_network_os=ios ansible_connection=network_cli
R3 ansible_host=10.46.194.242 ansible_network_os=ios ansible_connection=network_cli
R4 ansible_host=10.46.194.230 ansible_network_os=ios ansible_connection=network_cli
MLS1 ansible_host=10.46.194.254 ansible_network_os=ios ansible_connection=network_cli
MLS2 ansible_host=10.46.198.254 ansible_network_os=ios ansible_connection=network_cli
I have other playbooks but they all don’t work, here is my get hostname playbook
---
- name: Get hostname from hosts
hosts: devices
gather_facts: no
vars:
ansible_user: admin
ansible_password: *********
ansible_become: yes
ansible_become_password: ********
tasks:
- name: Gather facts from Cisco switch
cisco.ios.ios_facts:
become: yes
- name: Display hostname
debug:
var: ansible_net_hostname
[defaults]
inventory = ./hosts
host_key_checking = False
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
The full traceback is:
File “/home/cvandong/.ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py”, line 218, in get_capabilities
capabilities = Connection(module._socket_path).get_capabilities()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/ansible/module_utils/connection.py”, line 200, in rpc
raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)
fatal: [R3]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“available_network_resources”: false,
“gather_network_resources”: null,
“gather_subset”: [
“min”
]
}
},
“msg”: “Failed to authenticate: Authentication failed.”
}
redirecting (type: terminal) ansible.builtin.ios to cisco.ios.ios
redirecting (type: cliconf) ansible.builtin.ios to cisco.ios.ios
The full traceback is:
File “/home/cvandong/.ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py”, line 218, in get_capabilities
capabilities = Connection(module._socket_path).get_capabilities()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/ansible/module_utils/connection.py”, line 200, in rpc
raise ConnectionError(to_text(msg, errors=‘surrogate_then_replace’), code=code)
fatal: [MLS1]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“available_network_resources”: false,
“gather_network_resources”: null,
“gather_subset”: [
“min”
]
}
},
“msg”: “Failed to authenticate: Authentication failed.”
}