Stage 4 · Provision
Testing, AWX & CI/CD
Workflow Orchestration
Chaining jobs, approvals, and notifications in AWX.
What Are Workflows?
Workflows chain multiple job templates into a single automation pipeline. Each step can run different playbooks, against different inventories, with different credentials. Workflows implement CI/CD pipelines, approval gates, and multi-stage deployments.
Designing Workflows
# Step 1: Lint and syntax check
# Step 2: Molecule tests (parallel)
# Step 3: Deploy to staging
# Step 4: Integration tests on staging
# Step 5: Manual approval gate
# Step 6: Deploy to production
# Step 7: Post-deploy validation
# Step 8: Notify team on success/failureWorkflows define the order and conditions for each step. Steps can run in parallel or sequence.
Approval Gates
---
- name: Create workflow with approval
hosts: localhost
connection: local
tasks:
- name: Create approval node
ansible.controller.workflow_approval:
name: "Production Approval"
description: "Approve production deployment?"
timeout: 86400 # 24 hours
state: present
controller_host: "https://awx.example.com"
controller_username: "admin"
controller_password: "{{ awx_password }}"Approval nodes pause the workflow until someone approves or rejects. They have configurable timeouts and can be scoped to specific users or teams.
Workflow Error Handling
# Workflow nodes can have different states:
# success - Run only if previous node succeeded
# failure - Run only if previous node failed
# always - Run regardless of previous outcome
# Example:
# Deploy -> (success) -> Verify -> Notify Success
# Deploy -> (failure) -> Rollback -> Notify FailureError handling lets you run different paths based on success or failure. This implements automatic rollback and notification patterns.
Notifications
---
- name: Create Slack notification
hosts: localhost
connection: local
tasks:
- name: Define Slack notification
ansible.controller.notification:
name: "Slack Deploy Notifications"
notification_type: "slack"
notification_configuration:
token: "{{ slack_token }}"
channels:
- "#deployments"
state: present
controller_host: "https://awx.example.com"
controller_username: "admin"
controller_password: "{{ awx_password }}"AWX sends notifications on job success, failure, or approval needed. Configure Slack, email, PagerDuty, or webhook notifications.
AWX provides a visual workflow editor in the web UI. Drag and drop job templates, approvals, and error paths. This makes complex workflows easy to design and understand.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.