Developer

 View Only
last person joined: 3 days ago 

Expand all | Collapse all

Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

This thread has been viewed 59 times
  • 1.  Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 11, 2021 08:19 AM
    Hello ,

    Iam testing the ansible with arubaoss and got stuck at error related to REST API :


    fatal: [switch1]: FAILED! => {"changed": false, "msg": "Connection failure: Remote end closed connection without response", "status": -1, "url": "http://10.100.100.238:80/rest/v6.0/login-sessions"}


    When i tried it multiple times it worked for once using the below sample playbook and got fatal error again :

    #ansible-playbook system_attributes.yml -i switch_hosts.yml


    Control Machine running on Ubuntu server 20.xx
    Python 3.8
    Ansible 2.9.6
    Aruba Switch - 2930M-48G-PoE+
    Rest Interface Enabled

    Error Pics:
    https://drive.google.com/drive/folders/1ldfYpsqTlN0JS4IUE7brntb8wv71jCh5?usp=sharing

    Iam testing sample playbooks from github
    https://github.com/aruba/aruba-ansible-modules/blob/master/example_playbooks/arubaoss/vlan.yml

    ------------------------------
    Sam DS
    ------------------------------


  • 2.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    MVP GURU
    Posted Feb 11, 2021 08:50 AM
    What firmware and configuration on Aruba Switch ?

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

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

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

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



  • 3.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 11, 2021 08:56 AM
    WC.16.10.0011
    New unit- so at factory default, with ssh and web enabled , thats all 
    also pls see the gdrive link above with the screenshots .

    ------------------------------
    Sam DS
    ------------------------------



  • 4.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    MVP GURU
    Posted Feb 11, 2021 04:23 PM
    can you update to 16.10.0012 ?  there is an issue with some REST API call for some plaform

    do you have check the log switch ?

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

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

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

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



  • 5.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 11, 2021 04:55 PM
    Yes I believe alexis is correct this may be similar to the issue seen here : https://github.com/aruba/aruba-ansible-modules/issues/117

    Try updating your switch and see if the issue persists​

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



  • 6.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 11, 2021 05:26 PM
    Update:
    With defaulting the unit to factory , setting up the OOBM IP, and REST enabled and with SSL disabled , it worked on the same fw :WC.16.10.0011 and created 50 tasks . ( see attached)
    So this just a plain home environment without RADIUS and TACACS , 
    But i did have issues when created a mgmt vlan and tried to achieve the same , will try to update the FW and see .



    ------------------------------
    Sam DS
    ------------------------------



  • 7.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 11, 2021 01:15 PM
    Hi Sam!

    For AOS-Switch could you please install and use the AOS-Switch Collection ? When you run the playbook you'll have to set the proper environment variables as shown here.  

    You shouldn't have to change your playbook much besides ensuring you're including the collection that's described here: https://github.com/aruba/aos-switch-ansible-collection#example-playbook

    The only other thing I could consider with this error, could you please verify the user you're using to login to the switch has the proper permissions to execute REST API commands? Such as TACACs or RADIUS? Please try that and let us know if you're still receiving that error!

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



  • 8.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 13, 2021 11:13 PM
    Hi Tiffany,

    i was able to configure the switch to a certain extent , thanks for the support , i got suck at dsnoop:

    ---
    -
     hosts: switch1
     tasks:
        - name: enable dsnoop
           arubaoss_dsnoop:
           dsnoop: true

        - name: add dsnoop authorized_server
          arubaoss_dsnoop:
            command: authorized_server
            server_ip: "10.100.100.100"

        - name: add dsnoop authorized_server
          arubaoss_dsnoop:
            command: authorized_server
            server_ip: "10.200.200.200"




    I get error: -vvv
    https://github.com/aruba/aruba-ansible-modules/blob/master/module_documentation/arubaoss/arubaoss_dsnoop.md


    The full traceback is:
    Traceback (most recent call last):
    File "/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py", line 102, in <module>
    _ansiballz_main()
    File "/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
    File "/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible.modules.network.arubaoss.arubaoss_dsnoop', init_globals=None, run_name='__main__', alter_sys=True)
    File "/usr/lib/python3.8/runpy.py", line 207, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
    File "/usr/lib/python3.8/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
    File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
    File "/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py", line 255, in <module>
    File "/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py", line 251, in main
    File "/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py", line 229, in run_module
    NameError: name 'arubaoss_required_if' is not defined
    fatal: [switch1]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/ansible/.ansible/tmp/ansible-tmp-1613275259.6505885-259405060885273/AnsiballZ_arubaoss_dsnoop.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.network.arubaoss.arubaoss_dsnoop', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib/python3.8/runpy.py\", line 207, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.8/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.8/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py\", line 255, in <module>\n File \"/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py\", line 251, in main\n File \"/tmp/ansible_arubaoss_dsnoop_payload_jwkn_249/ansible_arubaoss_dsnoop_payload.zip/ansible/modules/network/arubaoss/arubaoss_dsnoop.py\", line 229, in run_module\nNameError: name 'arubaoss_required_if' is not defined\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
    }


    ------------------------------
    Sam DS
    ------------------------------



  • 9.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 16, 2021 12:43 PM
    Thanks Sam for the update! This does look like a bug, would you be able to open an issue on our collection so I can better track this? https://github.com/aruba/aos-switch-ansible-collection/issues

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



  • 10.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 16, 2021 01:04 PM
    Thank you ,
    I have submitted the issue :
    https://github.com/aruba/aos-switch-ansible-collection/issues/7

    ------------------------------
    Sam DS
    ------------------------------



  • 11.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 23, 2021 11:05 AM
    Hello Tiffany,

    quick update on the dnoop error :
    I got the dsnoop authorized_server working with the help of Aruba TAC (PR)   he had to add  "arubaoss_required_if "  arubaoss_dsnoop.py file and reinstall the module :

    cd aruba-ansible-modules/aruba_module_installer/library/modules/network/arubaoss
    sudo nano arubaoss_dsnoop.py
    sudo python3 aruba_module_installer.py --reinstall


     


    ------------------------------
    Sam DS
    ------------------------------



  • 12.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    MVP GURU
    Posted Feb 16, 2021 03:15 PM
    Hi Sam,

    open a issue on bugtracker, it look a bug !

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

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

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

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



  • 13.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 16, 2021 09:33 PM
    Thank you Alagoutte, 
    I did it ..

    One more question - how does write memory work on this thing ?
    I mean after i issue the playbook command and its done configuring the changes on the switch , will it save /wr mem automatically or do we have to do it manually ?

    ------------------------------
    Sam DS
    ------------------------------



  • 14.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 17, 2021 12:27 PM
    Hi Sam!

    Our modules do not automatically save the configuration but we have a couple options for saving the config.

    You can you the REST API module to backup the configuration with either the arubaoss_config_bkup or arubaoss_anycli like so:
    - name: backup running configuration to flash test1
      arubaoss_config_bkup:
        file_name: test1
        config_type: CT_RUNNING_CONFIG
    
    ### ANOTHER METHOD 
    
    - name: Execute write memory using ANYCLI API
      arubaoss_anycli:
        command: "write memory"​

    Or you can use the SSH module to execute the write memory command:
    - name: Save running configuration to flash using SSH command
      arubaoss_config:
        lines:
          - write memory
    
    - name: Save running configuration to flash using SSH command
      arubaoss_config:
        lines:
          - cfg-backup running-config config test1   ​

    To see the documentation for any of these modules enter the command below in your Ansible control machine:
    ansible-doc arubanetworks.aos_switch.<module_name>
    
    ansible-doc arubanetworks.aos_switch.arubaoss_anycli
    ansible-doc arubanetworks.aos_switch.arubaoss_config
    ansible-doc arubanetworks.aos_switch.arubaoss_cfg_backup​


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



  • 15.  RE: Ansible with ArubaOSS- Aruba 2930M -REST API Fata Error - Connection failure: Remote end closed connection without response

    Posted Feb 17, 2021 01:44 PM
    Thank You Tiffany !

    ------------------------------
    Sam DS
    ------------------------------