Developer Community

Reply
Occasional Contributor I

Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

Hi!

Cannot get this to work, help much appreciated. 

Switches I am testing it with are HP J9772A 2530-48G-PoEP. Software revision YA.16.06.0006.

Using following simple playbook. Second task works, but first doesn`t.

 

ilia@psg-ans01:~/ANS$ cat pb_test.yml

---

- hosts: all

  tasks:

    - name: Create VLAN 300

      arubaoss_vlan:

        command: config_vlan

        vlan_id: 300

        name: "vlan300"

 

    - name: Update Switch System Attributes

      arubaoss_system_attributes:

        hostname: "TestSW"

 

Error messages are as following:

ilia@psg-ans01:~/ANS$ ansible-playbook pb_test.yml -i inv_switch1.yml

 

PLAY [all] **********************************************************************************************************************************************************************************************************************************

 

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************

ok: [switch1]

 

TASK [Create VLAN 300] **********************************************************************************************************************************************************************************************************************

fatal: [switch1]: FAILED! => {"body": "{\"message\":\"Invalid parameters\"}", "changed": false, "connection": "close", "content-type": "application/json", "msg": "HTTP Error 400: Bad Request", "requestid": "", "server": "eHTTP v2.0", "status": 400, "transfer-encoding": "chunked", "url": "http://192.168.1.11:80/rest/v5.0/vlans"}

[WARNING]: Could not create retry file '/home/ilia/ANS/pb_test.retry'.         [Errno 13] Permission denied: u'/home/ilia/ANS/pb_test.retry'

 

 

PLAY RECAP **********************************************************************************************************************************************************************************************************************************

switch1                    : ok=1    changed=0    unreachable=0    failed=1

 

I also tried all tasks from example files including others that use VLAN submodule. They work OK and I was able to delete test VLAN just fine.

Direct call(via browser) on http://192.168.1.11/rest/v5.0/vlans works:

{"collection_result":{"total_elements_count":1,"filtered_elements_count":1},"vlan_element":[{"uri":"/vlans/1","vlan_id":1,"name":"DEFAULT_VLAN","status":"VS_PORT_BASED","type":"VT_STATIC","is_voice_enabled":false,"is_jumbo_enabled":false,"is_dsnoop_enabled":false,"is_management_vlan":false}]}

PS: Tiffany - thanks for tutorials, carry on!

New Contributor

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

from the surface I can see the task is missing a line of code. I run the create vlan task as: 

tasks:
- name: Configure VLAN 10
arubaoss_vlan:
vlan_id: 10
name: "vlan10"
config: create
command: config_vlan

Occasional Contributor I

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

Thank you, Kelvinj. While comparing different examples available online I noticed that most of them have config parameter set, so I tried that as well. Unfortunately, it doesn`t fix things for me. Here is a clean run with nothing else to make sure:

root@psg-ans01:/home/ilia/ANS# cat pb_test.yml
---
- hosts: all
tasks:
- name: Create VLAN 30
arubaoss_vlan:
vlan_id: 30
name: "ddd"
config: "create"
command: config_vlan
root@psg-ans01:/home/ilia/ANS# ansible-playbook pb_test.yml -i inv_switch1.yml

PLAY [all] **********************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
ok: [switch1]

TASK [Create VLAN 30] ***********************************************************************************************************************************************************************************************************************
fatal: [switch1]: FAILED! => {"body": "{\"message\":\"Invalid parameters\"}", "changed": false, "connection": "close", "content-type": "application/json", "msg": "HTTP Error 400: Bad Request", "requestid": "", "server": "eHTTP v2.0", "status": 400, "transfer-encoding": "chunked", "url": "http://192.168.1.11:80/rest/v5.0/vlans"}
to retry, use: --limit @/home/ilia/ANS/pb_test.retry

PLAY RECAP **********************************************************************************************************************************************************************************************************************************
switch1 : ok=1 changed=0 unreachable=0 failed=1

root@psg-ans01:/home/ilia/ANS#

MVP Expert

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

Do you have check the rest debug log ?

 

There is no already a vlan ddd ?




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


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


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


PowerArubaIAP: Powershell Module to use Aruba Instant AP




ACMP 6.4 / ACMX #107 / ACCP 6.5
Occasional Contributor I

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

Thanks, Alexis, good lead. Can see following output in logs:

...

0011:03:46:43.81 rest RestSrv-2:Method = GET, URI =
/rest/v5.0/vlans/params['vlan_id']
0011:03:46:43.81 rest RestSrv-2:status = 404, reason = Not Found

...

0011:03:46:43.98 rest RestSrv-2:Method = GET, URI = /rest/v5.0/vlans/30
0011:03:46:43.99 rest RestSrv-2:status = 404, reason = Not Found

...

It makes sence why second call is failing as there is no vlan 30. But what should I see as a responce to /rest/v5.0/vlans/params['vlan_id']? And where is a call to create vlan 30?

 

When I amd trying to browse to http://192.168.1.11:80/rest/v5.0/vlans/params['vlan_id'] I am getting same 404 error. 

 

When I am browsing to http://192.168.1.11:80/rest/v5.0/vlans I am getting following:

0011:04:09:24.87 rest tHttpd:REST request redirected to REST server
0011:04:09:24.87 rest tHttpd:Send REST request message to REST control task
0011:04:09:24.87 rest tHttpd:tHttpd is unblocked with necessary cleanup
0011:04:09:24.87 rest mrest_ctrl:Request for parse header
0011:04:09:24.87 rest mrest_ctrl:Request for parse header after method GET
0011:04:09:24.87 rest mrest_ctrl:uri len = 16
0011:04:09:24.87 rest mrest_ctrl: PARSE header Cookie value : (null)
0011:04:09:24.87 rest mrest_ctrl:Validate operation: operation is allowed 0
0011:04:09:24.87 rest mrest_ctrl:Rest valid Operation.
0011:04:09:24.87 rest RestSrv-2:Method = GET, URI = /rest/v5.0/vlans
0011:04:09:24.88 rest mrest_ctrl:read len 131
0011:04:09:24.88 rest mrest_ctrl:bytes_pending 0, nsent 131
0011:04:09:24.88 rest mrest_ctrl:read len 501
0011:04:09:24.88 rest mrest_ctrl:bytes_pending 0, nsent 501
0011:04:09:24.88 rest mrest_ctrl:read len 0
0011:04:09:24.88 rest mrest_ctrl:REST response is sent
0011:04:09:24.88 rest mrest_ctrl:REST request processed successfully

 

Switch has almost default config, so no vlan with name ddd or id 30:

TestSW1# sh run

Running configuration:

; J9772A Configuration Editor; Created on release #YA.16.06.0006
; Ver #13:44.00.04.19.02.13.98.82.34.61.18.28.f3.84.9c.63.ff.37.27:43
hostname "TestSW1"
aruba-central disable
web-management ssl
snmp-server community "public" unrestricted
snmp-server community "test" operator unrestricted
snmp-server contact "9253237651" location "Santa Clara"
vlan 1
name "DEFAULT_VLAN"
untagged 1-52
ip address dhcp-bootp
exit
vlan 20
name "VLAN20"
ip address 10.10.30.40 255.255.255.0
exit
spanning-tree
spanning-tree mode rapid-pvst
no tftp server
no dhcp config-file-update
no dhcp image-file-update
no dhcp tr69-acs-url
password manager

 

 

MVP Expert

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

What rest log when you try with ansible ?

do you have try to make a pcap capture ? (on the ansible server)

 

Do you have check the login/password ? (need to be connected to create a vlan)




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


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


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


PowerArubaIAP: Powershell Module to use Aruba Instant AP




ACMP 6.4 / ACMX #107 / ACCP 6.5
Aruba Employee

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

Hi!

 

I believe the cause of your issue is due to Issue #10. This is due to the fact that the platform 2530 does not have the feature to allow for dhcp server to be enabled on a VLAN, therefore it rejects this data and the REST command fails.

 

I've pushed a temporary fix to the Github by commenting out that parameter. Please uninstall and reinstall the Aruba Switching Modules after executing a git pull in the cloned repo.

 

If you're in the aruba-ansible-modules directory, execute the following commands:

git pull

sudo python aos_wired_module_installer/aos_wired_module_installer.py -r

sudo python aos_wired_module_installer/aos_wired_module_installer.py 

Let me know if you're still seeing the issue :)

 

 

Occasional Contributor I

Re: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

It works now!

Thanks!

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: