Skip to content

403 Errors on API, when there shouldn't be #16072

@unkaputtbar112

Description

@unkaputtbar112

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that AWX is open source software provided for free and that I might not receive a timely response.
  • I am NOT reporting a (potential) security vulnerability. (These should be emailed to [email protected] instead.)

Bug Summary

Since https://console.redhat.com/ansible/automation-hub/repo/published/ansible/controller/ refers this repo and issue tracker, i'm creating the issue here, although it feels it might be wrong and it's hard to place it either on the collection or on the API itself, to be honest.

I think, it might be related to this: #14375

I'm using the whole ansible.platform, ansible.controller, infra.aap_configuration, infra.aap_utilities, ... to have configuration as code.
More often than not, i'm getting 403 Errors when executing, randomly, on different tasks, next run the same task is successful and something else fails, i usually need 10-12runs, until i'm "lucky" that everything went fine, without any change to the configuration, just running over and over again.

My guess would be, that the API itself presents 403 falsely already and then the code, since hardcoded to if status_code == 403, then "You don't have permissions to...", falsely prints that statement as well.

The aap_token is a System Administrator token, so there cannot be any real 403 errors and as said, just running again shifts the error to another task.

AWX version

Running Ansible Automation Platform 2.5 with controller version 4.6.16

Select the relevant components

  • UI
  • UI (tech preview)
  • API
  • Docs
  • Collection
  • CLI
  • Other

Installation method

N/A

Modifications

no

Ansible version

2.16.14

Operating system

RHEL 9.2

Web browser

No response

Steps to reproduce

Have a lot of resources to be configured with the infra.aap_configuration.* roles (which use ansible.controller modules ...), best usecase are workflows, they're failing most frequently, but it's not exclusive to workflows! Almost all resources fail occasionally.

Collection              Version
----------------------- ------------
ansible.controller      4.6.16
ansible.eda             2.8.0
ansible.hub             1.0.0
ansible.platform        2.5.20250604
ansible.posix           2.0.0
infra.aap_configuration 3.4.1
infra.aap_utilities     2.7.0
kubernetes.core         6.0.0

Expected results

Not getting 403 Errors.

Actual results

TASK [infra.aap_configuration.controller_workflow_job_templates : Managing Workflows | Wait for finish the workflow management] *******************************************************************************************************
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked1 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked2 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked3 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sync / AWS | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Inventory sync / Azure | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Create Disk to create Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Create Disk to extend Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Delete | Wait for finish the workflow creation)
failed: [127.0.0.1] (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Read | Wait for finish the workflow creation) => {"__workflows_job_async_results_item": {"__workflow_loop_item": {"allow_simultaneous": true, "ask_inventory_on_launch": false, "ask_labels_on_launch": false, "ask_limit_on_launch": true, "ask_scm_branch_on_launch": false, "ask_skip_tags_on_launch": false, "ask_tags_on_launch": false, "ask_variables_on_launch": false, "description": "Read disk informations for an AWS EC2 Instance", "destroy_current_nodes": true, "extra_vars": {}, "inventory": "", "job_tags": "", "labels": "", "limit": "", "name": "SSA / AWS / WF / Disk Management / Read", "notification_templates_approvals": [], "notification_templates_error": ["SSA / OpsGenie Notification"], "notification_templates_started": [], "notification_templates_success": [], "organization": "SSA", "scm_branch": "", "simplified_workflow_nodes": [{"identifier": "Reading disk informations from OS", "success_nodes": ["Reading informations from platform and create mapping Platform<>OS"], "unified_job_template": "SSA / General / JT / disk_info"}, {"extra_data": {"cld_playbooks_fetch_gpc_credentials": true, "cld_playbooks_gather_facts": true, "cld_playbooks_include_role": "cld.aws.disk_mgmt", "ext_cld_aws_disk_mgmt_mode": "read"}, "identifier": "Reading informations from platform and create mapping Platform<>OS", "unified_job_template": "SSA / AWS / JT / disk_mgmt"}], "skip_tags": "", "survey": {}, "survey_enabled": false, "survey_spec": {}, "webhook_credential": "", "webhook_service": ""}, "ansible_job_id": "j931849667173.2361760", "ansible_loop_var": "__workflow_loop_item", "changed": false, "failed": 0, "finished": 0, "results_file": "/home/someuser/.ansible_async/j931849667173.2361760", "started": 1}, "ansible_job_id": "j931849667173.2361760", "ansible_loop_var": "__workflows_job_async_results_item", "attempts": 1, "changed": false, "finished": 1, "msg": "You don't have permission to GET to /api/controller/v2/notification_templates/ (HTTP 403).", "results_file": "/home/someuser/.ansible_async/j931849667173.2361760", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Virtual Machine Management / Create | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Create Disk to create Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Create Disk to extend Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Delete | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Read | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Update | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Virtual Machine Management / Create | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Avantra Monitoring / Create Maintenance Window | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Avantra Monitoring / Delete Maintenance Window | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Commvault Agent / Install | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Commvault Agent / Uninstall | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Endpoint connection check | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / GPC / Create OS patchbundle | Wait for finish the workflow creation)

in this rare case it failed on the same Workflow, usually it's failing then on another one, i can run it multiple times and present you the output of runs with different failures, if you want...

TASK [infra.aap_configuration.controller_workflow_job_templates : Managing Workflows | Wait for finish the workflow management] *******************************************************************************************************
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked1 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked2 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sources sync / masked3 | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Inventory sync / AWS | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Inventory sync / Azure | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Create Disk to create Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Create Disk to extend Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Delete | Wait for finish the workflow creation)
failed: [127.0.0.1] (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Read | Wait for finish the workflow creation) => {"__workflows_job_async_results_item": {"__workflow_loop_item": {"allow_simultaneous": true, "ask_inventory_on_launch": false, "ask_labels_on_launch": false, "ask_limit_on_launch": true, "ask_scm_branch_on_launch": false, "ask_skip_tags_on_launch": false, "ask_tags_on_launch": false, "ask_variables_on_launch": false, "description": "Read disk informations for an AWS EC2 Instance", "destroy_current_nodes": true, "extra_vars": {}, "inventory": "", "job_tags": "", "labels": "", "limit": "", "name": "SSA / AWS / WF / Disk Management / Read", "notification_templates_approvals": [], "notification_templates_error": ["SSA / OpsGenie Notification"], "notification_templates_started": [], "notification_templates_success": [], "organization": "SSA", "scm_branch": "", "simplified_workflow_nodes": [{"identifier": "Reading disk informations from OS", "success_nodes": ["Reading informations from platform and create mapping Platform<>OS"], "unified_job_template": "SSA / General / JT / disk_info"}, {"extra_data": {"cld_playbooks_fetch_gpc_credentials": true, "cld_playbooks_gather_facts": true, "cld_playbooks_include_role": "cld.aws.disk_mgmt", "ext_cld_aws_disk_mgmt_mode": "read"}, "identifier": "Reading informations from platform and create mapping Platform<>OS", "unified_job_template": "SSA / AWS / JT / disk_mgmt"}], "skip_tags": "", "survey": {}, "survey_enabled": false, "survey_spec": {}, "webhook_credential": "", "webhook_service": ""}, "ansible_job_id": "j417140448342.2358661", "ansible_loop_var": "__workflow_loop_item", "changed": false, "failed": 0, "finished": 0, "results_file": "/home/someuser/.ansible_async/j417140448342.2358661", "started": 1}, "ansible_job_id": "j417140448342.2358661", "ansible_loop_var": "__workflows_job_async_results_item", "attempts": 1, "changed": false, "finished": 1, "msg": "You don't have permission to GET to /api/controller/v2/notification_templates/ (HTTP 403).", "results_file": "/home/someuser/.ansible_async/j417140448342.2358661", "started": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Disk Management / Update | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / AWS / WF / Virtual Machine Management / Create | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Create Disk to create Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Create Disk to extend Volume | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Delete | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Read | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Disk Management / Update | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / Azure / WF / Virtual Machine Management / Create | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Avantra Monitoring / Create Maintenance Window | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Avantra Monitoring / Delete Maintenance Window | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Commvault Agent / Install | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Commvault Agent / Uninstall | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / Endpoint connection check | Wait for finish the workflow creation)
changed: [127.0.0.1] => (item=Create/Update Workflow SSA / General / WF / GPC / Create OS patchbundle | Wait for finish the workflow creation)

Worth to mention, although those errors here refer to the notification_template endpoint sending 403, it's not the only one, it's sometimes directly on the workflow_job_template with id and everything, sometimes on the organization, sometimes on the user...

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions