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.

Workflow Job Templates list view

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:

  • Username: admin

  • Password: ansible123!

Task 1: Create a Workflow Template

First, you will create the main workflow that will contain your job templates.

  1. Navigate to the Templates page.

    In the left navigation menu, go to Automation ExecutionTemplates.

  2. Create a new workflow job template.

    Click the blue Create template button and select Create workflow job template.

  3. 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

  4. 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.

  1. Add the first step.

    Click the Start button to add the first node.

  2. 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)

  3. 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.

  1. Add a new linked step.

    Hover over the apache101 node, click the + icon, and select Add node.

  2. 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

  3. 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.

  1. Add another linked step from the first node.

    Hover over the apache101 node again, click the + icon, and select Add node.

  2. Configure the third node.

    • Node Type: Job Template (default)

    • Job Template: Set motd

    • Run: On Success

    • Convergence: Any

    • Node alias: motd201

  3. Save the node.

    Click Next, review the details, and then click Finish.

  4. 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.

  1. Launch the workflow from the Visualizer.

    While still in the Workflow Visualizer, click the Launch button in the top right.

  2. Observe the execution.

    You will be taken to a real-time view of the workflow execution. You will notice the apache101 job runs first. Once it succeeds, both the extended201 and motd201 jobs will run in parallel. A green checkmark (✅) on each node indicates a successful run.

  3. (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:

  • apache101 is the starting node (Install Apache)

  • success_nodes defines the conditional links — both extended201 and motd201 run in parallel on success

  • Each identifier corresponds to the Node alias you set in the UI


Next Steps

Press the blue Next button below to proceed to the next challenge.

Troubleshooting

If you have encountered an issue or have noticed something not quite right, please open an issue on GitHub.