"Could not find imported module support code" when using ansible.netcommon v5.0.0
ChristopherJHart opened this issue · 2 comments
SUMMARY
When ansible.netcommon v5.0.0 is installed, the following fatal error is reported when running cisco.nxos.nxos_facts
:
fatal: [switch]: FAILED! => {"msg": "Could not find imported module support code for ansible_collections.cisco.nxos.plugins.modules.nxos_facts. Looked for (['ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template.NetworkTemplate', 'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template'])"}
This is likely due to import-related breaking changes introduced in v5.0.0 of ansible.netcommon.
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.nxos.nxos_facts
ANSIBLE VERSION
ansible [core 2.12.4]
config file = /home/chart2/Ansible/ansible.cfg
configured module search path = ['/home/chart2/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/chart2/Ansible/venv/lib/python3.8/site-packages/ansible
ansible collection location = /home/chart2/Ansible/collections
executable location = /home/chart2/Ansible/venv/bin/ansible
python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
jinja version = 3.1.1
libyaml = True
COLLECTION VERSION
# /home/chart2/Ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.netcommon 5.0.0
cisco.nxos 4.0.1
CONFIGURATION
COLLECTIONS_PATHS(/home/chart2/Ansible/ansible.cfg) = ['/home/chart2/Ansible/collection>
DEFAULT_FORKS(/home/chart2/Ansible/ansible.cfg) = 100
DEFAULT_HOST_LIST(/home/chart2/Ansible/ansible.cfg) = ['/home/chart2/Ansible/inventory.yaml>
DEFAULT_ROLES_PATH(/home/chart2/Ansible/ansible.cfg) = ['/home/chart2/.ansible/roles', '/usr/share/ansible/roles>
HOST_KEY_CHECKING(/home/chart2/Ansible/ansible.cfg) = False
OS / ENVIRONMENT
Ansible control node is on Ubuntu 22.04, target devices are running NX-OS 7.3(12)N1(1) (but shouldn't be relevant).
STEPS TO REPRODUCE
Simply try to run cisco.nxos.nxos_facts (or theoretically any module in this collection) against a device when ansible.netcommon v5.0.0 is installed.
EXPECTED RESULTS
No error messages are anticipated when this module is executed.
ACTUAL RESULTS
fatal: [switch]: FAILED! => {"msg": "Could not find imported module support code for ansible_collections.cisco.nxos.plugins.modules.nxos_facts. Looked for (['ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template.NetworkTemplate', 'ansible_collections.ansible.netcommon.plugins.module_utils.network.common.network_template'])"}
@ChristopherJHart This should have been fixed with v4.1.0 that was released 2 weeks ago. I see that you're using v4.0.1, can you please try to upgrade and let us know if it works? Thank you.
Ah, apologies - I thought I was running 4.1.0, but got my wires crossed. Troubleshooting issues late at night when you're fatigued is a bad combination :D Upgrading to 4.1.0 fixed this issue. Thank you!