How do you trigger AWX jobs from CI or other systems?
IntermediateProductionAWX, AAP and Cloud Integration
Answer
Three options, in order of preference for pipelines:
# 1. awx CLI (pip install awxkit): launch and wait for the result
export CONTROLLER_HOST=https://awx.example.com CONTROLLER_OAUTH_TOKEN=...
awx job_templates launch "Deploy web - prod" \
--extra_vars '{"app_version": "2.4.1"}' --limit web --monitor
# 2. REST API
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"extra_vars": {"app_version": "2.4.1"}}' \
https://awx.example.com/api/v2/job_templates/42/launch/
- Webhooks: enable the GitHub or GitLab webhook on a job template, so a push or merge triggers it directly.
Use a dedicated service account with execute-only rights on that template. --monitor makes the CI job fail when the AWX job fails, which keeps the pipeline honest.
More on AWX, AAP and Cloud Integration
AWX or Red Hat Ansible Automation Platform: what is the difference and what do you pay for?BeginnerWhat are the core objects in AWX and how do they fit together?BeginnerHow do you manage AWX configuration as code?IntermediateHow do custom credential types work in AWX?AdvancedHow do you connect AWX to an external secrets manager?IntermediateHow do project updates work in AWX, and what does "update revision on launch" trade off?Intermediate