Developer

 View Only
last person joined: 7 days ago 

Expand all | Collapse all

Ansible aoscx_vlan_interface ip_helper_address

This thread has been viewed 36 times
  • 1.  Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 07, 2021 12:11 PM
    Hi.
    I´m build a core network with Aruba 8325 and i want to use Ansible to automate almost all configuration.
    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 <module>\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 <module>\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
    }

    I running version 10.04.1000

    I can´t find any information about this, is there any solution for this?


  • 2.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 07, 2021 04:05 PM
    Hi hg38 ! It looks like the error you're receiving ​"local variable 'port_fields' referenced before assignment" may be caused by your playbook, is there any way you can share your playbook?

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 3.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 08, 2021 04:28 AM
    Hi!

    Thanks for your response!
    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 <module>\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 <module>\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']

    ------------------------------
    Henric Gulle
    ------------------------------



  • 4.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 08, 2021 02:43 PM
    Can you try removing the parameter state? Does the behavior remain the same?

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 5.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 11, 2021 02:38 PM
    Hi.

    I get the same result then.
    I have tried on a physical 8325 and on a virtual ArubaOS-CX 10.04

    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 <module>
    _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 <module>
    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 <module>\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 <module>\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
    }

    ------------------------------
    Henric Gulle
    ------------------------------



  • 6.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 14, 2021 12:02 PM
    Okay this looks like it might be a bug in the Ansible module - would you mind opening an issue on either the CX Collection or Role including the info you provided in this thread? Whichever you're using? It'll help me track the issue better while I debug and look into it! Thank you!

    https://github.com/aruba/aoscx-ansible-collection

    https://github.com/aruba/aoscx-ansible-role

    ------------------------------
    Tiffany Chiapuzio-Wong
    ------------------------------



  • 7.  RE: Ansible aoscx_vlan_interface ip_helper_address

    Posted Jan 20, 2021 05:59 AM
    Hi.

    I have written a issue under aruba/aoscx-ansilbe-role

    Thanks!

    ------------------------------
    Henric Gulle
    ------------------------------