- Objective
- Guide
- Step 1: Create a Job Template
- Step 2: The Workflow Visualizer
- [Step 3: Add the Backup Job Template](#step-3-add-the-backup-job template)
- [Step 4: Add the Configure Banner Job Template](#Step 4-add-the-configure-banner-job-template)
- Step 5: Add the Restore Job Template
- Step 6: Create a converged link
- Step 7: Run the Workflow
- Takeaways
Demonstrate the use of Ansible Tower 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.
-
Click on the Templates link on the left menu.
-
Click on the green + button. Select the Workflow Template.
-
Fill out the the form as follows:
Parameter | Value |
---|---|
Name | Workshop Workflow |
Organization | Default |
Inventory | Workshop Inventory |
- Click on the Save button
-
When you click the SAVE the WORKFLOW VISUALIZER should automatically open. If not click on the blue WORKFLOW VISUALIZER button.
-
By default only a green START button will appear. Click on the START button.
-
The ADD A TEMPLATE window will appear on the right. Select the Backup Job Template that was created in exercise 6 (whatever you named it!). Use the drop down box to select run. Click the green SELECT button.
The
Backup
job template is now a node. Job or workflow templates are linked together using a graph-like structure called nodes. These nodes can be jobs, project syncs, or inventory syncs. A template can be part of different workflows or used multiple times in the same workflow. A copy of the graph structure is saved to a workflow job when you launch the workflow.
-
Hover over the Backup node and click the green + symbol. The ADD A TEMPLATE window will appear again.
-
Select the Configure Banner Job Template. For the Run parameter select On Success from the drop down menu.
-
You will not be able to click SELECT until you pre-populate the prompt. Fill out the PROMPT with your desired banner.
-
A green line should exist between Backup network configurations and Configure Banner
-
Hover over the Backup node (not the Configure Banner node) and click the green + symbol. The ADD A TEMPLATE will appear again.
-
Select the Network-User Job Template. For the Run parameter and select On Success from the drop down menu. Just like the previous step fill out the prompt or it will not let you SELECT the job. Once the SELECT button appears green click it.
-
Hover over the Configure Banner node and click the green + symbol. The ADD A TEMPLATE will appear again.
-
Select the Restore Network Config job template. For the Run parameter select On Failure from the drop down menu.
-
Hover over the Network-User node and click the blue chain symbol.
-
Now, click on the existing Restore Network Config. A ADD LINK window will appear. For the RUN parameter choose On Failure.
-
Click the green SAVE button
-
Return to the Templates window
-
Click the rocket ship to launch the Workshop Workflow workflow template.
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
- created a workflow template that creates a backup, attempts to create a user and banner for all network nodes
- made the workflow robust, if either job template fails it will restore to the specified backup
- launched the workflow template and explored the VISUALIZER
You have completed lab exercise 9
Click here to return to the Ansible Network Automation Workshop