Closed estebanmilaho closed 1 year ago
Can you share the firmware version and the switch model so I can try and reproduce this issue?
The firmware version is FL.10.09.0010. The Model is a 6300M 48SR5 CL6 PoE 4SFP56 Swch.
Hello - I've attempted to reproduce the issue in my set up and didn't run into any issues, here are my environment details:
ansible [core 2.12.1]
config file = /ws/chiapuzi/tme/sandbox/cx_playbooks/ansible.cfg
configured module search path = ['/users/chiapuzi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /ws/chiapuzi/tme/sandbox/py3_ansible/lib/python3.8/site-packages/ansible
ansible collection location = /users/chiapuzi/.ansible/collections:/usr/share/ansible/collections
executable location = /ws/chiapuzi/tme/sandbox/py3_ansible/bin/ansible
python version = 3.8.9 (default, Apr 3 2021, 01:02:10) [GCC 5.4.0 20160609]
jinja version = 3.0.1
libyaml = True
6300(config)# show version
-----------------------------------------------------------------------------
ArubaOS-CX
(c) Copyright 2017-2022 Hewlett Packard Enterprise Development LP
-----------------------------------------------------------------------------
Version : FL.10.09.0010
Build Date : 2022-02-01 01:24:29 UTC
Build ID : ArubaOS-CX:FL.10.09.0010:e88980c9a1b3:202201312335
Build SHA : e88980c9a1b3a934174127ff297b2adc51ee3915
Active Image : primary
Service OS Version : FL.01.11.0001-internal
BIOS Version : FL.01.0004
6300(config)#
(py3_ansible) ansible-control-machine$cat facts_collections.yml
- hosts: all
name: Test playbook with Aruba API connection
collections:
- arubanetworks.aoscx
vars:
gather_facts: False
tasks:
- name: USE API TO GET HOSTNAME
aoscx_facts:
gather_subset:
- host_name
- physical_interfaces
gather_network_resources:
- interfaces
register: facts_output
- name: PRINT OUT GATHERED FACTS
debug:
var: facts_output
(py3_ansible) ansible-control-machine$cat hosts.yml
all:
hosts:
switch-6300:
ansible_host: 10.100.18.32
ansible_user: admin
ansible_password: admin
ansible_network_os: arubanetworks.aoscx.aoscx
ansible_connection: arubanetworks.aoscx.aoscx # REST API via pyaoscx connection method
ansible_aoscx_validate_certs: False
ansible_aoscx_use_proxy: False
ansible_acx_no_proxy: True
I would recommend updating python and the python libraries required by the collection. Please ensure your ansible_connection is set to arubanetworks.aoscx.aoscx
since this module is using REST API. If you're still encountering the error please work with your SE to get support in troubleshooting.
I've updated my libraries and python. My ansible_connection was set to httpapi
. If i set it to arubanetworks.aoscx.aoscx
none of the above playbooks works not even the one that worked before. The error message with -vvv then is:
The full traceback is:
Traceback (most recent call last):
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 107, in <module>
_ansiballz_main()
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_facts', init_globals=dict(_module_fqn='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_facts', _modlib_path=modlib_path),
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_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_facts.py", line 405, in <module>
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_facts.py", line 396, in main
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/facts/facts.py", line 82, in get_facts
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/facts/facts.py", line 101, in get_switch_running_config
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/aoscx.py", line 385, in get
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/aoscx.py", line 235, in get
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible/module_utils/connection.py", line 200, in __rpc__
ansible.module_utils.connection.ConnectionError: Method not found
fatal: [testhost]: FAILED! => changed=false
module_stderr: |-
Traceback (most recent call last):
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 107, in <module>
_ansiballz_main()
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 99, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/user/.ansible/tmp/ansible-local-1332rznklgqi/ansible-tmp-1653374374.3619854-1337-31889346175505/AnsiballZ_aoscx_facts.py", line 47, in invoke_module
runpy.run_module(mod_name='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_facts', init_globals=dict(_module_fqn='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_facts', _modlib_path=modlib_path),
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_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_facts.py", line 405, in <module>
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_facts.py", line 396, in main
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/facts/facts.py", line 82, in get_facts
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/facts/facts.py", line 101, in get_switch_running_config
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/aoscx.py", line 385, in get
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/module_utils/aoscx.py", line 235, in get
File "/tmp/ansible_aoscx_facts_payload_7rp88ilq/ansible_aoscx_facts_payload.zip/ansible/module_utils/connection.py", line 200, in __rpc__
ansible.module_utils.connection.ConnectionError: Method not found
module_stdout: ''
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
Can you run the following command and see if that changes the result?
python3 -m pip install --upgrade --force-reinstall git+https://github.com/aruba/pyaoscx.git
Unfortunately still the same error.
I am seeing a similar issue where the "ansible_net_interfaces" section of the facts is coming in mostly blank, other sections of the facts appear to be OKAY.
$ ansible --version
ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/zadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
myswitch# show version
-----------------------------------------------------------------------------
ArubaOS-CX
(c) Copyright 2017-2022 Hewlett Packard Enterprise Development LP
-----------------------------------------------------------------------------
Version : FL.10.09.1040
Build Date : 2022-07-19 00:08:38 UTC
Build ID : ArubaOS-CX:FL.10.09.1040:a97700001a3f:202207182249
Build SHA : a97700001a3fff8619a96db997b2963b244ff0bd
Active Image : secondary
Service OS Version : FL.01.09.0002
BIOS Version : FL.01.0002
- name: Gather facts
aoscx_facts:
- name:
ansible.builtin.debug:
msg:
- " {{ (ansible_facts['net_interfaces']) }} "
- " {{ (ansible_facts['net_software_info']) }} "
TASK [ansible.builtin.debug] ********************************************************************************************************************
ok: [myswitch] => changed=false
msg:
- ' {''chassis,1'': {}, ''chassis,10'': {}, ''chassis,2'': {}, ''chassis,3'': {}, ''chassis,4'': {}, ''chassis,5'': {}, ''chassis,6'': {}, ''chassis,7'': {}, ''chassis,8'': {}, ''chassis,9'': {}, ''fan_tray,1/1'': {}, ''fan_tray,1/2'': {}, ''fan_tray,10/1'': {}, ''fan_tray,10/2'': {}, ''fan_tray,2/1'': {}, ''fan_tray,2/2'': {}, ''fan_tray,3/1'': {}, ''fan_tray,3/2'': {}, ''fan_tray,4/1'': {}, ''fan_tray,4/2'': {}, ''fan_tray,5/1'': {}, ''fan_tray,5/2'': {}, ''fan_tray,6/1'': {}, ''fan_tray,6/2'': {}, ''fan_tray,7/1'': {}, ''fan_tray,7/2'': {}, ''fan_tray,8/1'': {}, ''fan_tray,8/2'': {}, ''fan_tray,9/1'': {}, ''fan_tray,9/2'': {}, ''line_card,1/1'': {}, ''line_card,10/1'': {}, ''line_card,2/1'': {}, ''line_card,3/1'': {}, ''line_card,4/1'': {}, ''line_card,5/1'': {}, ''line_card,6/1'': {}, ''line_card,7/1'': {}, ''line_card,8/1'': {}, ''line_card,9/1'': {}, ''management_module,1/1'': {}, ''management_module,10/1'': {}, ''management_module,2/1'': {}, ''management_module,3/1'': {}, ''management_module,4/1'':
{}, ''management_module,5/1'': {}, ''management_module,6/1'': {}, ''management_module,7/1'': {}, ''management_module,8/1'': {}, ''management_module,9/1'': {}} '
- ' {''build_date'': ''2022-07-19 00:08:38 UTC'', ''build_id'': ''ArubaOS-CX:FL.10.09.1040:a97700001a3f:202207182249'', ''build_sha'': ''a97700001a3fff8619a96db997b2963b244ff0bd'', ''os_name'': ''ArubaOS-CX''}'
If I run this same playbook on a 10.07.0061 switch the information is returned.
Hi @DonRhodes & @estebanmilaho -
I've repeated the same playbook and received the desired information through the following playbook and environment, please validate each package/collection/ansible version reflects similar to below: (py3_ansible) ansible-control-machine$pip3 list Package Version
ansible 5.0.1 ansible-core 2.12.1 ansible-pylibssh 0.3.0 bcrypt 3.2.2 certifi 2022.6.15 cffi 1.15.1 charset-normalizer 2.1.0 cryptography 37.0.4 idna 3.3 Jinja2 3.0.1 jxmlease 1.0.3 lxml 4.6.4 MarkupSafe 2.0.1 ncclient 0.6.12 netaddr 0.8.0 packaging 21.2 paramiko 2.11.0 pip 22.0.2 pyaoscx 2.2.1 pycparser 2.21 PyNaCl 1.5.0 pyparsing 2.4.7 PyYAML 6.0 requests 2.28.1 resolvelib 0.5.4 setuptools 49.2.1 six 1.16.0 urllib3 1.26.10 xmltodict 0.12.0 WARNING: You are using pip version 22.0.2; however, version 22.2 is available. You should consider upgrading via the '/ws/chiapuzi/tme/sandbox/py3_ansible/bin/python3 -m pip install --upgrade pip' command.
(py3_ansible) ansible-control-machine$python3 --version Python 3.8.9 (py3_ansible) ansible-control-machine$ansible --version ansible [core 2.12.1] config file = /ws/chiapuzi/tme/sandbox/cx_playbooks/ansible.cfg configured module search path = ['/users/chiapuzi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /ws/chiapuzi/tme/sandbox/py3_ansible/lib/python3.8/site-packages/ansible ansible collection location = /users/chiapuzi/.ansible/collections:/usr/share/ansible/collections executable location = /ws/chiapuzi/tme/sandbox/py3_ansible/bin/ansible python version = 3.8.9 (default, Apr 3 2021, 01:02:10) [GCC 5.4.0 20160609] jinja version = 3.0.1 libyaml = True (py3_ansible) ansible-control-machine$which python3 /ws/chiapuzi/tme/sandbox/py3_ansible/bin/python3 (py3_ansible) ansible-control-machine$ansible-galaxy collection list
Collection Version
ansible.netcommon 2.4.0 ansible.posix 1.1.1 ansible.utils 2.3.1 arubanetworks.aos_switch 1.5.0 arubanetworks.aoscx 4.0.3
I think there are multiple things happening here.
Using:
aoscx_facts:
gather_subset:
- host_name
- physical_interfaces
gather_network_resources:
- interfaces
I get ansible_network_resources -> interfaces and the fact data is there.
Using aoscx_facts:
to gather all of the facts, or
aoscx_facts:
gather_subset: ['host_name','physical_interfaces','platform_name','product_info']
the ansible_net_interfaces tree is only reporting the top level.
Ah okay I see it now - I'll forward this to the dev team and we'll look into it - thank you for working me with to figure out the issue! @DonRhodes
Glad to help!
To make this a big stranger, I noticed that a 6100 running the same code version does not have this issue.
"ansible_net_software_images": {
"boot_profile_timeout": 2,
"default_image": "primary",
"primary_image_date": "2022-07-18 23:44:21 UTC",
"primary_image_sha_256": "c9c74ed1911b7952fe4f32d75f32b5b0dc1cabf70043611d7782d54443f8bf57",
"primary_image_size": "308 MB",
"primary_image_version": "PL.10.09.1040",
"ansible_net_platform_name": "6100",
Hello All!
We've officially published the release of v4.1.1 of the AOS-CX Ansible collection, the fix for this issue as well as others were a part of the release so please install the latest version of the collection and our Python SDK using the commands below:
ansible-galaxy collection install arubanetworks.aoscx -f
pip3 install pyaoscx --upgrade
Please let us know if you discover any further issues or unwanted behavior and thank you again for your patience!
Adding:
ansible_host:
Has returned the facts.
Ansible 2.12.5 Python 3.7.12
I'm trying to get information on the 'admin_state' for each interface of an Aruba Switch with the
aoscx_facts
module. Every time i run my playbook i get a timeout error:This is the playbook that produces that error for me:
Requesting the information i need directly via the API also works for me with the following request URL: [https://<>/rest/v10.09/system/interfaces?attributes=admin_state&depth=2&selector=status]()
This request gets my a response similar to the following one:
What also works is running the playbook without any subset, but then there is no information about the 'admin_state' in the response:
Can someone assist me with that issue?