I'm getting the following when trying to run a playbook using the edgeos_commandmodule:
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: ssh connection failed: ssh connect failed: Failed to resolve hostname inventory_hostname (Name or service not known)
fatal: [ADM-TEST]: FAILED! => {
"changed": false,
"module_stderr": "...",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Where module_stderr
contains:
Traceback (most recent call last):
File "/home/lowkeylamb/.ansible/tmp/ansible-local-5582d70859ti/ansible-tmp-1663885370.4466758-5712-173536800348281/AnsiballZ_edgeos_command.py", line 107, in <module>
_ansiballz_main()
File "/home/lowkeylamb/.ansible/tmp/ansible-local-5582d70859ti/ansible-tmp-1663885370.4466758-5712-173536800348281/AnsiballZ_edgeos_command.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/lowkeylamb/.ansible/tmp/ansible-local-5582d70859ti/ansible-tmp-1663885370.4466758-5712-173536800348281/AnsiballZ_edgeos_command.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.community.network.plugins.modules.network.edgeos.edgeos_command', init_globals=dict(_module_fqn='ansible_collections.community.network.plugins.modules.network.edgeos.edgeos_command', _modlib_path=modlib_path),
File "/usr/lib/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible_collections/community/network/plugins/modules/network/edgeos/edgeos_command.py", line 172, in <module>
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible_collections/community/network/plugins/modules/network/edgeos/edgeos_command.py", line 143, in main
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible_collections/community/network/plugins/module_utils/network/edgeos/edgeos.py", line 78, in run_commands
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible_collections/community/network/plugins/module_utils/network/edgeos/edgeos.py", line 44, in get_connection
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible_collections/community/network/plugins/module_utils/network/edgeos/edgeos.py", line 58, in get_capabilities
File "/tmp/ansible_community.network.edgeos_command_payload_blc0ytld/ansible_community.network.edgeos_command_payload.zip/ansible/module_utils/connection.py", line 200, in __rpc__
ansible.module_utils.connection.ConnectionError: ssh connection failed: ssh connect failed: Failed to resolve hostname inventory_hostname (Name or service not known)
It's strange because I'm able to ssh into the target device just fine. I started with a simple playbook, and planned to build on it once I tested out the edgeos module
Here is the playbook:
- name: Update External ERX with latest firmware
hosts: externaledgerouters
remote_user: BudAdmin
tasks:
- name: Update ERX Firmwae
community.network.edgeos_command:
commands: show system image
In my ansible.cfg I have inventory pointing to the hosts file
Here's how I formatted my inventory in hosts file:
externaledgerouters:
hosts:
ADM-TEST:
ansible_host: (ipv4 public IP)
Defined variables at the bottom in the same hosts file:
edgerouters:
vars:
ansible_user: (user)
ansible_port: (port)
ansible_pass: (password)
ansible_connection: network_cli
ansible_network_os: edgeos
children:
externaledgerouters:
I've tried numerous things to get this to run and I've hit a wall. Any assistance is appreciated.