vlan fact gathering returns error
sean-m-sullivan opened this issue · 1 comments
SUMMARY
when running the following playbook an error occurs
---
- name: Network Services Implementation
hosts: all
gather_facts: false
tasks:
- name: Gather Cisco Network Facts
cisco.ios.ios_facts:
gather_network_resources:
- vlans
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.ios.ios_facts:
ANSIBLE VERSION
2.15.6
COLLECTION VERSION
ansible.netcommon 6.0.0
ansible.network 3.0.0
ansible.posix 1.5.4
ansible.utils 3.0.0
arista.eos 7.0.0
cisco.asa 5.0.0
cisco.ios 6.0.0
cisco.iosxr 7.0.0
cisco.nxos 6.0.0
community.general 8.1.0
CONFIGURATION
INTERPRETER_PYTHON(/etc/ansible/ansible.cfg) = auto
OS / ENVIRONMENT
"ansible_facts": {
"ansible_net_api": "cliconf",
"ansible_net_gather_network_resources": [],
"ansible_net_gather_subset": [
"default"
],
"ansible_net_image": "bootflash:cat4500e-entservicesk9-mz.152-4.E2.bin",
"ansible_net_iostype": "IOS",
"ansible_net_model": "WS-C4948E",
"ansible_net_operatingmode": "autonomous",
"ansible_net_python_version": "3.9.18",
"ansible_net_system": "ios",
"ansible_net_version": "15.2(4)E2",
"ansible_network_resources": {}
STEPS TO REPRODUCE
---
- name: Network Services Implementation
hosts: all
gather_facts: false
tasks:
- name: Gather Cisco Network Facts
cisco.ios.ios_facts:
gather_network_resources:
- vlans
EXPECTED RESULTS
it to returned gathered facts.
ACTUAL RESULTS
It errors expecting a configuration paraemter
The full traceback is:
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 128, in get_network_resources_facts
inst.populate_facts(self._connection, self.ansible_facts, data)
File "/usr/share/ansible/collections/ansible_collections/cisco/ios/plugins/module_utils/network/ios/facts/vlans/vlans.py", line 68, in populate_facts
configuration = self._module.params["configuration"]
fatal: [1234]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"available_network_resources": false,
"gather_network_resources": [
"vlans"
],
"gather_subset": [
"min"
]
}
},
"msg": "'configuration'"
}
Thoughts
It was found that adding configuration: false, to the module options for the facts module, fixed this issue, but I do not believe this is the correct answer for fixing the code.
this is the root of the error
configuration is never set as a param in that module.
adding note, that I added it as a module option in the following, to fix it.
in the docs
https://github.com/ansible-collections/cisco.ios/blob/main/plugins/modules/ios_facts.py#L54
and a true bool here
though this seems like a bad idea in terms of an additional module option. Think the logic around where its failing should likely change.