Developer

last person joined: yesterday 

Expand all | Collapse all

Ansible exception occurs

This thread has been viewed 34 times
  • 1.  Ansible exception occurs

    Posted Feb 07, 2021 01:26 PM
    Hi,

    I'm trying to run some playbooks using AOS-CX role and I'm getting the following error:
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: Method not found
    fatal: [aoscx-01]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/talm/.ansible/tmp/ansible-local-4344lfl3_snl/ansible-tmp-1612718350.2417061-264248707184000/AnsiballZ_aoscx_banner.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/talm/.ansible/tmp/ansible-local-4344lfl3_snl/ansible-tmp-1612718350.2417061-264248707184000/AnsiballZ_aoscx_banner.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/talm/.ansible/tmp/ansible-local-4344lfl3_snl/ansible-tmp-1612718350.2417061-264248707184000/AnsiballZ_aoscx_banner.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_banner', 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_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/modules/aoscx_banner.py\", line 116, in <module>\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/modules/aoscx_banner.py\", line 76, in main\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/module_utils/aoscx.py\", line 354, in __init__\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/module_utils/aoscx.py\", line 375, in get_switch_platform\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/module_utils/aoscx.py\", line 269, in get\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/module_utils/aoscx.py\", line 171, in get\n File \"/tmp/ansible_aoscx_banner_payload_sgxe8ahk/ansible_aoscx_banner_payload.zip/ansible/module_utils/connection.py\", line 185, in __rpc__\nansible.module_utils.connection.ConnectionError: Method not found\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

    I've re-installed AOS-CX role using Ansible-galaxy and gitHub, tried on different machines (CentOS/Ububtu) but the result was the same.
    What I'm missing here?

    Thanks.

    ------------------------------
    Tal Madari
    ------------------------------


  • 2.  RE: Ansible exception occurs

    Posted Feb 08, 2021 12:29 PM
    Hi @tal.madari ! Are your inventory variables specified like so:
    all:
      hosts:
        aoscx_1:
          ansible_host: 10.0.0.1
          ansible_user: admin
          ansible_password: password
          ansible_network_os: aoscx
          ansible_connection: httpapi  # REST API connection method
          ansible_httpapi_validate_certs: False
          ansible_httpapi_use_ssl: True
          ansible_acx_no_proxy: True


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



  • 3.  RE: Ansible exception occurs

    Posted Feb 08, 2021 12:39 PM

    Not exactly, this is my hosts file config:

    all:

      hosts:

         aoscx-01:

            ansible_host: 10.255.254.1

            ansible_user: admin

            ansible_password: Aruba123!

            ansible_network_os: aoscx

            ansible_connection: network_cli

     

    as I want to use SSH and not REST, is that should be ok?

     

    Tal Madari
    Aruba Engineering Resolution Team (ERT)  |  EMEA

    CCIE R&S #51784 | Aruba Edge Professional (ACCP/ACSP/ACMP)
    T: +972-77-3143113  |  M: +972-52-2010696  |  tal.madari@hpe.com

    9 Dafna st., Ra'anana, 43662, Israel
    www.arubanetworks.com | FOLLOW USTwitter | LinkedIn

     

     

     






  • 4.  RE: Ansible exception occurs

    Posted Feb 08, 2021 01:05 PM
    Ah okay would you be able to share the playbook? the error message you posted seems to show that the playbook is trying to use the aoscx_banner module which uses REST API. To use SSH modules to execute CLI commands you'll want to use the aoscx_command or the aoscx_config modules.

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



  • 5.  RE: Ansible exception occurs

    Posted Feb 10, 2021 02:10 AM
    Thanks Tiffany.
    so now I changed it to module which uses REST API, here is my hosts and playbook files:


    all:
    hosts:
    aoscx-01:
    ansible_host: 10.255.254.1
    ansible_user: admin
    ansible_password: Aruba123!
    ansible_connection: httpapi # REST API connection method
    ansible_network_os: aoscx
    ansible_httpapi_validate_certs: False
    ansible_httpapi_use_ssl: True
    ansible_acx_no_proxy: True


    ---
    -  hosts: all
       roles:
        - role: arubanetworks.aoscx_role
       tasks:
         - name: Create L3 Interface 1/1/3
           aoscx_l3_interface:
            interface: 1/1/3
            description: Uplink_Interface
            ipv4: ['10.20.1.3/24']
            ipv6: ['2001:db8::1234/64']

    but still I'm getting the following error:

    [talm@centos01 ansible]$ ansible-playbook -i hosts.yml playbook02.yml

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

    TASK [Gathering Facts] *********************************************************************************************************************************************************
    ok: [aoscx-01]

    TASK [Create L3 Interface 1/1/5] ***********************************************************************************************************************************************
    An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: Could not connect to https://10.255.254.1:443/rest/v1/login?username=admin&password=Aruba123!: [Errno 111] Connection refused
    fatal: [aoscx-01]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/home/talm/.ansible/tmp/ansible-local-67031214qmsn5r/ansible-tmp-1612939231.7346241-670393-212370965783079/AnsiballZ_aoscx_l3_interface.py\", line 102, in <module>\n _ansiballz_main()\n File \"/home/talm/.ansible/tmp/ansible-local-67031214qmsn5r/ansible-tmp-1612939231.7346241-670393-212370965783079/AnsiballZ_aoscx_l3_interface.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/talm/.ansible/tmp/ansible-local-67031214qmsn5r/ansible-tmp-1612939231.7346241-670393-212370965783079/AnsiballZ_aoscx_l3_interface.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_l3_interface', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/modules/aoscx_l3_interface.py\", line 205, in <module>\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/modules/aoscx_l3_interface.py\", line 141, in main\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/module_utils/aoscx.py\", line 354, in __init__\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/module_utils/aoscx.py\", line 375, in get_switch_platform\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/module_utils/aoscx.py\", line 269, in get\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/module_utils/aoscx.py\", line 171, in get\n File \"/tmp/ansible_aoscx_l3_interface_payload_ykxd_k4_/ansible_aoscx_l3_interface_payload.zip/ansible/module_utils/connection.py\", line 185, in __rpc__\nansible.module_utils.connection.ConnectionError: Could not connect to https://10.255.254.1:443/rest/v1/login?username=admin&password=Aruba123!: [Errno 111] Connection refused\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

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

    I've also tried to reinstall aoscx-role again:
    [talm@centos01 ansible]$ ansible-galaxy install arubanetworks.aoscx_role -f


    ------------------------------
    Tal Madari
    ------------------------------



  • 6.  RE: Ansible exception occurs

    Posted Feb 10, 2021 02:12 AM
    please ignore my last post, my https-server VRFs was not configured for VRF default.

    Thanks! now it's working.

    ------------------------------
    Tal Madari
    ------------------------------