awx
The AWX / Ansible Tower Client module provides a lightweight Drupal service for launching automation jobs on an AWX / Ansible Tower / Red Hat Ansible Automation Platform instance via its REST API. It gives other modules a single, reusable API client for triggering job templates and surfacing the resulting job in AWX, without each module having to reinvent HTTP plumbing, authentication, logging, and configuration.
Use it any time you want Drupal to drive infrastructure or operational automation — provisioning environments, kicking off backups, restarting services, deploying configuration, running ad-hoc playbooks from a workflow, and so on. It is intentionally small: a client library wrapped in a configuration form, not a workflow engine.
Features
- A single, autowired
awx.awx_clientservice for launching job templates from any module. - Launch a template by name (the numeric ID is resolved automatically) so you never hardcode instance-specific IDs — or by numeric ID when you already have it.
- Typed failure modes for clean error handling, and a helper to link operators straight to the running job in AWX.
- A simple settings form for the AWX URL, API token, connect/response timeouts, and TLS verification.
Usage
The module exposes no UI for launching jobs. Inject the awx.awx_client service into your own code and launch a job template by name:
$job_id = $awx_client->createJobFromTemplateName('Provision customer', $extra_vars);Check the return value against AwxClient::REQUEST_FAILURE_MODES to handle errors, and use getJobUrl($job_id) to link operators to the job in AWX.
Configuration
After enabling, visit Administration → Configuration → Web services → AWX / Ansible Tower (/admin/config/services/awx) to set the base URL, API token, timeouts, and TLS verification.
Why not a generic HTTP / webhook module?
General-purpose HTTP client and webhook modules can be wired up to AWX manually, but they make each consumer handle authentication, endpoint construction, error semantics, and logging on its own. This module is purpose-built for AWX / Ansible Tower's job-template API (name lookup and /api/v2/job_templates/{id}/launch/) and exposes it as a typed Drupal service.