cisco.nxos
cisco.nxos copied to clipboard
nxos_vlans: invalid syntax (<unknown>, line 1)
SUMMARY
I am using nxos_vlans module for vlans deployment. However, the task returns the error mentioned below. I tried changing the version of this library (3.0, 4.4.0,5.3.0), but without success. I also tried Python 3.10 and Python 3.9 - same behavior.
This switch works fine:
Software
BIOS: version 01.11
NXOS: version 10.2(6) [Maintenance Release]
Hardware
cisco Nexus9000 C9332D-GX2B Chassis
Intel(R) Xeon(R) CPU D-1633N @ 2.50GHz with 32811780 kB of memory.
This switch raises the described error:
Software
BIOS: version 05.40
NXOS: version 9.3(3)
Hardware
cisco Nexus9000 C93108TC-FX Chassis
Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 24570436 kB of memory.
ISSUE TYPE
- Bug Report
COMPONENT NAME
nxos_vlans
ANSIBLE VERSION
ansible [core 2.16.4]
config file = /home/user/projects/vlans/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/user/.local/lib/python3.10/site-packages/ansible
ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user/.local/bin/ansible
python version = 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
Collection Version
---------- -------
cisco.nxos 5.3.0
CONFIGURATION
None
OS / ENVIRONMENT
PC: Ubuntu 22.04 switch:
Software
BIOS: version 05.40
NXOS: version 9.3(3)
Hardware
cisco Nexus9000 C93108TC-FX Chassis
Intel(R) Xeon(R) CPU D-1526 @ 1.80GHz with 24570436 kB of memory.
STEPS TO REPRODUCE
- name: Gather Vlans from NXOS
cisco.nxos.nxos_vlans:
state: gathered
EXPECTED RESULTS
Return or push VLANS from/to the device.
ACTUAL RESULTS
The task will terminate with the error below. I have tried other states, such as merged or replaced. It always ends with the error.
The full traceback is:
File "/home/user/.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 "/home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/vlans/vlans.py", line 89, in populate_facts
data = self.normalize_table_data(structured, run_cfg_output)
File "/home/user/.ansible/collections/ansible_collections/cisco/nxos/plugins/module_utils/network/nxos/facts/vlans/vlans.py", line 153, in normalize_table_data
structured = ast.literal_eval(str(structured))
File "/usr/lib/python3.10/ast.py", line 64, in literal_eval
node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
File "/usr/lib/python3.10/ast.py", line 50, in parse
return compile(source, filename, mode, flags,
fatal: [switch]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"config": null,
"running_config": null,
"state": "gathered"
}
},
"msg": "invalid syntax (<unknown>, line 1)"
}
Hello, I'm experiencing exactly the same problem on a Cisco Nexus 5k.
@drobnymichal Can you please share the output of show running-config | section ^vlan
and show vlan | json-pretty
from the target appliance?