Developer

 View Only
last person joined: 3 hours ago 

Expand all | Collapse all

Ansible aoscx_l3_interface module

This thread has been viewed 17 times
  • 1.  Ansible aoscx_l3_interface module

    Posted Nov 08, 2023 04:38 AM

    Hi,

    I'm trying to get the configuration of l3 interfaces in a VRF correct. I'm testing this using the CX simulator Virtual.10.12.1000

    My Playbook:

    ---
    - name: Testing l3 interface
      hosts: all
      gather_facts: false
      tasks:
        - name: Delete L3 interface
          arubanetworks.aoscx.aoscx_l3_interface:
            interface: "1/1/7"
            state: delete
    
        - name: Configure L3 interface not defuault VRF
          arubanetworks.aoscx.aoscx_l3_interface:
            interface: "1/1/7"
            ipv4:
              - "10.2.2.0/31"
            vrf: "KA-VSX"
            state: create
    

    Output from the run:

    (venv) arne@dev:~/code/auto-netops-ansible$ ansible-playbook -i netbox_inv.yml --extra-vars '{"filter_tenant":"reference","filter_platform":"aoscx"}' -l z13-cx3 playbooks/testing/aoscx/testing_l3_interface_static.yml -vvv
    ansible-playbook [core 2.15.4]
      config file = /home/arne/code/auto-netops-ansible/ansible.cfg
      configured module search path = ['/home/arne/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
      ansible python module location = /home/arne/code/auto-netops-ansible/venv/lib/python3.10/site-packages/ansible
      ansible collection location = /home/arne/code/auto-netops-ansible/collections
      executable location = /home/arne/code/auto-netops-ansible/venv/bin/ansible-playbook
      python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/home/arne/code/auto-netops-ansible/venv/bin/python3)
      jinja version = 3.1.2
      libyaml = True
    Using /home/arne/code/auto-netops-ansible/ansible.cfg as config file
    host_list declined parsing /home/arne/code/auto-netops-ansible/netbox_inv.yml as it did not pass its verify_file() method
    script declined parsing /home/arne/code/auto-netops-ansible/netbox_inv.yml as it did not pass its verify_file() method
    Using inventory plugin 'ansible_collections.netbox.netbox.plugins.inventory.nb_inventory' to process inventory source '/home/arne/code/auto-netops-ansible/netbox_inv.yml'
    Fetching: https://netbox.opdal.net/api/status
    Fetching: https://netbox.opdal.net/api/dcim/devices/?limit=0&tenant=reference&platform=aoscx&has_primary_ip=True&status=active&status=staged
    Fetching: https://netbox.opdal.net/api/virtualization/virtual-machines/?limit=0&tenant=reference&platform=aoscx&has_primary_ip=True&status=active&status=staged
    Fetching: https://netbox.opdal.net/api/dcim/sites/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/regions/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/site-groups/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/locations/?limit=0
    Fetching: https://netbox.opdal.net/api/tenancy/tenants/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/device-roles/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/platforms/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/device-types/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/manufacturers/?limit=0
    Fetching: https://netbox.opdal.net/api/virtualization/clusters/?limit=0
    Fetching: https://netbox.opdal.net/api/ipam/services/?limit=0
    Fetching: https://netbox.opdal.net/api/dcim/racks/?limit=0
    [WARNING]: Invalid characters were found in group names and automatically replaced, use -vvvv to see details
    Parsed /home/arne/code/auto-netops-ansible/netbox_inv.yml inventory source with auto plugin
    Skipping callback 'default', as we already have a stdout callback.
    Skipping callback 'minimal', as we already have a stdout callback.
    Skipping callback 'oneline', as we already have a stdout callback.
    
    PLAYBOOK: testing_l3_interface_static.yml *************************************************************************************************************************************************************************************************************
    1 plays in playbooks/testing/aoscx/testing_l3_interface_static.yml
    
    PLAY [Testing l3 interface] ***************************************************************************************************************************************************************************************************************************
    
    TASK [Delete L3 interface] ****************************************************************************************************************************************************************************************************************************
    task path: /home/arne/code/auto-netops-ansible/playbooks/testing/aoscx/testing_l3_interface_static.yml:7
    <10.2.0.3> ESTABLISH LOCAL CONNECTION FOR USER: arne
    <10.2.0.3> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g `"&& mkdir "` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778 `" && echo ansible-tmp-1699434338.656209-404621-51795052994778="` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778 `" ) && sleep 0'
    Using module file /home/arne/code/auto-netops-ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_l3_interface.py
    <10.2.0.3> PUT /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/tmpy37xx8en TO /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778/AnsiballZ_aoscx_l3_interface.py
    <10.2.0.3> EXEC /bin/sh -c 'chmod u+x /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778/ /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778/AnsiballZ_aoscx_l3_interface.py && sleep 0'
    <10.2.0.3> EXEC /bin/sh -c '/home/arne/code/auto-netops-ansible/venv/bin/python3 /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778/AnsiballZ_aoscx_l3_interface.py && sleep 0'
    <10.2.0.3> EXEC /bin/sh -c 'rm -f -r /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434338.656209-404621-51795052994778/ > /dev/null 2>&1 && sleep 0'
    changed: [z13-cx3] => {
        "changed": true,
        "invocation": {
            "module_args": {
                "description": null,
                "interface": "1/1/7",
                "interface_qos_rate": null,
                "interface_qos_schedule_profile": null,
                "ip_helper_address": null,
                "ipv4": null,
                "ipv6": null,
                "state": "delete",
                "vrf": null
            }
        }
    }
    
    TASK [Configure L3 interface not defuault VRF] ********************************************************************************************************************************************************************************************************
    task path: /home/arne/code/auto-netops-ansible/playbooks/testing/aoscx/testing_l3_interface_static.yml:12
    <10.2.0.3> ESTABLISH LOCAL CONNECTION FOR USER: arne
    <10.2.0.3> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g `"&& mkdir "` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104 `" && echo ansible-tmp-1699434340.8457866-404663-54111143503104="` echo /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104 `" ) && sleep 0'
    Using module file /home/arne/code/auto-netops-ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_l3_interface.py
    <10.2.0.3> PUT /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/tmp0c2c915k TO /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104/AnsiballZ_aoscx_l3_interface.py
    <10.2.0.3> EXEC /bin/sh -c 'chmod u+x /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104/ /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104/AnsiballZ_aoscx_l3_interface.py && sleep 0'
    <10.2.0.3> EXEC /bin/sh -c '/home/arne/code/auto-netops-ansible/venv/bin/python3 /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104/AnsiballZ_aoscx_l3_interface.py && sleep 0'
    <10.2.0.3> EXEC /bin/sh -c 'rm -f -r /home/arne/.ansible/tmp/ansible-local-404586kehlmq0g/ansible-tmp-1699434340.8457866-404663-54111143503104/ > /dev/null 2>&1 && sleep 0'
    changed: [z13-cx3] => {
        "changed": true,
        "invocation": {
            "module_args": {
                "description": null,
                "interface": "1/1/7",
                "interface_qos_rate": null,
                "interface_qos_schedule_profile": null,
                "ip_helper_address": null,
                "ipv4": [
                    "10.2.2.0/31"
                ],
                "ipv6": null,
                "state": "create",
                "vrf": "KA-VSX"
            }
        }
    }
    
    PLAY RECAP ********************************************************************************************************************************************************************************************************************************************
    z13-cx3                    : ok=2    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
    

    Interface config before the run:

    z13-cx3(config)# show running-config interface 1/1/7
    interface 1/1/7
        exit
    

    Interface configuration after:

    z13-cx3(config)# show running-config interface 1/1/7
    interface 1/1/7
        ip address 10.2.2.0/31
        exit
    

    And the VRF exists:

    z13-cx3(config)# show running-config  vrf
    vrf KA-VSX
    

    Verions:

    (venv) arne@dev:~/code/auto-netops-ansible$ pip freeze
    ansible==8.6.0
    ansible-compat==4.1.10
    ansible-core==2.15.6
    ansible-lint==6.22.0
    ansible-pylibssh==1.1.0
    attrs==23.1.0
    Babel==2.13.1
    bcrypt==4.0.1
    beautifulsoup4==4.12.2
    black==23.11.0
    bracex==2.4
    Brotli==1.1.0
    certifi==2023.7.22
    cffi==1.16.0
    charset-normalizer==3.3.2
    click==8.1.7
    colorama==0.4.6
    cryptography==41.0.5
    cssselect==1.2.0
    cssselect2==0.7.0
    filelock==3.13.1
    fonttools==4.44.0
    future==0.18.3
    ghp-import==2.1.0
    grpcio==1.59.2
    html5lib==1.1
    idna==3.4
    importlib-metadata==6.8.0
    Jinja2==3.1.2
    jsonschema==4.19.2
    jsonschema-specifications==2023.7.1
    jxmlease==1.0.3
    libsass==0.22.0
    lxml==4.9.3
    Markdown==3.5.1
    markdown-it-py==3.0.0
    markdown2==2.4.10
    MarkupSafe==2.1.3
    mdurl==0.1.2
    mergedeep==1.3.4
    mkdocs==1.5.3
    mkdocs-macros-plugin==1.0.5
    mkdocs-material==9.4.8
    mkdocs-material-extensions==1.3
    mkdocs-simple-plugin==3.1.0
    mkdocs-with-pdf==0.9.3
    mypy-extensions==1.0.0
    ncclient==0.6.15
    netaddr==0.9.0
    packaging==23.2
    paginate==0.5.6
    paramiko==3.3.1
    pathspec==0.11.2
    Pillow==10.1.0
    platformdirs==3.11.0
    protobuf==4.25.0
    pyaoscx==2.5.0
    pycparser==2.21
    pydyf==0.8.0
    Pygments==2.16.1
    pymdown-extensions==10.3.1
    PyNaCl==1.5.0
    pynetbox==7.2.0
    pyphen==0.14.0
    pyquery==2.0.0
    pyrsistent==0.20.0
    python-dateutil==2.8.2
    pytz==2023.3.post1
    PyYAML==6.0.1
    pyyaml_env_tag==0.1
    readtime==3.0.0
    referencing==0.30.2
    regex==2023.10.3
    requests==2.31.0
    requests-toolbelt==1.0.0
    resolvelib==1.0.1
    rich==13.6.0
    rpds-py==0.12.0
    ruamel.yaml==0.18.5
    ruamel.yaml.clib==0.2.8
    six==1.16.0
    soupsieve==2.5
    subprocess-tee==0.4.1
    termcolor==2.3.0
    textfsm==1.1.3
    tinycss2==1.2.1
    tomli==2.0.1
    ttp==0.9.5
    typing_extensions==4.8.0
    urllib3==2.0.7
    watchdog==3.0.0
    wcmatch==8.5
    weasyprint==60.1
    webencodings==0.5.1
    xmltodict==0.13.0
    yamllint==1.32.0
    zipp==3.17.0
    zopfli==0.2.3
    

    (venv) arne@dev:~/code/auto-netops-ansible$ pip freeze
    ansible==8.6.0
    ansible-compat==4.1.10
    ansible-core==2.15.6
    ansible-lint==6.22.0
    ansible-pylibssh==1.1.0
    attrs==23.1.0
    Babel==2.13.1
    bcrypt==4.0.1
    beautifulsoup4==4.12.2
    black==23.11.0
    bracex==2.4
    Brotli==1.1.0
    certifi==2023.7.22
    cffi==1.16.0
    charset-normalizer==3.3.2
    click==8.1.7
    colorama==0.4.6
    cryptography==41.0.5
    cssselect==1.2.0
    cssselect2==0.7.0
    filelock==3.13.1
    fonttools==4.44.0
    future==0.18.3
    ghp-import==2.1.0
    grpcio==1.59.2
    html5lib==1.1
    idna==3.4
    importlib-metadata==6.8.0
    Jinja2==3.1.2
    jsonschema==4.19.2
    jsonschema-specifications==2023.7.1
    jxmlease==1.0.3
    libsass==0.22.0
    lxml==4.9.3
    Markdown==3.5.1
    markdown-it-py==3.0.0
    markdown2==2.4.10
    MarkupSafe==2.1.3
    mdurl==0.1.2
    mergedeep==1.3.4
    mkdocs==1.5.3
    mkdocs-macros-plugin==1.0.5
    mkdocs-material==9.4.8
    mkdocs-material-extensions==1.3
    mkdocs-simple-plugin==3.1.0
    mkdocs-with-pdf==0.9.3
    mypy-extensions==1.0.0
    ncclient==0.6.15
    netaddr==0.9.0
    packaging==23.2
    paginate==0.5.6
    paramiko==3.3.1
    pathspec==0.11.2
    Pillow==10.1.0
    platformdirs==3.11.0
    protobuf==4.25.0
    pyaoscx==2.5.0
    pycparser==2.21
    pydyf==0.8.0
    Pygments==2.16.1
    pymdown-extensions==10.3.1
    PyNaCl==1.5.0
    pynetbox==7.2.0
    pyphen==0.14.0
    pyquery==2.0.0
    pyrsistent==0.20.0
    python-dateutil==2.8.2
    pytz==2023.3.post1
    PyYAML==6.0.1
    pyyaml_env_tag==0.1
    readtime==3.0.0
    referencing==0.30.2
    regex==2023.10.3
    requests==2.31.0
    requests-toolbelt==1.0.0
    resolvelib==1.0.1
    rich==13.6.0
    rpds-py==0.12.0
    ruamel.yaml==0.18.5
    ruamel.yaml.clib==0.2.8
    six==1.16.0
    soupsieve==2.5
    subprocess-tee==0.4.1
    termcolor==2.3.0
    textfsm==1.1.3
    tinycss2==1.2.1
    tomli==2.0.1
    ttp==0.9.5
    typing_extensions==4.8.0
    urllib3==2.0.7
    watchdog==3.0.0
    wcmatch==8.5
    weasyprint==60.1
    webencodings==0.5.1
    xmltodict==0.13.0
    yamllint==1.32.0
    zipp==3.17.0
    zopfli==0.2.3
    


    ------------------------------
    Arne Opdal
    ------------------------------


  • 2.  RE: Ansible aoscx_l3_interface module

    MVP GURU
    Posted Nov 10, 2023 05:39 AM

    Hi Arne,

    I try and get the same issue with l3 (physical) interface...  but work with l3 (vlan) interface !

    May be need to create an issue on aoscx-ansible-collection Github => https://github.com/aruba/aoscx-ansible-collection/



    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: Ansible aoscx_l3_interface module

    Posted Nov 16, 2023 05:02 PM

    Hi @ArneO  - yes as @alagoutte mentioned please create an issue on our Github for better tracking - also can you confirm if this is seen on a physical AOS-CX switch or only using the Switch Simulator?



    ------------------------------
    Ti Chiapuzio-Wong (they/them)
    HPE Aruba Networking
    ------------------------------



  • 4.  RE: Ansible aoscx_l3_interface module

    Posted Nov 18, 2023 12:21 PM

    I'm testing on the simulator.

    I upgraded to 4.3.1 and it works :-) Will try to create a testenvironment using physical to tst it also.



    ------------------------------
    Arne Opdal
    ------------------------------