AnsiblePilot — Master Ansible Automation

AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.

Popular Topics

About Luca Berton

Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.

AAP 2.6 Workflow Templates: Advanced Multi-Step Automation Guide

By Luca Berton · Published 2024-01-01 · Category: troubleshooting

Master AAP 2.6 Workflow Templates for multi-step automation pipelines. Build complex workflows with approval nodes, convergence, inventory overrides, and error handling. Complete examples for enterprise deployment patterns.

What Are Workflow Templates in AAP 2.6?

Workflow Templates in Ansible Automation Platform 2.6 let you chain multiple job templates, project syncs, inventory updates, and approval gates into a single automated pipeline. Unlike running individual job templates, workflows provide branching logic, error handling, convergence points, and variable passing between steps.

Workflows are essential for enterprise automation patterns like multi-tier application deployments, change management processes, and disaster recovery procedures.

Creating a Basic Workflow

Via the Platform Gateway UI Navigate to Automation Controller → Templates → Add → Add workflow template Configure the workflow template settings: • Name: Descriptive name for the workflow • Organization: The owning organization • Inventory: Default inventory (can be overridden per node) • Labels: Optional tags for filtering Open the Workflow Visualizer to add nodes and connections

Via the ansible.platform Collection

Workflow Node Types

AAP 2.6 supports five types of workflow nodes:

| Node Type | Purpose | Use Case | |-----------|---------|----------| | Job Template | Run a playbook | Deploy, configure, test | | Workflow Job Template | Nest another workflow | Reusable sub-workflows | | Project Sync | Update project from SCM | Ensure latest code before deploy | | Inventory Source Sync | Refresh dynamic inventory | Get current cloud hosts | | Approval | Pause for human approval | Change management gates |

Approval Nodes

Approval nodes pause workflow execution until an authorized user approves or denies:

Branching Logic: Success, Failure, Always

Each workflow node connection has a condition: • On Success (green): Next node runs only if the previous succeeded • On Failure (red): Next node runs only if the previous failed • On Always (blue): Next node runs regardless of previous result

Example: Deploy with Rollback

Convergence

Convergence lets a node wait for multiple parent nodes to complete before executing. This is useful when parallel tasks must all finish before proceeding:

The Verify Connectivity node has convergence: all — it waits for all three parent nodes to succeed before running.

Set convergence in the UI via the node settings, or via API:

Passing Variables Between Nodes

Workflow nodes can pass data using set_stats in playbooks:

Subsequent nodes in the workflow can access app_version and deploy_timestamp as extra variables.

Artifact Passing Example

Inventory and Credential Overrides

Override the default inventory or credentials per workflow node:

Surveys for Runtime Input

Add surveys to collect input at launch time:

Scheduling Workflows

Schedule workflows to run on a recurring basis:

Enterprise Workflow Patterns

Pattern 1: Rolling Application Update

Pattern 2: Multi-Cloud Provisioning

Pattern 3: Compliance Audit and Remediation

Monitoring Workflow Execution

Track workflow status via API:

Best PracticesKeep workflows modular — use nested workflows for reusable sub-processes • Set timeouts on approval nodes — prevent workflows from hanging indefinitely • Use set_stats sparingly — only pass essential data between nodes • Always include failure paths — rollback and notification nodes for every critical step • Name nodes descriptively — use identifiers that explain the step's purpose • Test in staging first — use inventory overrides to run the same workflow in staging before production • Version control workflows — export workflow definitions as YAML and store in Git

FAQ

Can workflows call other workflows?

Yes. You can add a Workflow Job Template node inside another workflow. This lets you create reusable sub-workflows — for example, a "Deploy Application" workflow nested inside both a "Full Release" and "Hotfix" workflow.

What happens if an approval node times out?

If the configured timeout expires without approval or denial, the approval node is marked as timed out (failed). Any nodes connected via the failure path will execute.

Can I retry a failed workflow from the point of failure?

Not directly from the UI. You can relaunch the entire workflow, but it re-runs from the beginning. Design workflows with idempotent steps so re-running is safe. Use set_stats to track progress if needed.

How many nodes can a workflow have?

There is no hard-coded limit on workflow nodes, but very large workflows (100+ nodes) can impact visualization performance and become difficult to maintain. Break large workflows into nested sub-workflows.

Can different nodes use different credentials?

Yes. Each workflow node can override the workflow's default credentials with node-specific credentials. This is essential for multi-environment deployments where staging and production use different SSH keys or vault passwords.

Conclusion

Workflow Templates transform AAP from a job runner into a full automation orchestration platform. By combining branching logic, convergence, approval gates, and variable passing, you can model complex enterprise processes as repeatable, auditable automation pipelines.

Related ArticlesAAP 2.6 Architecture and Components: Complete GuideAAP 2.6 RBAC and Gateway APIAAP 2.6 Event-Driven Ansible EnhancementsAAP 2.6 Configuration as Code with ansible.platformAAP 2.6 Security Best Practices

Category: troubleshooting

Browse all Ansible tutorials · AnsiblePilot Home