What is a Workflow?
A Workflow in AWX is a structured composition of job resources that enables complex automation scenarios. Workflows execute jobs in a specific order based on success/failure paths, allowing you to chain together multiple job templates, project updates, inventory updates, and even other workflows into sophisticated automation pipelines.Workflows transform simple automation tasks into powerful orchestration pipelines with conditional logic, parallel execution, and dependency management.
Core Concepts
Workflow Components
From the WorkflowJobTemplate model (awx/main/models/workflow.py:455-635):
A workflow consists of:
- Workflow Job Template: The reusable definition
- Workflow Nodes: Individual steps in the workflow
- Node Relationships: Success, failure, and always paths between nodes
- Launch Configuration: Variables and prompts
- Approval Nodes: Manual approval steps
Workflow Job Templates
Key fields (workflow.py:455-467):
| Field | Type | Description |
|---|---|---|
name | String | Workflow name (unique within organization) |
description | String | Optional description |
organization | ForeignKey | Organization that owns this workflow |
extra_vars | TextField | Global variables for all jobs in workflow |
allow_simultaneous | Boolean | Allow concurrent workflow executions |
ask_variables_on_launch | Boolean | Prompt for extra_vars at launch |
ask_inventory_on_launch | Boolean | Prompt for inventory at launch |
ask_limit_on_launch | Boolean | Prompt for limit at launch |
ask_scm_branch_on_launch | Boolean | Prompt for SCM branch at launch |
survey_enabled | Boolean | Enable survey for user input |
survey_spec | JSON | Survey definition |
Workflow Nodes
Workflow nodes are the building blocks of workflows (awx/main/models/workflow.py:64-235):
Node Types
A node can reference any of these unified job templates:- Job Template: Run an Ansible playbook
- Project Update: Sync a project from SCM
- Inventory Update: Sync an inventory source
- Workflow Job Template: Nested workflow
- Workflow Approval: Manual approval step
Node Relationships
Success Nodes
Executed when parent node succeeds
Failure Nodes
Executed when parent node fails
Always Nodes
Executed regardless of parent status
Node Convergence
Theall_parents_must_converge field controls execution logic:
- False (default): Node runs if ANY parent’s condition is met
- True: Node runs only if ALL parents’ conditions are met
Node Identifiers
Nodes have anidentifier field for tracking:
- Idempotent node creation/updates
- Tracking job nodes back to template nodes
- Client-side workflow management
Workflow Execution
When a workflow launches, it creates a Workflow Job (awx/main/models/workflow.py:637-789):
Execution Flow
Fromdocs/workflow.md:110:
Node Job Creation
When a node’s turn comes, it creates a job:- Node-level prompts (highest priority)
- Workflow job prompts
- Template defaults (lowest priority)
Workflow Variables
Workflows have sophisticated variable handling:Extra Variables
Fromdocs/workflow.md:112:
Artifact Passing
Jobs can pass data to downstream nodes usingset_stats:
Workflow Approvals
Approval nodes pause workflow execution for manual approval (awx/main/models/workflow.py:829-1017):
Creating Approval Nodes
Approval Fields
| Field | Type | Description |
|---|---|---|
name | String | Approval node name |
description | String | Approval description/instructions |
timeout | Integer | Timeout in seconds (0 = no timeout) |
approved_or_denied_by | ForeignKey | User who approved/denied |
timed_out | Boolean | Whether approval timed out |
Approval Actions
Approvals can be approved or denied:Approval Permissions
Fromdocs/workflow.md:82-93:
Users can approve if they are:
- Superuser
- Organization Admin
- Workflow Admin
- Assigned the approval role on the workflow
Nested Workflows
Workflows can contain other workflows:- Reusable workflow components
- Complex multi-level orchestration
- Recursion detection (AWX prevents infinite loops)
docs/workflow.md:72-74:
In the event that spawning the workflow would result in recursion, the child workflow will be marked as failed with a message explaining that recursion was detected.
Job Slicing in Workflows
Workflows support job slicing:job_slice_count > 1 is launched, it creates a workflow job with slice nodes.
API Endpoints
List Workflow Job Templates
Create Workflow Job Template
Create Workflow Node
Link Nodes
Create Approval Node
Launch Workflow
Approve Workflow Approval
Deny Workflow Approval
Workflow Status
Workflow job status is determined by node outcomes: Fromdocs/workflow.md:133-134:
A workflow job is marked as failed if a job spawned by a workflow job fails, without a failure handler. A failure handler is aStatus logic:failureoralwayslink in the workflow job template.
- Successful: All execution paths completed successfully or handled failures
- Failed: At least one node failed without a failure handler
- Canceled: Workflow was canceled
- Error: System error occurred
Permissions
Workflow job templates have these roles (workflow.py:481-504):
- Admin Role: Full control over workflow
- Execute Role: Can launch workflows
- Approval Role: Can approve approval nodes
- Read Role: Can view workflow details
Notifications
Workflows support standard notifications plus approval notifications:- Started: Workflow job starts
- Success: Workflow job succeeds
- Error: Workflow job fails
- Approvals: Approval node needs attention
Best Practices
Design for Failure
Design for Failure
Always add failure handlers for critical paths. Use failure nodes to send notifications, roll back changes, or trigger remediation.
Use Approval Nodes for Gates
Use Approval Nodes for Gates
Add approval nodes before critical operations (production deployments, destructive changes) to ensure human oversight.
Leverage Artifacts
Leverage Artifacts
Use
set_stats to pass data between jobs. This enables dynamic workflows that adapt based on upstream results.Keep Workflows Focused
Keep Workflows Focused
Create smaller, reusable workflows rather than one massive workflow. Use nested workflows for modularity.
Use Convergence Wisely
Use Convergence Wisely
Set
all_parents_must_converge: true only when you need AND logic. The default OR logic is more flexible.Test Thoroughly
Test Thoroughly
Test all paths (success, failure, always) to ensure workflows behave correctly in all scenarios.
Workflow Visualization
Fromdocs/workflow.md:154-174, AWX provides visual workflow execution tracking:
- Root nodes start execution
- Node colors indicate status (pending, running, successful, failed)
- Paths show which branches executed
- DNR (Do Not Run) marks nodes that won’t execute
Related Resources
- Job Templates - Build workflows from job templates
- Projects - Source of playbooks for jobs in workflows
- Inventories - Target systems for workflow jobs
- Credentials - Authentication for workflow jobs