Adding a new log collector group fails with "unauthorized request"
Closed this issue · 2 comments
ShreyasNBS commented
Describe the bug
I am adding log collector group as below:
- name: create log collector group
panos_config_element:
provider: '{{ provider }}'
xpath: "xpath=/config/devices/entry[@name='localhost.localdomain']/log-collector-group"
element: "<entry name='{{ logCollectorGroupName }}'/>"
This errors as below. Note, I am supplying username, password and api_key.
The full traceback is:
File "/tmp/ansible_panos_config_element_payload_ymm4kcai/ansible_panos_config_element_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_config_element.py", line 266, in main
File "/usr/lib/python3.9/site-packages/panos/base.py", line 3899, in method
raise the_exception
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"edit": false,
"element": "<entry name='testEWLogCollectorGroup'/>",
"provider": {
"api_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"ip_address": "<panorama public IP>",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"serial_number": null,
"username": "admin"
},
"state": "present",
"xpath": "xpath=/config/devices/entry[@name='localhost.localdomain']/log-collector-group"
}
},
"msg": "Unauthorized request"
}
Expected behavior
Log collector group should be created
Current behavior
Log collector group creation fails.
Your Environment
- Collection: panos collection 2.9.0
- Python: 3.9.12
- Ansible: 2.10.7
- PAN-OS Python Library & version (e.g. pandevice 0.14.0, pan-os-python 1.0.2): latest libraries installed via pypi for above config.
shinmog commented
Looking at your xpath
and comparing it to what examples there are for this module, your XPATH is incorrectly defined. Get rid of the xpath=
prefix.
Yes, the error is talking about "Unauthorized request", but the guard rails are off if you're going to use this module.
ShreyasNBS commented
@shinmog Wow. Sorry about that. Somehow missed that completely. Thanks for pointing it out! :)