aruba / aoscx-ansible-role

Ansible roles for AOS-CX switches
22 stars 9 forks source link

Ansible aoscx_vlan_interface ip_helper_address #13

Open henricGulle opened 3 years ago

henricGulle commented 3 years ago

I have stept on a problem with role: aoscx_vlan_interface, i can create ip_helper_address when i create a new interface but if I run the playbook again with no changes i get an error:

"module_stderr": "Traceback (most recent call last):\n File \"/home/"username"/.ansible/tmp/ansible-local-10100662syh8zv/ansible-tmp-1610035043.3729682-101629-68525387063625/AnsiballZ_aoscx_vlan_interface.py\", line 102, in \n _ansiballz_main()\n File \"/home/"username"/.ansible/tmp/ansible-local-10100662syh8zv/ansible-tmp-1610035043.3729682-101629-68525387063625/AnsiballZ_aoscx_vlan_interface.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/"username"/.ansible/tmp/ansible-local-10100662syh8zv/ansible-tmp-1610035043.3729682-101629-68525387063625/AnsiballZ_aoscx_vlan_interface.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_vlan_interface', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_aoscx_vlan_interface_payload_O7kWjR/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 253, in \n File \"/tmp/ansible_aoscx_vlan_interface_payload_O7kWjR/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 206, in main\nUnboundLocalError: local variable 'port_fields' referenced before assignment\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

If i change state from update to create i get the following error insted on all vlan interfaces:

failed: [Core1] (item={'key': 407, 'value': {'desc': 'SVI_HR_zone1', 'ipv4_pri': ['10.24.7.2/24'], 'ipv4_sec': ['10.24.7.3/24'], 'vrf': 'VRF_HR', 'ip_help': ['10.40.20.2']}}) => { "ansible_loop_var": "item", "changed": false, "item": { "key": 407, "value": { "desc": "SVI_HR_zone1", "ip_help": [ "10.40.20.2" ], "ipv4_pri": [ "10.24.7.2/24" ], "ipv4_sec": [ "10.24.7.3/24" ], "vrf": "VRF_HR" } }, "module_stderr": "Traceback (most recent call last):\n File \"/home/"username"/.ansible/tmp/ansible-local-110274mzf7vkyp/ansible-tmp-1610097350.5019186-110883-53410359579104/AnsiballZ_aoscx_vlan_interface.py\", line 102, in \n _ansiballz_main()\n File \"/home/"username"/.ansible/tmp/ansible-local-110274mzf7vkyp/ansible-tmp-1610097350.5019186-110883-53410359579104/AnsiballZ_aoscx_vlan_interface.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/"username"/.ansible/tmp/ansible-local-110274mzf7vkyp/ansible-tmp-1610097350.5019186-110883-53410359579104/AnsiballZ_aoscx_vlan_interface.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_vlan_interface', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_aoscx_vlan_interface_payload_m5HKXG/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 253, in \n File \"/tmp/ansible_aoscx_vlan_interface_payload_m5HKXG/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 226, in main\n File \"/tmp/ansible_aoscx_vlan_interface_payload_m5HKXG/ansible_aoscx_vlan_interface_payload.zip/ansible/module_utils/aoscx_interface.py\", line 576, in update_interface_ip_helper_address\nAttributeError: 'unicode' object has no attribute 'append'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

Part of the playbook:


gather_facts: True roles:

groups vars file OSD:


vlan: 401: name: IT-SUPPORT desc: IT-SUPPORT 403: name: IT-DEP desc: IT-DEP 405: name: HR desc: HR 407: name: ECONOMY desc: ECONOMY

vlan_interface: 401: desc: SVI_IT-SUPPORT_zone1 ipv4_pri: ['10.24.1.2/24'] ipv4_sec: ['10.24.1.3/24'] vrf: VRF_IT-SUPPORT ip_help: ['10.40.20.2']

403: desc: SVI_IT-DEP_zone1 ipv4_pri: ['10.24.3.2/24'] ipv4_sec: ['10.24.3.3/24'] vrf: VRF_IT-DEP ip_help: ['10.40.20.2']

405: desc: SVI_IT-HR_zone1 ipv4_pri: ['10.24.5.2/24'] ipv4_sec: ['10.24.5.3/24'] vrf: VRF_HR ip_help: ['10.40.20.2']

407: desc: SVI_HR_zone1 ipv4_pri: ['10.24.7.2/24'] ipv4_sec: ['10.24.7.3/24'] vrf: VRF_HR ip_help: ['10.40.20.2']

If i remove the state parameter:

The full traceback is: Traceback (most recent call last): File "/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py", line 102, in _ansiballz_main() File "/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.aoscx_vlan_interface', init_globals=None, run_name='main', alter_sys=True) File "/usr/lib/python2.7/runpy.py", line 188, in run_module fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code mod_name, mod_fname, mod_loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py", line 253, in File "/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py", line 226, in main File "/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/module_utils/aoscx_interface.py", line 576, in update_interface_ip_helper_address AttributeError: 'unicode' object has no attribute 'append' failed: [Core1] (item={'key': 407, 'value': {'desc': 'SVI_HR_zone1', 'ipv4_pri': ['10.24.7.2/24'], 'ipv4_sec': ['10.24.7.3/24'], 'vrf': 'VRF_HR', 'ip_help': ['10.40.20.2']}}) => { "ansible_loop_var": "item", "changed": false, "item": { "key": 407, "value": { "desc": "SVI_HR_zone1", "ip_help": [ "10.40.20.2" ], "ipv4_pri": [ "10.24.7.2/24" ], "ipv4_sec": [ "10.24.7.3/24" ], "vrf": "VRF_HR" } }, "module_stderr": "Traceback (most recent call last):\n File \"/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py\", line 102, in \n _ansiballz_main()\n File \"/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/"user"/.ansible/tmp/ansible-local-53576etey54v/ansible-tmp-1610393684.556997-5570-149373320562223/AnsiballZ_aoscx_vlan_interface.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_vlan_interface', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n fname, loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n exec code in run_globals\n File \"/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 253, in \n File \"/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/modules/aoscx_vlan_interface.py\", line 226, in main\n File \"/tmp/ansible_aoscx_vlan_interface_payload_SyQZc4/ansible_aoscx_vlan_interface_payload.zip/ansible/module_utils/aoscx_interface.py\", line 576, in update_interface_ip_helper_address\nAttributeError: 'unicode' object has no attribute 'append'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

Has it someting to do with that IP helper needs a vrf to points to?

From manual config: ip helper-address 10.40.20.2 vrf default

tchiapuziowong commented 3 years ago

Thank you for this! Our development team is looking into this and will update once fixed!