Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible aoscx_vlan_interface ip_helper_address #13

Open
henricGulle opened this issue Jan 20, 2021 · 1 comment
Open

Ansible aoscx_vlan_interface ip_helper_address #13

henricGulle opened this issue Jan 20, 2021 · 1 comment

Comments

@henricGulle
Copy link

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:


  • hosts: osd
    connection: local
    vars:

gather_facts: True
roles:

  • role: arubanetworks.aoscx_role
    tasks:

  • name: Copy Running Config to local server as JSON
    aoscx_backup_config:
    config_name: 'running-config'
    output_file: '/home/"username"/Ansible_Projects/backups/{{ inventory_hostname }}running-config{{ansible_date_time.date}}.json'

  • name: Create VLAN:s with description and name
    aoscx_vlan:
    vlan_id: "{{ item.key }}"
    name: "{{ item.value.name }}"
    description: "{{ item.value.desc }}"
    with_dict: "{{ vlan }}"

  • name: Create VRF:s
    aoscx_vrf:
    name: "{{ item.value }}"
    with_dict: "{{ vrf }}"

  • name: Create Vlan Interfaces
    aoscx_vlan_interface:
    vlan_id: "{{ item.key }}"
    description: "{{ item.value.desc }}"
    ipv4: "{{ item.value.ipv4_pri }}"
    vrf: "{{ item.value.vrf }}"
    ip_helper_address: "{{ item.value.ip_help }}"
    state: create
    when: inventory_hostname == "Core1"
    with_dict: "{{ vlan_interface }}"

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants