Open jimdavis66 opened 5 months ago
@jimdavis66 Please ensure you have the required libraries installed - you may have to install pycurl Debian based distros: https://github.com/aruba/aoscx-ansible-collection?tab=readme-ov-file#installation
then install pycurl
What firmware is existing on the switch? I know you're attempting to upload ArubaOS-CX_6200_10_13_0005.swi but what is the version on the switch at the time of execution?
Thanks guys. I have the requirements and pycurl installed but am still getting the same 502 error.
root@9fe4622a45b2:/mnt/switches-ansible# python3 -m pip list
Package Version
------------------- --------------------
ansible 6.7.0
ansible-core 2.13.13
ansible-pylibssh 1.1.0
bcrypt 4.1.2
certifi 2019.11.28
cffi 1.16.0
chardet 3.0.4
cryptography 41.0.7
dbus-python 1.2.16
idna 2.8
Jinja2 3.1.2
MarkupSafe 2.1.3
netaddr 0.10.1
packaging 23.2
paramiko 3.4.0
pip 20.0.2
pyaoscx 2.5.1
pycparser 2.21
pycurl 7.45.2
PyGObject 3.36.0
PyNaCl 1.5.0
python-apt 2.0.1+ubuntu0.20.4.1
pytz 2023.3.post1
PyYAML 5.3.1
requests 2.22.0
requests-toolbelt 1.0.0
requests-unixsocket 0.2.0
resolvelib 0.8.1
setuptools 45.2.0
six 1.14.0
urllib3 1.25.8
wheel 0.34.2
The firmware on this particular switch is 10.15.0005. I updated it manually as I keep hoping a firmware update will fix my problem. I've tried this on older versions of firmware too and get the same error.
I haven't come across any issues with other modules from the collection, it is only this aoscx_upload_firmware that isn't working for me.
Thanks
@jimdavis66 the IP address you're using to connect to the switch - is this on a non-mgmt vrf?
@tchiapuziowong yes, it is on the default vrf
sw-science1# show vrf
VRF Configuration:
------------------
VRF Name : default
Interfaces Status
-----------------------------
vlan1 up
@jimdavis66 can you re-test using the latest version of the collection and pyaoscx and see if the issue is still present?
Hi @tchiapuziowong , thanks so much for working on this. I've updated the collection and pyaoscx and am now getting the following error: msg: 'Could not get PYAOSCX Session: ''LOGIN ERROR, Cookies were not set correctly. Login failed'''
root@d63a1e8f54f7:/mnt/switches-ansible# ansible-galaxy collection list
# /usr/local/lib/python3.8/dist-packages/ansible_collections
Collection Version
----------------------------- -------
amazon.aws 3.5.0
ansible.netcommon 3.1.3
ansible.posix 1.4.0
ansible.utils 2.8.0
ansible.windows 1.12.0
arista.eos 5.0.1
awx.awx 21.10.0
azure.azcollection 1.14.0
check_point.mgmt 2.3.0
chocolatey.chocolatey 1.3.1
cisco.aci 2.3.0
cisco.asa 3.1.0
cisco.dnac 6.6.1
cisco.intersight 1.0.22
cisco.ios 3.3.2
cisco.iosxr 3.3.1
cisco.ise 2.5.9
cisco.meraki 2.13.0
cisco.mso 2.1.0
cisco.nso 1.0.3
cisco.nxos 3.2.0
cisco.ucs 1.8.0
cloud.common 2.1.2
cloudscale_ch.cloud 2.2.3
community.aws 3.6.0
community.azure 1.1.0
community.ciscosmb 1.0.5
community.crypto 2.9.0
community.digitalocean 1.22.0
community.dns 2.4.2
community.docker 2.7.3
community.fortios 1.0.0
community.general 5.8.3
community.google 1.0.0
community.grafana 1.5.3
community.hashi_vault 3.4.0
community.hrobot 1.6.0
community.libvirt 1.2.0
community.mongodb 1.4.2
community.mysql 3.5.1
community.network 4.0.2
community.okd 2.2.0
community.postgresql 2.3.1
community.proxysql 1.4.0
community.rabbitmq 1.2.3
community.routeros 2.5.0
community.sap 1.0.0
community.sap_libs 1.4.0
community.skydive 1.0.0
community.sops 1.5.0
community.vmware 2.10.2
community.windows 1.11.1
community.zabbix 1.9.0
containers.podman 1.10.1
cyberark.conjur 1.2.0
cyberark.pas 1.0.14
dellemc.enterprise_sonic 1.1.2
dellemc.openmanage 5.5.0
dellemc.os10 1.1.1
dellemc.os6 1.0.7
dellemc.os9 1.0.4
f5networks.f5_modules 1.21.0
fortinet.fortimanager 2.1.7
fortinet.fortios 2.2.1
frr.frr 2.0.0
gluster.gluster 1.0.2
google.cloud 1.0.2
hetzner.hcloud 1.9.0
hpe.nimble 1.1.4
ibm.qradar 2.1.0
ibm.spectrum_virtualize 1.10.0
infinidat.infinibox 1.3.12
infoblox.nios_modules 1.4.1
inspur.ispim 1.2.0
inspur.sm 2.3.0
junipernetworks.junos 3.1.0
kubernetes.core 2.3.2
lowlydba.sqlserver 1.2.0
mellanox.onyx 1.0.0
netapp.aws 21.7.0
netapp.azure 21.10.0
netapp.cloudmanager 21.21.0
netapp.elementsw 21.7.0
netapp.ontap 21.24.1
netapp.storagegrid 21.11.1
netapp.um_info 21.8.0
netapp_eseries.santricity 1.3.1
netbox.netbox 3.9.0
ngine_io.cloudstack 2.3.0
ngine_io.exoscale 1.0.0
ngine_io.vultr 1.1.2
openstack.cloud 1.10.0
openvswitch.openvswitch 2.1.0
ovirt.ovirt 2.4.1
purestorage.flasharray 1.15.0
purestorage.flashblade 1.10.0
purestorage.fusion 1.2.0
sensu.sensu_go 1.13.1
servicenow.servicenow 1.0.6
splunk.es 2.1.0
t_systems_mms.icinga_director 1.31.4
theforeman.foreman 3.7.0
vmware.vmware_rest 2.2.0
vultr.cloud 1.3.1
vyos.vyos 3.0.1
wti.remote 1.0.4
# /root/.ansible/collections/ansible_collections
Collection Version
------------------- -------
ansible.netcommon 6.0.0
ansible.utils 3.1.0
arubanetworks.aoscx 4.3.2
netbox.netbox 3.17.0
root@d63a1e8f54f7:/mnt/switches-ansible# python3 -m pip list
Package Version
------------------- --------------------
ansible 6.7.0
ansible-core 2.13.13
ansible-pylibssh 1.1.0
bcrypt 4.1.2
certifi 2019.11.28
cffi 1.16.0
chardet 3.0.4
cryptography 42.0.5
dbus-python 1.2.16
idna 2.8
Jinja2 3.1.3
MarkupSafe 2.1.5
netaddr 1.2.1
packaging 23.2
paramiko 3.4.0
pip 20.0.2
pyaoscx 2.5.1
pycparser 2.21
PyGObject 3.36.0
PyNaCl 1.5.0
python-apt 2.0.1+ubuntu0.20.4.1
pytz 2024.1
PyYAML 5.3.1
requests 2.22.0
requests-toolbelt 1.0.0
requests-unixsocket 0.2.0
resolvelib 0.8.1
setuptools 45.2.0
six 1.14.0
urllib3 1.25.8
wheel 0.34.2
Playbook verbose output:
TASK [Get current date and time] ***************************************************************************************************************************************************************************************************************
task path: /mnt/switches-ansible/firmare_upgrade_aoscx.yml:30
<sw-science1> attempting to start connection
<sw-science1> using connection plugin arubanetworks.aoscx
Found ansible-connection at path /usr/local/bin/ansible-connection
<sw-science1> found existing local domain socket, using it!
<sw-science1>
<sw-science1> local domain socket path is /root/.ansible/pc/cfba154ebc
ok: [sw-science1] => changed=false
ansible_facts:
current_datetime: 20240315T122915
TASK [Upload firmware to secondary through local file] *****************************************************************************************************************************************************************************************
task path: /mnt/switches-ansible/firmare_upgrade_aoscx.yml:53
<sw-science1> attempting to start connection
<sw-science1> using connection plugin arubanetworks.aoscx
Found ansible-connection at path /usr/local/bin/ansible-connection
<sw-science1> found existing local domain socket, using it!
<sw-science1>
<sw-science1> local domain socket path is /root/.ansible/pc/cfba154ebc
<sw-science1> ESTABLISH LOCAL CONNECTION FOR USER: root
<sw-science1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-693pbldkore `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949 `" && echo ansible-tmp-1710466164.474497-845-26386923149949="` echo /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949 `" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py
<sw-science1> PUT /root/.ansible/tmp/ansible-local-693pbldkore/tmp2m1ze24l TO /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949/AnsiballZ_aoscx_upload_firmware.py
<sw-science1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949/ /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949/AnsiballZ_aoscx_upload_firmware.py && sleep 0'
<sw-science1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949/AnsiballZ_aoscx_upload_firmware.py && sleep 0'
<sw-science1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-693pbldkore/ansible-tmp-1710466164.474497-845-26386923149949/ > /dev/null 2>&1 && sleep 0'
The full traceback is:
File "/tmp/ansible_aoscx_upload_firmware_payload_13k0581k/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py", line 149, in main
File "/usr/local/lib/python3.8/dist-packages/pyaoscx/session.py", line 165, in open
raise LoginError("Cookies were not set correctly. Login failed")
fatal: [sw-science1]: FAILED! => changed=false
invocation:
module_args:
firmware_file_path: /mnt/switches-ansible/firmware/ArubaOS-CX_6200_10_13_0005.swi
partition_name: secondary
remote_firmware_file_path: null
vrf: null
wait_firmware_upload: true
msg: 'Could not get PYAOSCX Session: ''LOGIN ERROR, Cookies were not set correctly. Login failed'''
PLAY RECAP *************************************************************************************************************************************************************************************************************************************
sw-science1 : ok=5 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Logs from the switch:
5T12:23:51.619991+11:00 sw-science1 hpe-restd[922]: Event|4657|LOG_INFO|AMM|-|User james_davis logged out of REST session from 192.168.254.15
2024-03-15T12:23:51.619821+11:00 sw-science1 hpe-restd[922]: Event|4659|LOG_INFO|AMM|-|REST session from 192.168.254.15 with User james_davis timed out due to idle timeout
2024-03-15T12:20:34.829178+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:20:34.827857+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session iW-GKsK03vOP6Wiy1v3fow==
2024-03-15T12:20:34.671921+11:00 sw-science1 hpe-restd[922]: Event|4657|LOG_INFO|AMM|-|User james_davis logged out of REST session from 192.168.254.15
2024-03-15T12:20:34.670699+11:00 sw-science1 hpe-restd[922]: Event|4608|LOG_INFO|AMM|-|Authorization allowed for user james_davis, for resource SessionMgmt, with action POST
2024-03-15T12:20:34.609510+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:20:34.609401+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session 1ENOKrU47a9_qigMZSS8ow==
2024-03-15T12:04:58.828205+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:04:58.828113+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session 57XDUw-xzFLkLbw01GHgHg==
2024-03-15T12:04:58.625577+11:00 sw-science1 hpe-restd[922]: Event|4657|LOG_INFO|AMM|-|User james_davis logged out of REST session from 192.168.254.15
2024-03-15T12:04:58.624649+11:00 sw-science1 hpe-restd[922]: Event|4608|LOG_INFO|AMM|-|Authorization allowed for user james_davis, for resource SessionMgmt, with action POST
2024-03-15T12:04:58.517212+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:04:58.517076+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session oR54mKHAXGESllMgtY4dyw==
2024-03-15T12:03:21.853742+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:03:21.853409+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session -qlzF0U8tT82lkUpeYiIYA==
2024-03-15T12:03:21.693175+11:00 sw-science1 hpe-restd[922]: Event|4657|LOG_INFO|AMM|-|User james_davis logged out of REST session from 192.168.254.15
2024-03-15T12:03:21.691948+11:00 sw-science1 hpe-restd[922]: Event|4608|LOG_INFO|AMM|-|Authorization allowed for user james_davis, for resource SessionMgmt, with action POST
2024-03-15T12:03:21.618487+11:00 sw-science1 hpe-restd[922]: Event|4655|LOG_INFO|AMM|-|User james_davis logged in from 192.168.254.15 through REST session
2024-03-15T12:03:21.618339+11:00 sw-science1 hpe-restd[922]: Event|4602|LOG_INFO|AMM|-|Authentication succeeded for user james_davis in session 1ryBqWFiWqagTPbPjGIIWA==
@jimdavis66 can you add wait_firmware_upload: True
to the module parameters?
I already have that set to 'true'. You can see it in the verbose output of the playbook:
fatal: [sw-science1]: FAILED! => changed=false
invocation:
module_args:
firmware_file_path: /mnt/switches-ansible/firmware/ArubaOS-CX_6200_10_13_0005.swi
partition_name: secondary
remote_firmware_file_path: null
vrf: null
wait_firmware_upload: true
msg: 'Could not get PYAOSCX Session: ''LOGIN ERROR, Cookies were not set correctly. Login failed'''
I've never managed to get the aoscx_upload_firmware module to work in my environment, despite trying on various AOS-CX firmware versions.
Switch: 6200F Firmware: ML.10.13.0005
This is the error I receive after watching the network : GENERIC OPERATION ERROR: Error processing the command.\n: Code: 502
playbook:
playbook output
collection versions
ansible version
switch logs: