Module 9: Creating a Workflow Job Template
A guide to connecting all the dots by linking multiple playbooks with conditional logic in a workflow.
Lab Briefing
So far, each Job Template runs a single playbook independently. A Workflow Job Template lets you connect multiple Job Templates into a single automated pipeline — with conditional logic, parallel execution, and error handling built in.
Lab Guide
A Workflow Job Template orchestrates multiple automation steps in a defined order. You design the flow graphically using the Workflow Visualizer, where each step can run on success, on failure, or unconditionally after the previous one.
Workflows can orchestrate various node types, including:
-
Job templates
-
Other workflow job templates
-
Project syncs
-
Inventory source syncs
|
As noted in the Job Templates challenge, a Workflow Job Template is different from both a Job Template (which runs a single playbook) and a Jinja2 template (which generates dynamic file content inside playbooks). These are three separate concepts. |
|
Reminder that the credentials to log in to the automation controller are:
|
Task 1: Create a Workflow Template
First, you will create the main workflow that will contain your job templates.
-
Navigate to the Templates page.
In the left navigation menu, go to Automation Execution → Templates.
-
Create a new workflow job template.
Click the blue Create template button and select Create workflow job template.
-
Enter the workflow details.
Fill out the form with the following information:
-
Name:
Your first workflow -
Description:
Create a Workflow from previous Job Templates -
Organization:
Default -
Inventory:
Lab-Inventory
-
-
Save the workflow.
Leave all other fields as they are and click the blue Create workflow job template button.
Task 2: Add the First Step in the Workflow Visualizer
After saving, you will be taken to the Workflow Visualizer, where you can build your workflow graphically.
-
Add the first step.
Click the Start button to add the first node.
-
Configure the first node.
In the Add step side panel that appears, configure the node as follows:
-
Node Type:
Job Template(default) -
Job Template:
Install Apache -
Convergence:
Any -
Node alias:
apache101(This is a simple label for the node in the visualizer)
-
-
Save the node.
Click Next, review the details, and then click Finish.
Task 3: Add a Conditional Step
Next, you will add a second step that runs only if the first step is successful.
-
Add a new linked step.
Hover over the
apache101node, click the + icon, and select Add node. -
Configure the second node.
In the side panel, configure the new node as follows:
-
Node Type:
Job Template(default) -
Job Template:
Extended services -
Run:
On Success -
Convergence:
Any -
Node alias:
extended201
-
-
Save the node.
Click Next, review the details, and then click Finish.
Task 4: Add a Parallel Step
Now, add a third step that also runs after the first step, in parallel with the second step.
-
Add another linked step from the first node.
Hover over the
apache101node again, click the + icon, and select Add node. -
Configure the third node.
-
Node Type:
Job Template(default) -
Job Template:
Set motd -
Run:
On Success -
Convergence:
Any -
Node alias:
motd201
-
-
Save the node.
Click Next, review the details, and then click Finish.
-
Save the entire workflow.
Finally, click the blue Save button in the top right corner of the Visualizer. If you miss this step, you will lose your changes!
Task 5: Launch the Workflow
Now you are ready to run your multi-step workflow.
-
Launch the workflow from the Visualizer.
While still in the Workflow Visualizer, click the Launch button in the top right.
-
Observe the execution.
You will be taken to a real-time view of the workflow execution. You will notice the
apache101job runs first. Once it succeeds, both theextended201andmotd201jobs will run in parallel. A green checkmark (✅) on each node indicates a successful run. -
(Alternative) Launch from the Templates list.
You can also launch the workflow by navigating back to the Templates page and clicking the Launch icon (🚀) next to
Your first workflow.
Controller as Code Alternative
The workflow you built graphically in the Visualizer — including the node connections and parallel execution paths — is fully expressible as YAML using simplified_workflow_nodes.
YAML Definition
From controller-as-code/configs/module-09/controller_objects.yml:
---
controller_workflows:
- name: Your first workflow
description: Create a Workflow from previous Job Templates
organization: Default
inventory: Lab-Inventory
simplified_workflow_nodes:
- identifier: apache101
unified_job_template: Install Apache
success_nodes:
- extended201
- motd201
- identifier: extended201
unified_job_template: Extended services
- identifier: motd201
unified_job_template: Set motd
Notice how the structure maps directly to what you built in the Visualizer:
-
apache101is the starting node (Install Apache) -
success_nodesdefines the conditional links — bothextended201andmotd201run in parallel on success -
Each
identifiercorresponds to the Node alias you set in the UI
Troubleshooting
If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.