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

401 Unauthorized when using the aoscx_vlan_interface module #122

Open
PauloHeaven opened this issue Dec 7, 2024 · 9 comments
Open

401 Unauthorized when using the aoscx_vlan_interface module #122

PauloHeaven opened this issue Dec 7, 2024 · 9 comments

Comments

@PauloHeaven
Copy link

Hello,

I'm using the GNS3 simulator image, and I run into the following error when using the L3 VLAN interface module:

(fatal: [L3SW-AOSX-01]: FAILED! => {"changed": false, "msg": "'GENERIC OPERATION ERROR: Unauthorized: Code: 401'"})

I tried with and without "state: update".

The user is the default admin user, and all other modules work. Using the config module with SSH allows me to add IP addresses to my VLAN interfaces, but I'd rather use the proper purpose-made module.

The bug is present on AOS-CX 10.13, 10.14 and 10.15. However, I tried with a 10.07 image and the module works. So it has been broken by an update in between.

I've looked into the code and I couldn't see where the URL is created to compare it with the REST API documentation.

Example playbook where only this module fails:

---
- name: VLAN setup
  hosts: L3SW-AOSX-01
  gather_facts: false
  tasks:
    - name: Creating VLAN 100
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 100
        name: Network administration
        description: Network administration
    - name: Creating VLAN 101
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 101
        name: Servers
        description: Servers
    - name: Creating VLAN 120
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 120
        name: Design office
        description: Design office
    - name: Creating VLAN 121
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 121
        name: Production
        description: Production
    - name: Creating VLAN 122
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 122
        name: HR and accounting
        description: HR and accounting
    - name: Creating VLAN 123
      arubanetworks.aoscx.aoscx_vlan:
        vlan_id: 123
        name: Marketing and sales
        description: Marketing and sales
    - name: Adding ports to VLAN 120
      arubanetworks.aoscx.aoscx_l2_interface:
        interface: 1/1/4
        vlan_mode: access
        vlan_access: 120
    - name: Setting up IP addresses for SSH access in VLAN 100
      arubanetworks.aoscx.aoscx_vlan_interface:
        vlan_id: 100
        description: Network administration
        ipv4:
          - "{{ vlan_100_v4 }}"
        ipv6:
          - "{{ vlan_100_v6 }}"
PLAY [VLAN setup] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Creating VLAN 100] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Creating VLAN 101] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Creating VLAN 120] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Creating VLAN 121] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Creating VLAN 122] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Creating VLAN 123] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Adding ports to VLAN 120] ******************************************************************************************************************************************************************************************************************************************************************************************************************************************
ok: [L3SW-AOSX-01]

TASK [Setting up IP addresses for SSH access in VLAN 100] *************************************************************************************************************************************************************************************************************************************************************************************************************
fatal: [L3SW-AOSX-01]: FAILED! => {"changed": false, "msg": "'GENERIC OPERATION ERROR: Unauthorized: Code: 401'"}

PLAY RECAP ************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
L3SW-AOSX-01               : ok=7    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
@alagoutte
Copy link
Contributor

Hi,

Last release of this module and pyaoscx ?

What do you have on vlan_100_v4 and vlan_100_v6 value ? (for try to reproduct)

(do you have try without ipv4 or ipv6 ?)

@PauloHeaven
Copy link
Author

PauloHeaven commented Dec 8, 2024

The collection is in version 4.4.0 and pyaoscx 2.6.0, which I believe are the latest. I've followed the guide on the Aruba website on getting started with Ansible and installed everything on an Ubuntu 24.10 machine connected to interface 1/1/2.

The REST API is enabled in the default VRF and I access it from VLAN 1.

I've tried:

  • Connecting to the switch with IPv4
  • Only setting one address at a time in the playbook (IPv4 or IPv6)
  • Directly using the content of the variables
  • Creating a distinct account with administrator privileges and using it

The variables are defined in my inventory as such:

  • vlan_100_v6 : 2001:db8:0:100::x/64
  • vlan_100_v4 : 10.200.0.x/24

X being an incremental value according to the switch's hostname (I've got 5 of them).

Like I said, the variables and this account work perfectly fine using the aoscx_config module, and using the interface vlan and ip address commands.

The credentials are defined in my inventory (as admin/test) and allow me to log into the web interface, where it confirms they are administrator credentials (of course, this is the factory default account), and I can assign IP addresses to VLAN interfaces there.

@alagoutte
Copy link
Contributor

You are using VM ?

Can you post the log output with verbose ?

@PauloHeaven
Copy link
Author

Yes, this is a VM.

Here is the debug output:

(ansible) user-ansible@node-manager:~/ansible$ ansible-playbook vlan-setup.yml -vvv
ansible-playbook [core 2.18.1]
  config file = /home/user-ansible/ansible/ansible.cfg
  configured module search path = ['/home/user-ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user-ansible/ansible/lib/python3.12/site-packages/ansible
  ansible collection location = /home/user-ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user-ansible/ansible/bin/ansible-playbook
  python version = 3.12.7 (main, Nov  6 2024, 18:29:01) [GCC 14.2.0] (/home/user-ansible/ansible/bin/python3)
  jinja version = 3.1.4
  libyaml = True
Using /home/user-ansible/ansible/ansible.cfg as config file
host_list declined parsing /home/user-ansible/ansible/hosts.yml as it did not pass its verify_file() method
script declined parsing /home/user-ansible/ansible/hosts.yml as it did not pass its verify_file() method
Parsed /home/user-ansible/ansible/hosts.yml inventory source with yaml 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: vlan-setup.yml **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
1 plays in vlan-setup.yml

PLAY [VLAN setup] *****************************************************************************************************************************************************************************************************************************************************************************************************************************************************
TASK [Creating VLAN 100] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:6
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472 `" && echo ansible-tmp-1733660168.3379366-3468-212136881489472="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmp8htsrd0f TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660168.3379366-3468-212136881489472/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "Network administration",
            "ip_igmp_snooping": null,
            "name": "Network administration",
            "state": "create",
            "vlan_id": 100,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Creating VLAN 101] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:11
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220 `" && echo ansible-tmp-1733660190.2543657-3495-40230273995220="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmp0t38qz7k TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660190.2543657-3495-40230273995220/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "Servers",
            "ip_igmp_snooping": null,
            "name": "Servers",
            "state": "create",
            "vlan_id": 101,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Creating VLAN 120] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:16
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654 `" && echo ansible-tmp-1733660205.6719024-3519-225042468127654="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmpyiarn5dq TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660205.6719024-3519-225042468127654/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "Design office",
            "ip_igmp_snooping": null,
            "name": "Design office",
            "state": "create",
            "vlan_id": 120,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Creating VLAN 121] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:21
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180 `" && echo ansible-tmp-1733660219.614164-3544-147954070805180="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmpjml8ezsy TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660219.614164-3544-147954070805180/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "Production",
            "ip_igmp_snooping": null,
            "name": "Production",
            "state": "create",
            "vlan_id": 121,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Creating VLAN 122] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:26
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204 `" && echo ansible-tmp-1733660233.5751412-3571-139365008704204="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmpgm8gqp85 TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660233.5751412-3571-139365008704204/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "HR and accounting",
            "ip_igmp_snooping": null,
            "name": "HR and accounting",
            "state": "create",
            "vlan_id": 122,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Creating VLAN 123] **********************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:31
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618 `" && echo ansible-tmp-1733660247.9809592-3595-54380606954618="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmpqh5a3upw TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618/AnsiballZ_aoscx_vlan.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618/AnsiballZ_aoscx_vlan.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660247.9809592-3595-54380606954618/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "admin_state": null,
            "description": "Marketing and sales",
            "ip_igmp_snooping": null,
            "name": "Marketing and sales",
            "state": "create",
            "vlan_id": 123,
            "voice": null,
            "vsx_sync": null
        }
    }
}

TASK [Add ports to VLAN 120] ******************************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:36
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222 `" && echo ansible-tmp-1733660261.0512707-3619-242715596422222="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_l2_interface.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmp85nui24o TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222/AnsiballZ_aoscx_l2_interface.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222/AnsiballZ_aoscx_l2_interface.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222/AnsiballZ_aoscx_l2_interface.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660261.0512707-3619-242715596422222/ > /dev/null 2>&1 && sleep 0'
changed: [L3SW-AOSX-01] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "description": null,
            "interface": "1/1/4",
            "interface_qos_rate": null,
            "interface_qos_schedule_profile": null,
            "native_vlan_id": null,
            "native_vlan_tag": null,
            "port_security_client_limit": null,
            "port_security_enable": null,
            "port_security_macs": null,
            "port_security_recovery_time": null,
            "port_security_sticky_learning": null,
            "port_security_sticky_macs": null,
            "port_security_violation_action": null,
            "state": "create",
            "trunk_allowed_all": null,
            "vlan_access": "120",
            "vlan_mode": "access",
            "vlan_trunks": null
        }
    }
}

TASK [Setting up IP addresses for SSH access in VLAN 100] *************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/user-ansible/ansible/vlan-setup.yml:41
<[2001:db8:0:1::1ab:1]> ESTABLISH LOCAL CONNECTION FOR USER: user-ansible
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d `"&& mkdir "` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025 `" && echo ansible-tmp-1733660286.6676283-3643-190710336674025="` echo /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025 `" ) && sleep 0'
Using module file /home/user-ansible/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan_interface.py
<[2001:db8:0:1::1ab:1]> PUT /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/tmpm_7llo99 TO /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025/AnsiballZ_aoscx_vlan_interface.py
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'chmod u+x /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025/ /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025/AnsiballZ_aoscx_vlan_interface.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c '/home/user-ansible/ansible/bin/python3 /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025/AnsiballZ_aoscx_vlan_interface.py && sleep 0'
<[2001:db8:0:1::1ab:1]> EXEC /bin/sh -c 'rm -f -r /home/user-ansible/.ansible/tmp/ansible-local-3463_nmut41d/ansible-tmp-1733660286.6676283-3643-190710336674025/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
  File "/tmp/ansible_arubanetworks.aoscx.aoscx_vlan_interface_payload_ol_8e7qw/ansible_arubanetworks.aoscx.aoscx_vlan_interface_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_vlan_interface.py", line 288, in main
    modified_op = vlan_interface.configure_svi(
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user-ansible/ansible/lib/python3.12/site-packages/pyaoscx/interface.py", line 1230, in configure_svi
    overlapping_ips(
  File "/home/user-ansible/ansible/lib/python3.12/site-packages/pyaoscx/utils/iptools.py", line 29, in overlapping_ips
    configuration = device.configuration()
                    ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user-ansible/ansible/lib/python3.12/site-packages/pyaoscx/pyaoscx_factory.py", line 45, in configuration
    config.get()
  File "/home/user-ansible/ansible/lib/python3.12/site-packages/pyaoscx/pyaoscx_module.py", line 40, in ensure_connected
    return fnct(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user-ansible/ansible/lib/python3.12/site-packages/pyaoscx/configuration.py", line 50, in get
    raise GenericOperationError(response.text, response.status_code)
fatal: [L3SW-AOSX-01]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_name": null,
            "acl_type": null,
            "active_gateway_ip": null,
            "active_gateway_mac_v4": null,
            "admin_state": null,
            "description": "Network administration",
            "ip_helper_address": null,
            "ipv4": [
                "10.200.0.1/24"
            ],
            "ipv6": [
                "2001:db8:0:100::1/64"
            ],
            "state": "create",
            "vlan_id": "100",
            "vrf": null
        }
    },
    "msg": "'GENERIC OPERATION ERROR: Unauthorized: Code: 401'"
}

PLAY RECAP ************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
L3SW-AOSX-01               : ok=7    changed=7    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

@alagoutte
Copy link
Contributor

i don't reproducte the issue with OVA 10.13

do you have some other configuration ?

what do you have if you enable debug log for rest ? (debug rest all)

@PauloHeaven
Copy link
Author

I tried debug rest all, it doesn't output anything. I'm not sure the debug feature has been implemented in the OVA.

Here are my inventory and ansible.cfg:

manager:
  hosts:
    localhost:
single_switch:
  hosts:
    L3SW-AOSX-01:
      ansible_host: '[2001:db8:0:1::1ab:1]'
      vlan_1_ipv6: '2001:db8:0:1::1ab:1'
      vlan_100_v6: '2001:db8:0:100::1/64'
      vlan_100_v4: '10.200.0.1/24'

switches:
  hosts:
    L3SW-AOSX-01:
      ansible_host: '[2001:db8:0:1::1ab:1]'
      vlan_1_ipv6: '2001:db8:0:1::1ab:1'
      vlan_100_v6: '2001:db8:0:100::1/64'
      vlan_100_v4: '10.200.0.1/24'
    L3SW-AOSX-02:
      ansible_host: '[2001:db8:0:1::1ab:2]'
      vlan_100_v6: '2001:db8:0:100::2/64'
      vlan_100_v4: '10.200.0.2/24'
    L3SW-AOSX-03:
      ansible_host: '[2001:db8:0:1::1ab:3]'
      vlan_100_v6: '2001:db8:0:100::3/64'
      vlan_100_v4: '10.200.0.3/24'
  vars:
    ansible_user: admin
    ansible_password: test
    ansible_network_os: arubanetworks.aoscx.aoscx
    ansible_connection: arubanetworks.aoscx.aoscx
    ansible_aoscx_validate_certs: False
    ansible_aoscx_use_proxy: False
    ansible_acx_no_proxy: True
[defaults]
inventory = hosts.yml
interpreter_python = auto_silent

@alagoutte
Copy link
Contributor

if you are using ipv4 for ansible_host ? (may be a bug with IPv6...)

@alagoutte
Copy link
Contributor

for debug rest all, you need to display log after (show log...)

@PauloHeaven
Copy link
Author

OK, I've got it to display live with terminal-monitor. It does nothing, then actually closes the session before the IP address is assigned, and the 401 error shows up on the Linux host in the following second.

2024-12-11T21:57:01.641845+0000 hpe-restd[2658] <INFO> Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user admin in session c0IjAi7mtYmvZu35hz48rA==
2024-12-11T21:57:01.676744+0000 hpe-restd[2658] <INFO> Event|4655|LOG_INFO|AMM|-|User admin logged in from 2001:db8:0:1::1ab:1000 through REST session
2024-12-11T21:57:08.860659+0000 hpe-restd[2658] <INFO> Event|4607|LOG_INFO|AMM|-|Authorization succeeded for user admin, for resource RoleDefault, with action POST
2024-12-11T21:57:20.248918+0000 ops-switchd[1284] <INFO> Event|2101|LOG_INFO|AMM|1/1|VLAN 100 created in hardware
2024-12-11T21:57:21.314943+0000 hpe-restd[2658] <INFO> Event|4617|LOG_INFO|AMM|-|admin created
2024-12-11T21:57:31.842926+0000 hpe-restd[2658] <INFO> Event|4608|LOG_INFO|AMM|-|Authorization allowed for user admin, for resource SessionMgmt, with action POST
2024-12-11T21:57:31.929691+0000 hpe-restd[2658] <INFO> Event|4657|LOG_INFO|AMM|-|User admin logged out of REST session from 2001:db8:0:1::1ab:1000

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