Create a workflow job template consisting of a branching chain of jobs and launch it using the web UI of automation controller.
Outcomes
Create a workflow job template.
Run a job template when the previously run job template succeeds.
Run a job template when the previously run job template fails.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise, and to ensure that all required resources are available.
This command also creates the project, inventory, and credentials in automation controller so that you can complete the exercise.
[student@workstation ~]$ lab start task-workflow
Instructions
Change to the ~/task-workflow directory.
Run the ios_backup.yml playbook.
In a terminal, change to the ~/task-workflow directory:
[student@workstation ~]$ cd ~/task-workflowRun the ios_backup.yml playbook:
[student@workstation task-workflow]$ ansible-navigator run ios_backup.yml
PLAY [Backup IOS XE configurations] *******************************************
TASK [Backup IOS XE configurations] *******************************************
changed: [iosxe1.lab.example.com]
changed: [iosxe2.lab.example.com]
PLAY RECAP ********************************************************************
iosxe1.lab.example.com : ok=1 changed=1 unreachable=0 failed=0 ...
iosxe2.lab.example.com : ok=1 changed=1 unreachable=0 failed=0 ...Navigate to https://controller.lab.example.com and log in as admin using redhat as the password.
Create a workflow job template named IOS - Add and Verify NTP that uses the Common inventory.
Navigate to https://controller.lab.example.com and log in as admin using redhat as the password.
Navigate to → and then click → . On the next page, add the following details and then click .
| Field | Value |
|---|---|
IOS - Add and Verify NTP
| |
Default
| |
Add a Project Sync node named Synchronize Project to synchronize the IOS_NTP project.
On the workflow visualizer page, click .
On the page, select in the list.
Select the project, scroll down to the field, and enter Synchronize Project in that field.
Click .
On the workflow visualizer page under Synchronize Project, notice the symbol that indicates it is a project sync node.
![]() |
Add a Job Template node that launches the IOS - Add NTP Configuration job template to configure NTP if the Synchronize Project node succeeds.
In the workflow visualizer, hover over the node and click the icon to add a new node.
On the page, select the condition and then click .
Select the job template, scroll down to the field, and enter Configure NTP in that field.
Click . Notice the symbol, which indicates it is a job template node.
You might need to increase the display resolution on the workstation machine, decrease the web browser zoom, or both, in order to see the entire visualizer display screen.
If your mouse has a scroll wheel, then you can use the scroll wheel to zoom in and out of the visualizer.
Add a job template node that launches the IOS - Verify NTP job template to verify that NTP is enabled if the Configure NTP node succeeds.
In the workflow visualizer, hover over the node and then click the icon to add a new node.
On the page, select the condition and then click .
Select the job template, scroll down to the field, and enter Verify NTP in that field.
Click .
Add a job template node that launches the IOS - Revert NTP Configuration job template to revert the NTP configuration if the Configure NTP node fails.
In the workflow visualizer, hover over the node and then click the icon to add a new node.
On the page, select the condition and then click .
Select the job template, scroll down to the field, and enter Revert NTP Configuration in that field.
Click .
Click again in the upper-right corner to save this workflow template.
![]() |
Launch the workflow job template and observe the result.
The Configure NTP node fails and triggers the Revert NTP Configuration node.
Navigate to → .
Click the icon for the workflow job template.
Observe that the node fails and triggers the node.
Click the node and then click the tab to determine the cause of the failure.
The output indicates that the cisco.ios.ios_ntp_globla module is misspelled in the playbook.
Fix the issue with the ntp.yml playbook.
Create the ~/git-repos directory and then change to that directory.
Clone the git repository into the ~/git-repos directory:
[student@workstation task-workflow]$mkdir -p ~/git-repos[student@workstation task-workflow]$cd ~/git-repos[student@workstation git-repos]$git clone \git@git.lab.example.com:student/ntpCloning into 'ntp'... ...output omitted... [student@workstation git-repos]$cd ntp
Edit the ntp.yml file and fix the mistake in the playbook by changing cisco.ios.ios_ntp_globla to cisco.ios.ios_ntp_global as the module name.
The modified playbook must consist of the following content:
---
- name: Configure NTP on IOS managed nodes
hosts: ios
gather_facts: false
tasks:
- name: Configure NTP
cisco.ios.ios_ntp_global:
config:
logging: true
source: GigabitEthernet0/1
servers:
- server: 10.10.100.1
version: 2
- server: 10.10.200.1
version: 2
state: overriddenAdd, commit, and push the ntp.yml file:
[student@workstation ntp]$git add ntp.yml[student@workstation ntp]$git commit -m "Fix typo in playbook"[student@workstation ntp]$git push
Launch the template through the automation controller web UI and verify that it now runs successfully.
The Configure NTP node completes successfully and launches the Verify NTP node.
Navigate to → .
Click the icon for the workflow job template.
The first step updates the project with the changes you have committed. Observe that this time the job template completes successfully and as a result the job template is launched.
If you updated the ntp.yml playbook using VS Code, then click → in VS Code to close the /home/student/git-repos/ntp directory, or run the cd command in a GNOME terminal to return to the student home directory:
[student@workstation ntp]$ cd