Automation, Orchestration & DevOps > Class 9: Basic BIG-IP Configuration Management with Ansible > Section 4 - Ansible Tower F5 Exercises Source | Edit on
Exercise 4.2: Creating a Workflow¶
Objective¶
Demonstrate the use of Ansible Tower workflow for F5 BIG-IP. 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 use workflow to achieve the same as the create_vs job template, while at the same time adding failure handling for each job.
Guide¶
Step 0: Prepare Job Templates¶
Following what we learned from Lab 4.2
, create the following job
templates with the respective playbook:
Job template Name | Playbook |
---|---|
Create node | create_node.yml |
Create pool | create_pool.yml |
Create virtual server | create_virtualserver.yml |
Rollback node deploy | rollback_node_deploy.yml |
Rollback pool deploy | rollback_pool_deploy.yml |
Rollback virtual server deploy | rollback_vs_deploy.yml |
Apart from above, we use the same template parameters as Lab 4.2
for
each of the above templates,:
Parameter | Value |
---|---|
Name | |
Job Type | Run |
Inventory | Workshop Inventory |
Project | Workshop Project |
Playbook | |
Credential | Workshop Credential |
Here is one example of templates: Create node:

create node¶
Step 1: Create a Workflow Template¶
- 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

workflow creation¶
Step 2: The Workflow Visualizer¶
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
Create node
Job Template that was created in previous step(whatever you named it!).add a template¶
The
Create node
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.
Step 3: Add Create node Job Template¶
Select the ``Create node`` Job Template. Use the only run option of
Always
. Click the green SELECT button.remove pool¶
Step 4: Add Create pool Job Template¶
Hover over the ``Create node`` node and click the green + symbol. The ADD A TEMPLATE will appear again.
- Select the ``Create pool`` job template. For the Run parameter select On Success from the drop down menu.
Click the green SELECT button.
upgrade server¶
Step 5: Add Create virtual server Job Template¶
Hover over the ``Create pool`` node and click the green + symbol. The ADD A TEMPLATE will appear again.
- Select the ``Create virtual server`` job template. For the Run parameter select On Success from the drop down menu.
Click the green SELECT button.
add pool¶
Step 6: Rollback node deploy Template¶
Hover over the Create node node and click the green + symbol. The ADD A TEMPLATE will appear again.
- Select the Rollback node deploy job template. For the Run parameter select On Failure from the drop down menu.
Click the green SELECT button.
configure restore node¶
Step 7: Rollback pool deploy Template¶
Hover over the Create pool node and click the green + symbol. The ADD A TEMPLATE will appear again.
- Select the Rollback pool deploy job template. For the Run parameter select On Failure from the drop down menu.
Click the green SELECT button.
configure restore node¶
Step 8: Rollback virtual server Template¶
Hover over the Create virtual server node and click the green + symbol. The ADD A TEMPLATE will appear again.
- Select the Rollback virtual server deploy job template. For the Run parameter select On Failure from the drop down menu.
Click the green SELECT button.
configure restore node¶
Step 9: Run the Workflow¶
Return to the Templates window
Click the rocket ship to launch the Workshop Workflow workflow template.
workflow job launched¶
At any time during the workflow job you can select an individual job template by clicking on the node to see the status.
Step 9: Error Handling¶
Next, we will show a failed job template for the workflow, where a
rollback is performed. 1. Click on the Templates
link on the left
menu.

- Select template
Create virtual server
- Change the PLAYBOOK from
create_virtualserver.yml
tocreate_virtualserver_error.yml
The create_virtualserver_error.yml
playbook will configure the
Virtual Server, but tries to attach a pool http_pool_error
which
does not exist. Therefore, the addition of virtual server will fail, and
the Rollback virtual server deploy
node will be triggered.
Scroll down and click the green
save
button.Return to the Templates window, cick the rocket ship to launch the Workshop Workflow workflow template again.
error handling link¶
Login to the F5 BIG-IP with your web browser to see what was configured.
Click on Local Traffic. then click on Virtual Servers,
Pools, and Nodes. You should see that
Rollback virtual server deploy
kicked in and removed all BIG-IP
configuration.
Finally, we revert the configuration, and make it ready for next lab: 7.
Click on the Templates link on the left menu. Select template
Create virtual server
8. Change the PLAYBOOK back to
create_virtualserver.yml
9. Scroll down and click the green save
button. 10. Return to the Templates window, cick the rocket ship to
launch the Workshop Workflow workflow template again.
Takeaways¶
You have - created a workflow template that create node, a pool, and virtual server - made the workflow robust, if either job template fails it will rollback the deployment - launched the workflow template and explored the VISUALIZER
Complete¶
You have completed lab exercise 4.2
Click here to return to the Ansible Network Automation Workshop