Overview
This How To will cover using both the Ansible Tower module along side the Ansible Tower CM Framework to meet some specific scenarios.
NOTE: If you require day 2 operations for Ansible Jobs then this will only work by using the Ansible Tower Module and will not work with the Ansible Tower CM Framework.
Scenarios that this solution could cover
- Multi VM blueprint that have VM's dependent on each other (Multi tier potentially) and you may need to:
- Have independent playbooks run at the end of deploying each of the VM's (Allowing deployment in your dependent order)
- Have independent playbooks run at the end of deploying each of the VM's as well as having a common playbook run across all VM's on your blueprint
- A blueprint with nested blueprints that are dependent on each other (Multi tier potentially) and you may need to:
- Have independent playbooks run at the end of deploying each of the VM's in the nest blueprints (Allowing deployment in your dependent order)
- Have independent playbooks run at the end of deploying each of the VM's as well as having a common playbook run across all VM's on your blueprint
Considerations
- Have licensed the Ansible Tower module
- Have configured your Ansible Tower and is fully functional
- Have configured Ansible Tower AND Ansible Tower CM Framework modules ready to use
- Are running vRA Enterprise (Ansible Tower CM Framework will not work on vRA Advanced)
- Have setup your blueprints as mentioned above and are ready configure Ansible Tower / CM Framework
Scenarios
Scenario 1
Module for this scenario: Ansible Tower
- Multi VM Blueprint
- Different Ansible Tower Job on each VM
- Can run at the end of deployment on all VM's
Scenario 2
Module for this scenario: Ansible Tower CM Frame Work
- Multi VM Blueprint
- Different Ansible Tower job on each VM
- VM's are dependent and Ansible Tower MUST run in a specific VM Order
Scenario 3
Module for this scenario: Ansible Tower AND Ansible Tower CM Framework
- Multi VM Blueprint
- Different Ansible Tower job on each VM
- VM's are dependent and Ansible Tower MUST run in a specific VM Order
- A single Ansible tower job must run on all machines upon blueprint completion
Scenario 4
Module for this scenario: Ansible Tower AND Ansible Tower CM Framework
- Nested Blueprint
- Different Ansible Tower job on each VM / blueprint
- Blueprints are dependent on each other and Ansible Job MUST run at the end of each deployed VM
- EXTRA: Potential to run an Ansible Tower job across all nested blueprints
- The behavior is that it will run on the completion of the nested blueprint and not at the completion of the outer blueprint
Procedure
Scenario 1
- Configure your blueprint with multiple VM's on the canvas
- On each of your VM's. Add the property group for the Ansible Tower Profile you wish to run and also don't forget to configure any other modules/properties you need(ie; Naming, IPAM and any other property groups/modules you wish to configure)
- Once completed save your blueprint. Your blueprint will execute and run Ansible Tower upon blueprint completion
Scenario 2
- Configure your blueprint with multiple VM's on the canvas
- Link your VM's in order of dependency. In this example, we will say Linux_VM_3 Depends on Linux_VM_2 which depends on Linux_VM_1
- On the left side under categories, click on Configuration Management
- Below the categories section, you will see Ansible listed click this and drag it onto your First VM
- Once you have the item dragged onto a VM, it will become available to configure. You can change the ID from Ansible_# to any label without spaces
- Click on Details and configure the Ansible Tower information. Select the Ansible Tower Endpoint, Org, Project and your provision/de-provision templates
NOTE: For more information on Ansible Tower CM Framework, See the links at the end of this document - Repeat steps 4 → 6 for the remaining VM's
- Once completed Click on Finish
- Don't forget to publish and allocate your blueprint. Now when you deploy this blueprint, it will run at the end of each VM build making sure servers are deployed in order and ansible playbooks are run before the next machine deploys.
Scenario 3
- Configure your blueprint with multiple VM's on the canvas
- Link your VM's in order of dependency. In this example, we will say Linux_VM_3 Depends on Linux_VM_2 which depends on Linux_VM_1
- On the left side under categories, click on Configuration Management
- Below the categories section, you will see Ansible listed click this and drag it onto your First VM
- Once you have the item dragged onto a VM, it will become available to configure. You can change the ID from Ansible_# to any label without spaces
- Click on Details and configure the Ansible Tower information. Select the Ansible Tower Endpoint, Org, Project and your provision/de-provision templates
NOTE: For more information on Ansible Tower CM Framework, See the links at the end of this document - Repeat steps 4 → 6 for the remaining VM's
- Now you want to add a global Ansible Job to run against all machines in your blueprint and this will run at the completion of the blueprint. Click on the Gear next to your blueprint name at the top
- In the Blueprint Properties, click on Properties
- Under Property Groups, click on Add
- From the list, find the Ansible Tower Profile you want to add and place a check next to the name (1) then click on OK (2)
- Once completed Click on Finish
- Don't forget to publish and allocate your blueprint. Now when you deploy this blueprint, it will run at the end of each VM build making sure servers are deployed in order and ansible playbooks are run before the next machine deploys. Once the Blueprint completes, it will run the global Tower Job you have added across all servers in the blueprint.
Scenario 4
- Configure the nested blueprints with your Ansible tower CM Framework jobs on each VM
NOTE: Alternatively, you can have two blueprints that do not have ANY Ansible Tower CM Framework configurations attached, for this example, I will deploy my nested blueprints without any configuration for Ansible attached.- No Anisble Tower CM Framework on your nested blueprint
- With Ansible Tower CM Framework on your blueprint
- No Anisble Tower CM Framework on your nested blueprint
- Create your outer blueprint and drag and drop your nested blueprints onto your canvas. For this example I will put a dependency of one blueprint on another
- On the left side under categories (1), click on Configuration Management (2) and then highlight Ansible (3)
- Drag the Ansible component onto your nested VM blueprint and configure as required for each
- If you are opting to run an Ansible Tower job on the outer blueprint you can click on the gear next to Edit Blueprint
- Click on Properties (1) → Property Groups (2) → Add
- Find the SovLabs-AnsibleTowerProfile- profile you want to add, select it by placing a check next to it (1) and click on OK (2)
- Click OK
- Click on Finish to complete your nested blueprint
- Don't forget to publish and allocate your blueprint. Now when you deploy this blueprint, it will run the Ansible Tower CM Framework on each VM being deployed and once each nested blueprint completes it will run the global Ansible Tower job.
Additional information
SovLabs Ansible Tower CM Framework Document : http://docs.sovlabs.com/latest/vmware-vra7x-plugin/modules/configuration-mgmt/ansible-tower-cm-framework/
SovLabs Ansible Tower Document : http://docs.sovlabs.com/latest/vmware-vra7x-plugin/modules/configuration-mgmt/ansible-tower/
0 Comments