Cannot reach device using ansible
Hello,
I have been trying to use dev environment recently for an internal project unsuccessfully.
Looks like despite my ansible.cfg and inventory file, I’ve still got the same result with the following message :
[Errno -2] Name or service not known
From a specific device, I am using the following command :
ansible-playbook playbooks/business.yml -i inventories/dev -t telemetry -l switch-mpls-1-tco --check --diff
and getting the following output :
fatal: [switch-mpls-1-tco]: FAILED! => {"ansible_facts": {}, "changed": false, "failed_modules": {"ansible.legacy.nxos_facts": {"failed": true, "invocation": {"module_args": {"available_network_resources": false, "gather_network_resources": null, "gather_subset": ["min"]}}, "msg": "[Errno -2] Name or service not known"}}, "msg": "The following modules failed to execute: ansible.legacy.nxos_facts\n"}
However, from the same device, I succeed to connect to device using ssh
ssh switch-mpls-preprod-1-tco
switch-mpls-preprod-1-tco#
In my inventory file, I have an alias for switch-mpls-1-tco
[switches]
switch-mpls-1-tco ansible_host=switch-mpls-preprod-1-tco
and in my playbook, I activated gather_facts to check if connection failed before any other thing
- name: TELEMETRY
hosts: mpls
gather_facts: true
roles:
- role: telemetry
tags:
- telemetry
In my environment, I use following version :
- ansible [core 2.18.6]
- python 3.11 (pipenv)
and I have a ssh/config file with User and ProxyJump for my host, works fine for a classic ssh connection.
Any ideas ? How can I troubleshoot this ?
Thanks in advance,