Developer

last person joined: 5 days ago 

Expand all | Collapse all

http://none... when using arubanetworks.aos_switch against REST

This thread has been viewed 39 times
  • 1.  http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 21, 2021 11:25 AM
    I have a container running AWX into which I have installed the aos_switch collection, also I have a [git project]/collections/requirements.yml
    telling ansible that arubanetworks.aos_switch is needed.

    When I run SSH command (network_cli arubaoss_command) it works fine against my lab Aruba switch. Whenever I try to run REST though, I get that it want to run against: http://None:80/rest/v6.0/login-sessions which obviously give me a "Request failed: <urlopen error [Errno -2] Name or service not known>".

    In the project folder root I have an ansible.cfg-file which contains
    [defaults]
    ANSIBLE_NETWORK_GROUP_MODULES=arubaoss

    (I also tried to put this into /etc/ansible/ansible.cfg, I see it want to run this cfg for some reason when I increase the verbosity. Same result though)

    Since it works against the switch using SSH I assume my host config is correct. I have put this in the variables section for the host
    ansible_host: 10.0.0.100
    ansible_connection: local
    ansible_network_os: arubanetworks.aos_switch.arubaoss

    In the playbook I have this
    ansible_network_osarubaoss
    and specified the collection
    arubanetworks.aos_switch

    Anyone have any tips on things I can try, as I've tried all the solutions I can find googling this issue? Obviously I'm missing something, but I can't figure out what.

    Oh, and I should mention that I've tried to manually connect to the REST interface and that works fine.

    The hints I get from people who solved this, most of them seem to have been missing ANSIBLE_NETWORK_GROUP_MODULES=arubaoss, but since I specified this in the ansible.cfg-file that ansible tells me it wants to use it seems to me that this should not be the issue for me.


    ------------------------------
    Joakim Nordin
    ------------------------------


  • 2.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 22, 2021 03:37 PM
    Strange

    What ansible release ?

    do you have check your file (and indent ?)

    ------------------------------
    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: http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 22, 2021 07:51 PM

    I can paste the code. It's just a lab as far as it's not working, so no secrets. :)

    This is the super simple playbook:

    - name: Create VLAN 1000
      hosts: Aruba
      gather_facts: no
      collections:
        - arubanetworks.aos_switch
    
      vars:
        ansible_network_os: arubaoss
    
      tasks:
        - name: Create VLAN 1000
          arubaoss_vlan:
            vlan_id: 1000
            name: "test_vlan"
            config: "create"
            command: config_vlan​


    I used this code not using AWX, just strait up ansible; and that works. Granted, that was from another machine. It's when I use AWX it doesn't want to play ball.

    I'm using AWX 17.0.1
    ansible version 2.9.17

    I am new to both AWX and Ansible, so it's quite possible I made silly mistakes here. :) I think the indent is correct though.



    ------------------------------
    Joakim Nordin
    ------------------------------



  • 4.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 29, 2021 03:30 PM
    Hi Joakim!

    I believe the issue is you're not specifying the network os properly for the collection : `ansible_connection: arubanetworks.aos_switch.arubaoss`

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



  • 5.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 30, 2021 02:18 AM
    Hi Tiffany,
    I've put "ansible_network_os: arubanetworks.aos_switch.arubaoss" as a variable on the AWX group "Aruba" where I have my aruba switches. And ansible_connection: local. I changed "local" to "arubanetworks.aos_switch.arubaoss" as your suggestion, but same result.


    ------------------------------
    Joakim Nordin
    ------------------------------



  • 6.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jun 30, 2021 02:41 PM
    Apologies I was wrong before - you were correct in the original `ansible_connection: local` value.

    The issue is with your ansible.cfg file - it should look like the following:
    [defaults]
    NETWORK_GROUP_MODULES=arubaoss


    Please make the change and see if that fixes the issue

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



  • 7.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jul 01, 2021 02:18 AM
    I thought NETWORK_GROUP_MODULES was deprecated and replaced by ANSIBLE_NETWORK_GROUP_MODULES. I tried NETWORK_GROUP_MODULES but no difference. I put ansible.cfg in the same folder as the playbook. Can it be that it don't read it for some reason....(?)

    ------------------------------
    Joakim Nordin
    ------------------------------



  • 8.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jul 02, 2021 07:55 AM
    Maybe it is not an ANSIBLE issue at all. I had some working ANSIBLE playbooks using REST and SSH-CLI, then there were updates on my linux system last week and I get the same issue like you. Maybe it is a dependent library which is used.

    I saved my playbooks, rolled back the system to a snapshot a month ago, restored the playbooks and it is working again. Now I will update package by package and test my scripts between each update to find the one that is breaking the REST api calls.

    ------------------------------
    Florian Huber
    ------------------------------



  • 9.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jul 02, 2021 07:55 AM
    Ok, seems my revert of ANSIBLE version was not successful before. But now with the working snapshot and installing update package by package, I can say:

    It is a ANSIBLE version problem. With 2.9.6 REST works, with 2.9.21 I get the same error like you. Maybe the switch to another ANSIBLE version will solve your issue. ATM I locked ANSIBLE updates.

    S | Repository             | Name     | Current Version     | Available Version   | Arch
    --+------------------------+----------+---------------------+---------------------+-------
    v | Main Update Repository | ansible  | 2.9.6-lp152.1.1     | 2.9.21-lp152.2.4.1  | noarch

    ------------------------------
    Florian Huber
    ------------------------------



  • 10.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jul 02, 2021 08:06 AM
    I am going on vacation today and I will probably not have time to play with ansible/AWX today, but I will try this as soon as I'm back from vacation.
    Thanks!

    ------------------------------
    Joakim Nordin
    ------------------------------



  • 11.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Jul 02, 2021 10:20 AM
    Tried to downgrade to 2.9.6 since it worked for you, but not for me. Then I upgraded to 2.9.23. Same result. Feels like I input some of the info at the wrong place in AWX.
    I also changed my ansible.cfg placed in my repo, and that broke the whole thing, so it couldn't find the collection. In this case that's a good thing, because it suggests that it actually is reading that config though.

    ------------------------------
    Joakim Nordin
    ------------------------------



  • 12.  RE: http://none... when using arubanetworks.aos_switch against REST

    Posted Aug 11, 2021 09:10 AM
    I've fixed the urgent problem using arubaoss_config instead. Because it uses SSH it works. But I still want to be able to use the REST-using modules, so the question remains why it doesn't work. I've run the arubaoss_vlan playbook using ansible-playbook command from the container instance where I have the AWX and it works. It's only when I try to use it with AWX it gives me this error.

    ------------------------------
    Joakim Nordin
    ------------------------------