2-5: Creating a Workflow

This module demonstrates the use of Ansible Automation Platform workflows. Workflows allow you to configure a sequence of disparate job templates (or workflow templates) that may or may not share inventory, playbooks, or permissions.

For this exercise we will create a time-stamped backup. If the backup job successfully completes, the workflow will simultaneously configure a banner and a user. If either job template fails we will restore to the time-stamped backup.

Learning objectives

By the end of this module, you will be able to:

  • Create a Workflow Template that chains multiple job templates together

  • Use the Workflow Visualizer to build and connect workflow nodes

  • Configure success and failure paths to implement automated rollback

  • Create converged links between workflow nodes

  • Launch and monitor a workflow execution

Step 1: Create a workflow template

  1. Make sure you are logged in as the admin user.

  2. Click on the Templates link on the left menu.

    Templates link
  3. Click on the blue Create template button and select Create workflow job template.

    Add workflow template button
  4. Fill out the form as follows:

    Parameter Value

    Name

    Workshop Workflow

    Organization

    Red Hat network organization

    Inventory

    Workshop Inventory

  5. Click on the blue Create workflow job template button

Step 2: The Workflow Visualizer

  1. When you clicked the Create workflow job template the Workflow visualizer should automatically open. If not, click on the View workflow visualizer button.

    Visualizer tab link
  2. By default only a blue Add step button will appear. Click on the Add step button.

    Add step button
  3. The Add step window will appear.

    • Set the Node Type to Job Template.

    • Select the Backup network configurations Job Template that was created in exercise 6.

    • Convergence can be left as Any

    • Node alias can be left blank

      Add backup node
    • Click the blue Next button.

    • Click on the blue Finish button

The Backup network configurations job template is now a node. Job or workflow templates are linked together using a graph-like structure called nodes. These nodes can be approvals, jobs, project syncs, inventory syncs, or even other workflows. A template can be part of different workflows or used multiple times in the same workflow.
Backup node configured

Step 3: Add the Configure Banner Job Template

  1. Hover over the three dots on the Backup network configurations node and click the Add step and link link.

    Add step link

    The Add Step window will appear again.

  2. Fill out the following values:

    Parameter Value

    Node Type

    Job Template

    Job template

    Network-Banner

    Status

    Run on success

    Convergence

    Any

    Node alias

    Add second node
Workflows can be configured to run automation jobs when the previous node succeeds, fails, or have it always run no matter what the previous job did. This allows workflows to fix issues or revert the state of a device.
  1. Click the blue Next button and fill out the survey field

    Add network banner job template
  2. Click the blue Next button again, review, and then click the blue Finish button.

  3. A green line should exist between Backup network configurations and Network-Banner

    Banner node

Step 4: Add the Configure Network-User Job Template

  1. Hover over the three dots on the Backup network configurations node and click the Add step and link link. (not the Network-Banner node)

  2. Fill out the following values:

    Parameter Value

    Node Type

    Job Template

    Job template

    Network-User

    Status

    Run on success

    Convergence

    Any

    Node alias

    The Job template list is long. If Network-User does not appear at first, scroll the list or click Load More until you can select it.
    Select network user job
  3. Click the blue Next button and fill out the survey field (feel free to leave the defaults!)

    User survey
  4. Click Next, review then click Finish

    Your workflow should now look similar to the following image:

    Configure user node

Step 5: Add the Network-Restore Job Template

  1. Hover over the Network-Banner node and click the three dots. The Add step and link window will appear again.

  2. Fill out the following values:

    Parameter Value

    Node Type

    Job Template

    Job template

    Network Automation - Restore

    Status

    Run on fail

    Convergence

    Any

    Node alias

    Your form should look similar to the following image:

    Restore form
  3. Click the blue Next button for the Survey step, then choose a rollback date (there may only be one choice if you only ran the backup one time)

  4. Click the blue Next button again, then review and click the Finish button.

    Your workflow should now look similar to the following image:

    Configure restore node
  1. Hover over the Network-User node until a small arrow appears to the right.

    Arrow
  2. Click on the arrow (it will turn gray), and drag it over to the Network Automation - Restore node

    On fail link
  3. Now click on the Run always and change to Run on fail

    Complete workflow
  4. Click Save, then click on the X to exit the visualizer.

    Save button

Step 7: Run the Workflow

  1. Click the Launch button.

    Launch workflow
  2. Watch the Workshop Workflow. At any time during the workflow job you can select an individual job template by clicking on the node to see the status.

You now have a workflow that handles multi-step network changes with built-in rollback — the kind of safety net that makes automation trustworthy enough for production.

Module summary

In this module, you successfully:

  • Built a reusable automation workflow that orchestrates backup, user provisioning, and banner configuration across all network nodes in a single run

  • Made the workflow self-healing — if any change fails, the network automatically rolls back to its last known-good state

  • Validated the end-to-end workflow and used the Workflow Visualizer to verify each stage completed as expected