aruba / aruba-ansible-modules

Aruba Ansible Modules
Apache License 2.0
80 stars 36 forks source link

arubaoss_facts error #134

Open el-magneto opened 2 years ago

el-magneto commented 2 years ago

I'm trying to use arubaoss_facts:

- name: "Gather Aruba switch facts"
  hosts: test_switches
  gather_facts: no

  tasks:
    - name: gather facts
      arubanetworks.aos_switch.arubaoss_facts:
        use_ssl: True
        port: 443

and got an error:

PLAY [Gather Aruba switch facts] *************************************************************************************************************************

TASK [gather facts] **************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NoneType' object has no attribute 'keys'
fatal: [10.2.83.2]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1643028763.585638-1009172-188353146898098/AnsiballZ_arubaoss_facts.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1643028763.585638-1009172-188353146898098/AnsiballZ_arubaoss_facts.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1643028763.585638-1009172-188353146898098/AnsiballZ_arubaoss_facts.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.arubanetworks.aos_switch.plugins.modules.arubaoss_facts', init_globals=dict(_module_fqn='ansible_collections.arubanetworks.aos_switch.plugins.modules.arubaoss_facts', _modlib_path=modlib_path),\n  File \"/usr/lib64/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/modules/arubaoss_facts.py\", line 182, in <module>\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/modules/arubaoss_facts.py\", line 174, in main\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/facts/facts.py\", line 58, in get_facts\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py\", line 162, in get_network_legacy_facts\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/facts/legacy.py\", line 97, in populate\n  File \"/tmp/ansible_arubanetworks.aos_switch.arubaoss_facts_payload_x1srqpu4/ansible_arubanetworks.aos_switch.arubaoss_facts_payload.zip/ansible_collections/arubanetworks/aos_switch/plugins/module_utils/facts/legacy.py\", line 53, in populate\nAttributeError: 'NoneType' object has no attribute 'keys'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP ***********************************************************************************************************************************************
10.2.83.2                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

I have correct connectivity and authorisation to switch:

I 01/24/22 13:52:51 05005 http: User 'xxx' is logged in from REST.
I 01/24/22 13:52:53 05006 http: User 'xxx' is logged out from REST.

My switch: System Description : Aruba JL355A 2540-48G-4SFP+ Switch, OS version: YC.16.10.0012

el-magneto commented 2 years ago

Anyone?!

tchiapuziowong commented 2 years ago

Hi @el-magneto - apologies this repo is no longer being maintained. Please use our AOS-Switch Collection found here on Ansible Galaxy and the README which includes installation and necessary environment set up steps here.

You'll need to set the NETWORK_OS to include arubaoss as outlined here.

And ensure you include the collection in the playbook, your whole playbook should look like the following:

  ---
  -  hosts: all
     collections:
       - arubanetworks.aos_switch
     tasks:
       - name: Retrieve Facts from Switch
         arubaoss_facts:

Please ensure REST API is enabled on the switch as well. If you have any further issues please open an issue here.

el-magneto commented 2 years ago

OK , so I moved that issue to the plece you pointed out: https://github.com/aruba/aos-switch-ansible-collection/issues/26#issue-1142884300