Read this in other languages: English, 日本語, Español.
Demonstrate the use of Ansible Automation Platform workflow . 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.
Make sure you are logged in as the admin user.
Click on the Templates link on the left menu.
Click on the blue Create template button and select Create workflow job template.
Fill out the form as follows:
Parameter | Value |
---|---|
Name | Workshop Workflow |
Organization | Red Hat network organization |
Inventory | Workshop Inventory |
Click on the blue Create workflow job template button
When you clicked the Create workflow job template the Workflow visualizer should automatically open. If not click on the View workflow visualizer button.
By default only a blue Add step button will appear. Click on the Add step button.
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
Click the blue Next button.
Click on the blue Finish button
Note:
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.
Hover over the three dots ⋮ on the Backup network configurations
node and click the Add step and link link.
The Add Step window will appear again.
Fill out the following values:
Parameter | Value |
---|---|
Node Type | Job Template |
Job template | Network-Banner |
Status | Run on success |
Convergence | Any |
Node alias |
Note:
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.
Click the blue Next button and fill out the survey field
Click the blue Next button again, review, and then click the blue Finish button.
A green line should exist between Backup network configurations
and Network-Banner
Hover over the three dots ⋮ on the Backup network configurations
node and click the Add step and link link. (not the Network-Banner
node)
Fill out the following values:
Parameter | Value |
---|---|
Node Type | Job Template |
Job template | Network-User |
Status | Run on success |
Convergence | Any |
Node alias |
Click the blue Next button and fill out the survey field (feel free to leave the defaults!)
Click Next, review then click Finish
Your workflow should now look similar to the following image:
Hover over the Network-Banner node and click the three dots ⋮ The Add step and link window will appear again.
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 forum should look similar to the following image:
Click the blue Next button for the Survey step, then choose a rollback date (Note: there may only be one choice if you only ran the backup one time)
Click the blue Next button again, then review and click the Finish button.
Your workflow should now look similar to the following image:
Hover over the Network-User
node until a a small arrow appears to the right.
Click on the arrow (it will turn gray), and drag it over to the Network Automation - Restore
node
Now click on the Run always and change to Run on fail
Click Save, then click on the X to exit the visualizer.
Click Launch button.
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 have
You have completed lab exercise 9. This concludes the Network Automation workshop. Thank you for attending!
For additional supplemental exercises check out Supplemental Exercises
Click here to return to the Ansible Network Automation Workshop