Read this in other languages: English, 日本語, Español.
Demonstrate the use of Automation Controller 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 Add button and select Add workflow template.
Fill out the form as follows:
Parameter | Value |
---|---|
Name | Workshop Workflow |
Organization | Default |
Inventory | Workshop Inventory |
Click on the blue Save button
When you click the Save the Workflow visualizer should automatically open. If not click on the Visualizer tab.
By default only a green Start button will appear. Click on the Start button.
The Add Node window will appear.
Set the Node Type to Job Template
.
Select the Backup
Job Template that was created in exercise 6.
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 Backup network configurations node and click the + symbol. The Add Node window will appear again.
For the Run type select On Success from the drop down menu. Press the blue Next button.
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. |
---|
Select the Network-Banner Job Template.
Fill out the Survey similar to exercise 7.
Click Next and then Save.
A green line should exist between Backup network configurations and Configure Banner
Hover over the Backup network configurations node (not the Configure Banner node) and click the + symbol. The Add Node will appear again.
For the Run type select On Success from the drop down menu. Press the blue Next button.
Select the Network-User Job Template.
Fill out the survey (or just let it default to configure the ansible
user
Click Next and Save
Hover over the Network-Banner node and click the + symbol. The Add Node window will appear again.
Select On Failure for Run type
Select the Network-Restore job template.
Select a rollback date and click Next and Save
Hover over the Network-User node and click the chain symbol.
Now, double click on the existing Network-Restore. A Add Link window will appear. For the RUN parameter choose On Failure.
Now your workflow should look like the following:
Click Save 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