PaloAltoNetworks/pan-os-ansible

403 error while running from gitlab runner

mksbcisco opened this issue · 0 comments

Describe the bug

While running from gitlab runner I am getting 403 error
"msg": "Failed connection: URLError: reason: Tunnel connection failed: 403 Forbidden"

The full traceback is:
  File "/tmp/ansible_panos_security_rule_payload_0tznje80/ansible_panos_security_rule_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/module_utils/panos.py", line 250, in get_pandevice_parent
    self.device = PanDevice.create_from_device(*pan_device_auth)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 3748, in create_from_device
    system_info = device.refresh_system_info()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 4215, in refresh_system_info
    system_info = self.show_system_info()
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 4171, in show_system_info
    root = self.xapi.op(cmd="show system info", cmd_xml=True)
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 4000, in xapi
    self._xapi_private = self.generate_xapi()
                         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 4072, in generate_xapi
    "api_key": self.api_key,
               ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 3994, in api_key
    self._api_key = self._retrieve_api_key()
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 4159, in _retrieve_api_key
    xapi.keygen(retry_on_peer=False)
  File "/usr/local/lib/python3.11/site-packages/panos/base.py", line 3897, in method
    raise the_exception

Above is the output from -vvvv
I think it is not able to get the api_key

Expected behavior

It should be executing the playbook

Current behavior

giving the above error

Possible solution

Steps to reproduce

gitlab runner

Your Environment

  • Collection: 2.17.6
  • Python: 3.11.4
  • Ansible:2.15.5
  • PAN-OS Python Library & version (e.g. pandevice 0.14.0, pan-os-python 1.0.2):pan-os-python==1.11.0
    pan-python==0.17.0
    pandevice==0.14.0