aruba / aoscx-ansible-collection

Ansible collections for AOS-CX switches 
48 stars 23 forks source link

Upload Firmware in AOSCX 6100 don't work #52

Closed JSTBotanic closed 1 year ago

JSTBotanic commented 1 year ago

Hi,

II try to update the firmware of an Aruba 6100 switch but without success.

Here is my inventory: all: hosts: Switch1: ansible_host: 192.168.99.10 ansible_user: admin ansible_password: admin ansible_network_os: arubanetworks.aoscx.aoscx ansible_connection: arubanetworks.aoscx.aoscx # REST API Connection ansible_httpapi_validate_certs: False ansible_httpapi_use_ssl: True ansible_acx_no_proxy: True

Here is my playbook :

When I run my script, here are the errors returned to me :

`ansible-playbook playbook_upload_firmware.yml -i /root/aruba_switchs/inventory/inventory_rest_api.yml -vvv ansible-playbook 2.10.8 config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible executable location = /usr/bin/ansible-playbook python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] No config file found; using defaults host_list declined parsing /root/aruba_switchs/inventory/inventory_rest_api.yml as it did not pass its verify_file() method script declined parsing /root/aruba_switchs/inventory/inventory_rest_api.yml as it did not pass its verify_file() method Parsed /root/aruba_switchs/inventory/inventory_rest_api.yml inventory source with yaml plugin Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: playbook_upload_firmware.yml *** 1 plays in playbook_upload_firmware.yml

PLAY [Switch1] ***

TASK [Gathering Facts] *** task path: /root/aruba_switchs/playbook/playbook_upload_firmware.yml:1 <192.168.99.10> ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.99.10> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-local-139632kgem88b"&& mkdir "echo /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260" && echo ansible-tmp-1672738815.3962035-13966-258570738346260="echo /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260" ) && sleep 0'

Attempting python interpreter discovery <192.168.99.10> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0' Python interpreter discovery fallback (pipelining support required for extended interpreter discovery) Using module file /usr/lib/python3/dist-packages/ansible/modules/setup.py <192.168.99.10> PUT /root/.ansible/tmp/ansible-local-139632kgem88b/tmpdch3auuc TO /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260/AnsiballZ_setup.py <192.168.99.10> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260/ /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260/AnsiballZ_setup.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c '/usr/bin/python3.9 /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260/AnsiballZ_setup.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738815.3962035-13966-258570738346260/ > /dev/null 2>&1 && sleep 0' [WARNING]: Platform linux on host Switch1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. ok: [Switch1] META: ran handlers TASK [image upload] ********************************************************************************************************************************************************************************************************************** task path: /root/aruba_switchs/playbook/playbook_upload_firmware.yml:5 <192.168.99.10> ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.99.10> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-139632kgem88b `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755 `" && echo ansible-tmp-1672738816.760113-14028-85483451906755="` echo /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755 `" ) && sleep 0' redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils redirecting module_util ansible.module_utils.network.common.utils to ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils Using module file /root/.ansible/roles/arubanetworks.aoscx_role/library/aoscx_upload_firmware.py <192.168.99.10> PUT /root/.ansible/tmp/ansible-local-139632kgem88b/tmptnetqmfb TO /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py <192.168.99.10> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/ /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c '/usr/bin/python3.9 /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py", line 102, in _ansiballz_main() File "/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.aoscx_upload_firmware', init_globals=None, run_name='__main__', alter_sys=True) File "/usr/lib/python3.9/runpy.py", line 210, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/tmp/ansible_aoscx_upload_firmware_payload_jbkir1hl/ansible_aoscx_upload_firmware_payload.zip/ansible/modules/aoscx_upload_firmware.py", line 191, in File "/tmp/ansible_aoscx_upload_firmware_payload_jbkir1hl/ansible_aoscx_upload_firmware_payload.zip/ansible/modules/aoscx_upload_firmware.py", line 130, in main File "/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_factory.py", line 22, in __call__ cls.__instance = super(Singleton, cls).__call__(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py", line 36, in __init__ self.get_firmware_version() File "/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py", line 39, in ensure_connected return fnct(self, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py", line 199, in get_firmware_version data = self.get_firmware_info() File "/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py", line 39, in ensure_connected return fnct(self, *args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py", line 218, in get_firmware_info raise GenericOperationError(response.text, response.status_code) pyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: Missing CSRF token: Code: 403' fatal: [Switch1]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py\", line 102, in \n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-local-139632kgem88b/ansible-tmp-1672738816.760113-14028-85483451906755/AnsiballZ_aoscx_upload_firmware.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.aoscx_upload_firmware', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_aoscx_upload_firmware_payload_jbkir1hl/ansible_aoscx_upload_firmware_payload.zip/ansible/modules/aoscx_upload_firmware.py\", line 191, in \n File \"/tmp/ansible_aoscx_upload_firmware_payload_jbkir1hl/ansible_aoscx_upload_firmware_payload.zip/ansible/modules/aoscx_upload_firmware.py\", line 130, in main\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_factory.py\", line 22, in __call__\n cls.__instance = super(Singleton, cls).__call__(*args, **kwargs)\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 36, in __init__\n self.get_firmware_version()\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n return fnct(self, *args, **kwargs)\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 199, in get_firmware_version\n data = self.get_firmware_info()\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n return fnct(self, *args, **kwargs)\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 218, in get_firmware_info\n raise GenericOperationError(response.text, response.status_code)\npyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: Missing CSRF token: Code: 403'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } PLAY RECAP ******************************************************************************************************************************************************************************************************************************* Switch1 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 ` Can you help me to solve this error ? Thank you so much.
tchiapuziowong commented 1 year ago

Hi @JSTBotanic please ensure you're using the collection by including the collection in the playbook, you'll want to change your playbook to the following:

- hosts: Switch1
  collections:
    - arubanetworks.aoscx
  tasks:
    - name: image upload
      aoscx_upload_firmware:
        partition_name: 'secondary'
        firmware_file_path: '/root/aruba_switchs/firmwares/ArubaOS-CX_6100-6000_10_10_1020.swi'

Also please ensure you have the latest PYAOSCX package as well as the collection by using the following installation commands: ansible-galaxy collection install arubanetworks.aoscx -f python3 -m pip install --upgrade --force-reinstall pyaoscx

Please respond if the error persists or if you receive another error. When you respond please include what firmware is currently on the switch, and you stated it's a 6100 correct?

JSTBotanic commented 1 year ago

Hi @tchiapuziowong

Thanks for your reply.

I made the changes but now I have a new error message :

`ansible-playbook 2.10.8 config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python3/dist-packages/ansible executable location = /usr/bin/ansible-playbook python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] No config file found; using defaults host_list declined parsing /root/aruba_switchs/inventory/inventory_rest_api.yml as it did not pass its verify_file() method script declined parsing /root/aruba_switchs/inventory/inventory_rest_api.yml as it did not pass its verify_file() method Parsed /root/aruba_switchs/inventory/inventory_rest_api.yml inventory source with yaml plugin Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: playbook_upload_firmware.yml ***** 1 plays in playbook_upload_firmware.yml

PLAY [Switch1] *****

TASK [Gathering Facts] ***** task path: /root/aruba_switchs/playbook/playbook_upload_firmware.yml:1 <192.168.99.10> ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.99.10> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-local-155547e23_d3y"&& mkdir "echo /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353" && echo ansible-tmp-1672816208.2956982-15557-121463636183353="echo /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353" ) && sleep 0'

Attempting python interpreter discovery <192.168.99.10> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'python3.5'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'python2.6'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0' Python interpreter discovery fallback (pipelining support required for extended interpreter discovery) Using module file /usr/lib/python3/dist-packages/ansible/modules/setup.py <192.168.99.10> PUT /root/.ansible/tmp/ansible-local-155547e23_d3y/tmpp79mk680 TO /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353/AnsiballZ_setup.py <192.168.99.10> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353/ /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353/AnsiballZ_setup.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c '/usr/bin/python3.9 /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353/AnsiballZ_setup.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816208.2956982-15557-121463636183353/ > /dev/null 2>&1 && sleep 0' [WARNING]: Platform linux on host Switch1 is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the meaning of that path. See https://docs.ansible.com/ansible/2.10/reference_appendices/interpreter_discovery.html for more information. ok: [Switch1] META: ran handlers TASK [image upload] ******************************************************************************************************************************************************************************************** task path: /root/aruba_switchs/playbook/playbook_upload_firmware.yml:5 <192.168.99.10> ESTABLISH LOCAL CONNECTION FOR USER: root <192.168.99.10> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-local-155547e23_d3y `"&& mkdir "` echo /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043 `" && echo ansible-tmp-1672816209.6191065-15619-54317262584043="` echo /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043 `" ) && sleep 0' Using module file /root/.ansible/collections/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py <192.168.99.10> PUT /root/.ansible/tmp/ansible-local-155547e23_d3y/tmpusuq3lyj TO /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py <192.168.99.10> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/ /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c '/usr/bin/python3.9 /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py && sleep 0' <192.168.99.10> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/usr/local/lib/python3.9/dist-packages/pyaoscx/utils/util.py", line 177, in file_upload response_file_upload = requests.post( File "/usr/local/lib/python3.9/dist-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, **kwargs) File "/usr/local/lib/python3.9/dist-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 573, in request prep = self.prepare_request(req) File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 484, in prepare_request p.prepare( File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 368, in prepare self.prepare_url(url, params) File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 439, in prepare_url raise MissingSchema( requests.exceptions.MissingSchema: Invalid URL 'firmware?image=primary': No scheme supplied. Perhaps you meant http://firmware?image=primary? During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py", line 120, in main File "/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py", line 514, in upload_firmware result = self.upload_firmware_local( File "/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py", line 476, in upload_firmware_local success = utils.file_upload(self.session, firmware_file_path, uri) File "/usr/local/lib/python3.9/dist-packages/pyaoscx/utils/util.py", line 194, in file_upload raise ResponseError("POST", e) pyaoscx.exceptions.response_error.ResponseError: "RESPONSE ERROR: Invalid URL 'firmware?image=primary': No scheme supplied. Perhaps you meant http://firmware?image=primary?: Response: POST" During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py", line 102, in _ansiballz_main() File "/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py", line 40, in invoke_module runpy.run_module(mod_name='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_upload_firmware', init_globals=None, run_name='__main__', alter_sys=True) File "/usr/lib/python3.9/runpy.py", line 210, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code _run_code(code, mod_globals, init_globals, File "/usr/lib/python3.9/runpy.py", line 87, in _run_code exec(code, run_globals) File "/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py", line 195, in File "/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py", line 127, in main AttributeError: 'AnsibleModule' object has no attribute 'module' fatal: [Switch1]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/utils/util.py\", line 177, in file_upload\n response_file_upload = requests.post(\n File \"/usr/local/lib/python3.9/dist-packages/requests/api.py\", line 115, in post\n return request(\"post\", url, data=data, json=json, **kwargs)\n File \"/usr/local/lib/python3.9/dist-packages/requests/api.py\", line 59, in request\n return session.request(method=method, url=url, **kwargs)\n File \"/usr/local/lib/python3.9/dist-packages/requests/sessions.py\", line 573, in request\n prep = self.prepare_request(req)\n File \"/usr/local/lib/python3.9/dist-packages/requests/sessions.py\", line 484, in prepare_request\n p.prepare(\n File \"/usr/local/lib/python3.9/dist-packages/requests/models.py\", line 368, in prepare\n self.prepare_url(url, params)\n File \"/usr/local/lib/python3.9/dist-packages/requests/models.py\", line 439, in prepare_url\n raise MissingSchema(\nrequests.exceptions.MissingSchema: Invalid URL 'firmware?image=primary': No scheme supplied. Perhaps you meant http://firmware?image=primary?\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py\", line 120, in main\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 514, in upload_firmware\n result = self.upload_firmware_local(\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 476, in upload_firmware_local\n success = utils.file_upload(self.session, firmware_file_path, uri)\n File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/utils/util.py\", line 194, in file_upload\n raise ResponseError(\"POST\", e)\npyaoscx.exceptions.response_error.ResponseError: \"RESPONSE ERROR: Invalid URL 'firmware?image=primary': No scheme supplied. Perhaps you meant http://firmware?image=primary?: Response: POST\"\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py\", line 102, in \n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-local-155547e23_d3y/ansible-tmp-1672816209.6191065-15619-54317262584043/AnsiballZ_aoscx_upload_firmware.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.arubanetworks.aoscx.plugins.modules.aoscx_upload_firmware', init_globals=None, run_name='__main__', alter_sys=True)\n File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n _run_code(code, mod_globals, init_globals,\n File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py\", line 195, in \n File \"/tmp/ansible_aoscx_upload_firmware_payload_tdu_ci9s/ansible_aoscx_upload_firmware_payload.zip/ansible_collections/arubanetworks/aoscx/plugins/modules/aoscx_upload_firmware.py\", line 127, in main\nAttributeError: 'AnsibleModule' object has no attribute 'module'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 } PLAY RECAP ***************************************************************************************************************************************************************************************************** Switch1 : ok=1 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0 ` My firmware is in this folder : ![image](https://user-images.githubusercontent.com/121860096/210503303-d4c2f67b-0efc-4606-8817-7fbaeb300b84.png) And the firmware on the switch : ![image](https://user-images.githubusercontent.com/121860096/210504074-72e94855-1d89-4aad-b5c6-3d618607c34b.png) Can you help me to solve this error ? Thank you so much.
alagoutte commented 1 year ago

What your playbook ?

JSTBotanic commented 1 year ago

Hi @alagoutte

My playbook :

And my inventory is on the first comment.

Thank you.

alagoutte commented 1 year ago

Hi @alagoutte

My playbook :

* hosts: Switch1
  collections:

  * arubanetworks.aoscx
    tasks:
  * name: image upload
    aoscx_upload_firmware:
    partition_name: 'secondary'
    firmware_file_path: '/root/aruba_switchs/firmwares/ArubaOS-CX_6100-6000_10_10_1020.swi'

And my inventory is on the first comment.

Thank you.

Why do you are using role and not collection ?

JSTBotanic commented 1 year ago

Hi @alagoutte,

@tchiapuziowong told me to switch role by collection in the second comment.

tchiapuziowong commented 1 year ago

Hi @JSTBotanic I believe this is due to a known issue with the 6100 that the development team is still working on resolving issue28 - this is due in part to how the python library we're using to upload the file is sending to the switch, we're working on a fix and will update both these issues once a fix has been uploaded

JSTBotanic commented 1 year ago

Hi @tchiapuziowong have you got date for the release ?

JSTBotanic commented 1 year ago

@tchiapuziowong @alagoutte Any updates ?

tchiapuziowong commented 1 year ago

We're working on finalizing testing and are looking to publish a new release soon including this fix - thank you for your continued patience and we'll update the issue once it's been published.

tchiapuziowong commented 1 year ago

We're still finalizing some fixes and are planning to publish new version next week - thank you again for your continued patience!

JSTBotanic commented 1 year ago

Hi @tchiapuziowong the fixes are publish ?

tchiapuziowong commented 1 year ago

We've just uploaded a new version of the collection that addresses this issue- please ensure to install the latest version of the collection, pyaoscx, and pycurl with the following commands: pip install pycurl

pip install pyaoscx --upgrade

ansible-galaxy collection install arubanetworks.aoscx -f