Ansible Tower
9 minute read
To learn more about this OneFuse module, refer to Ansible Tower.
Prerequisites
- Configure OneFuse Property Set(s) and OneFuse Module Policies.
- Run OneFuse Configuration per Cloud Assembly Organization per Installation and setup.
- Review an overview on OneFuse modules with Aria Automation 8.1+/Cloud.
- Create a new Cloud Template (if none exist) or determine which existing Cloud Template(s) will utilize this OneFuse Module.
Steps
- Know the name of the OneFuse Endpoint created via OneFuse Configuration (see Installation and setup).
- Determine which OneFuse Ansible Tower Policies to run for this Cloud Template.
- Determine when to run each OneFuse Ansible Tower Policy for the deployment provisioning lifecycle with vRA’s EBS.
- Update the Cloud Template to add in necessary vRA Properties and/or add in the Custom Resource to invoke OneFuse Ansible Tower Policies.
- Deploy the Cloud Template to provision a vRA Deployment and run Provision Job Template(s).
- Destroy the vRA Deployment to run Deprovision Job Template(s), if any.
Update the Cloud Template
- Log in to vRA > Cloud Assembly.
- Select the Design tab from the top menu bar.
- Select the Cloud Templates tab from the left menu.
- Edit the Cloud Template and perform the steps below.
Option 1: add in necessary vRA properties
The following vRA Properties need to be added to the Cloud Template’s Code section under the Resource(s) of interest.
1. Trigger vRA EBS for Ansible Tower:
| Property name format | Property value |
|---|---|
| See options below | 'true' |
Option 1. Trigger only specific individual EBS state(s):
This method is recommended to decrease provision time since it will only run the execute for the states defined. This also offers a quicker way to turn on/off the Policy for testing.
OneFuse_AnsibleTowerPolicy_Trigger_<EBSExecutionString>- Replace
<EBSExecutionString>with an appropriate Event Broker Subscription execution string.
OR:
Option 2. Trigger all EBS state(s):
This overrides the individual EBS Execution triggers if they are present.
OneFuse_AnsibleTowerPolicy_Trigger
2. Call Ansible Tower Policy for a vRA EBS:
| Property name format | Property value format |
|---|---|
OneFuse_AnsibleTowerPolicy_<EBSExecutionString>_<CustomID> |
'<OneFuse Endpoint Name>:<Ansible Tower Policy Name>:<Ansible Tower Host>:<Ansible Tower Limit>' |
- Replace
<EBSExecutionString>with an appropriate Event Broker Subscription execution string. - Replace
<CustomID>with a unique, user-defined friendly label. <Ansible Tower Host>(Optional): specific Hostname (FQDN) or IP Address of the Host to add to the Ansible Tower Inventory.<Ansible Tower Limit>(Optional): valid Limit definition to pass to Ansible Tower. Can be a specific Hostname (FQDN), IP Address, or any valid Limit pattern. See Patterns: targeting hosts and groups.
It is recommended to insert a required filter for the <Ansible Tower Limit>. When left blank, it will execute an Ansible Tower Job on the entire Ansible Host Inventory.
Example YAML:
# Execute 2 OneFuse Ansible Tower Policies
# <EBSExecutionString> is replaced with ComputeProvisionPostLate
# -- Property Name
# <CustomID> is replaced with 001Apache and 002BasicSetup
# -- Property Value
# <OneFuse Endpoint Name> is onefuse
# <Ansible Tower Policy Name> is linux_Apache and linux_setup
# <Ansible Tower Host> is {{ OneFuse_VmNic0.fqdn }}
# <Ansible Tower Limit> is {{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
name: Simple Example
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: CentOS7
flavor: small
count: 1
OneFuse_AnsibleTowerPolicy_Trigger_ComputeProvisionPostLate: 'true' # Trigger Property
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_001Apache: 'onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_002BasicSetup: 'onefuse:linux_setup:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
Add additional vRA Properties for Ansible Tower policy execution retry count
| Property Name Format | Property Value |
|---|---|
OneFuse_AnsibleTowerBehavior_ExecutionRetryCount |
'<OneFuse Ansible Policy Execution Count in number>': specifies how many times the workflow should retry. Default value is 1 if not provided. |
OneFuse_AnsibleTowerBehavior_RetrySleepSeconds |
'<Sleep Time between retries in Seconds>': adds sleep time between retries. Default value is 120 seconds if not provided. |
Note: Additional trigger for Ansible Tower policy is not supported.
Ansible Tower EBS execution states
EBSExecutionString refers to a specific vRA EBS State for the OneFuse Module’s policy to execute on. Replace the <EBSExecutionString> variable with one of the following EBS Execution States:
Note: Additional trigger for Ansible Tower policy is not supported.
| EBS Execution | Subscription State | EBS Priority | EBS Name |
|---|---|---|---|
| Provision | |||
| ComputeAllocationPre | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeAllocationPreEarly |
| ComputeAllocationPre | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeAllocationPreLate |
| NetworkConfigure | Early | 15 | OneFuse_Provision_AnsibleTower_NetworkConfigureEarly |
| NetworkConfigure | Late | 2005 | OneFuse_Provision_AnsibleTower_NetworkConfigureLate |
| ComputeProvisionPre | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeProvisionPreEarly |
| ComputeProvisionPre | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeProvisionPreLate |
| ComputeProvisionPost | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeProvisionPostEarly |
| ComputeProvisionPost | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeProvisionPostLate |
| Deprovision | |||
| ComputePreRemoval | - | 15 | OneFuse_De-Provision_AnsibleTower |
List of vRA EBS Trigger Properties:
OneFuse_AnsibleTowerBehavior_FailOnBlankHost: 'true'
OneFuse_AnsibleTowerBehavior_FailOnBlankLimit:'true'
CustomID
CustomID refers to a user-specified text string to identify and can set an order of precedence for execution when calling multiple Policies for the OneFuse Module in the same vRA EBS State.
Replace the <CustomID> variable with a unique custom identifier:
- Format is alphanumeric characters only
A-Z, a-z, 0-9. No spaces, underscores, hyphens, or special characters. - Must be unique across all EBS Execution Strings for the OneFuse Module on the specific VM for the Blueprint/Cloud Template.
- Is reusable either between different VM components of the Blueprint/Cloud Template canvas or between different Blueprints/Cloud Templates.
Specify sorting with CustomID:
When executing multiple different OneFuse Module Policies in the same EBS State, prefix the <CustomID> with a numeric value (for example, 001, 002, etc.).
The <CustomID> is sorted prior to executing the OneFuse module’s policies.
# Execute 2 OneFuse Ansible Tower Policies
# <EBSExecutionString> is replaced with ComputeProvisionPostLate
# -- Property Name
# <CustomID> is replaced with 001Apache and 002BasicSetup
# -- Property Value
# <OneFuse Endpoint Name> is onefuse
# <Ansible Tower Policy Name> is linux_Apache and linux_setup
# <Ansible Tower Host> is {{ OneFuse_VmNic0.fqdn }}
# <Ansible Tower Limit> is {{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
name: Simple Example
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: CentOS7
flavor: small
count: 1
OneFuse_AnsibleTowerPolicy_Trigger_ComputeProvisionPostLate: 'true' # Trigger Property
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_001Apache: 'onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_002BasicSetup: 'onefuse:linux_setup:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
Additional helpful vRA Properties
Purpose: Relate OneFuse Policy executions from different OneFuse Modules together with a Tracking ID.
| Property | Value Format |
|---|---|
OneFuse_Tracking_Id |
A GUID (globally unique identifier) that links OneFuse Policy Executions and the resulting Managed Objects together for a given resource on a deployment. The first OneFuse Module Policy execution will populate this vRA property and it will be passed into other OneFuse Modules automatically. When a Tracking ID is not provided, a Tracking ID gets generated for the Policy execution. Learn more about OneFuse Tracking ID. |
Purpose: Reference a specific NIC’s values to get hostname, IP Address, etc.
| Property Format | Example |
|---|---|
OneFuse_VmNic<#>.<value>: replace <#> with a number from 0 to 9, one for each NIC. Replace <value> with an appropriate key: dnsSuffix, fqdn, gateway, hostname, ipAddress, macAddress, netmask, network, subnet, target. |
For most use cases, NIC 0 is the primary network interface and the target hostname is a Fully Qualified Domain Name (FQDN): OneFuse_VmNic0.dnsSuffix, OneFuse_VmNic0.fqdn, OneFuse_VmNic0.hostname, OneFuse_VmNic0.ipAddress, OneFuse_VmNic0.target (when DNS Suffix is provided, will be the FQDN; otherwise, will be the hostname without domain). |
Error handling
You can control whether or not the vRO workflow should error out or fail in case the “host” and/or “limit” part of the Policy custom property renders to blank.
Use the properties OneFuse_AnsibleTowerBehavior_FailOnBlankHost and OneFuse_AnsibleTowerBehavior_FailOnBlankLimit to control behavior.
OneFuse_AnsibleTowerBehavior_FailOnBlankHost: 'true'
OneFuse_AnsibleTowerBehavior_FailOnBlankLimit:'true'
If these properties are set to true as shown above, and the corresponding field renders to either undefined, null, or an empty string, OneFuse instructs vRealize Orchestrator to fail the workflow if the host and/or limit field renders to a blank value. The corresponding workflow will fail before Jobs are executed in OneFuse/Ansible Tower.
Note: These properties are available for use only in vRA Upstream Provider package versions 1.4.0.14248426 and 9.4.7.14248328 or later.
Example Cloud Template YAML code
# Execute 2 OneFuse Ansible Tower Policies
# <EBSExecutionString> is replaced with ComputeProvisionPostLate
# -- Property Name
# <CustomID> is replaced with 001Apache and 002BasicSetup
# -- Property Value
# <OneFuse Endpoint Name> is onefuse
# <Ansible Tower Policy Name> is linux_Apache and linux_setup
# <Ansible Tower Host> is {{ OneFuse_VmNic0.fqdn }}
# <Ansible Tower Limit> is {{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
name: Simple Example
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: CentOS7
flavor: small
count: 1
OneFuse_AnsibleTowerPolicy_Trigger_ComputeProvisionPostLate: 'true' # Trigger Property
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_001Apache: 'onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
OneFuse_AnsibleTowerPolicy_ComputeProvisionPostLate_002BasicSetup: 'onefuse:linux_setup:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}'
Option 2: Add in Custom Resource for OneFuse Ansible Tower
Review OneFuse custom resources before using this method.
- From the Resource Types navigation, expand Custom Resources.
- Drag-and-drop
OneFuse:AnsibleTower_v1to the Cloud Template canvas. - In the Code tab, provide values for the following properties:
| Parameter Name | Required? | Notes |
|---|---|---|
endpointName |
Required | OneFuse Endpoint Name in vRA. Refer to Managing endpoints. |
policyName |
Required | OneFuse Module Policy Name (string). |
templateProperties |
Optional | Additional properties that are referenced within the Policy. JSON format. |
trackingId |
Optional | Tracking ID (string) to link multiple OneFuse Policy Executions and resulting OneFuse Managed Objects together. If none is passed, one gets generated by OneFuse for that specific Policy Execution. |
Ansible Tower specific parameters:
| Parameter Name | Required? | Notes |
|---|---|---|
hosts |
Optional | List of specific hosts to execute against. Similar to limit, but will match against exact hostnames. |
limit |
Optional | Ansible Tower Policy Limit. Pattern matches hosts. For example, dev-* will match all hosts that start with “dev-”. |
Provision
Deploy a Cloud Template with the OneFuse Ansible Tower module configured. Ansible Tower Provisioning Job Template(s) will run on the resource(s) and add the host to the Ansible Tower Inventory (if configured).
Outputs
The following vRA Property will have the generated OneFuse Ansible Tower Managed Object as a JSON string on the Deployment.
| Property Name | Property Value Format |
|---|---|
OneFuse_AnsibleTower_<CustomID> |
JSON string of OneFuse Ansible Tower Managed Object |
Deprovision
Destroy an existing deployment with the OneFuse Ansible Tower Module configured. Ansible Tower Deprovisioning Job Template(s) will run and remove the host from the Ansible Tower Inventory (if configured).
vRA EBS
| EBS Execution | Subscription State | EBS Priority | EBS Name |
|---|---|---|---|
| Provision | |||
| ComputeAllocationPre | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeAllocationPreEarly |
| ComputeAllocationPre | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeAllocationPreLate |
| NetworkConfigure | Early | 15 | OneFuse_Provision_AnsibleTower_NetworkConfigureEarly |
| NetworkConfigure | Late | 2005 | OneFuse_Provision_AnsibleTower_NetworkConfigureLate |
| ComputeProvisionPre | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeProvisionPreEarly |
| ComputeProvisionPre | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeProvisionPreLate |
| ComputeProvisionPost | Early | 15 | OneFuse_Provision_AnsibleTower_ComputeProvisionPostEarly |
| ComputeProvisionPost | Late | 2005 | OneFuse_Provision_AnsibleTower_ComputeProvisionPostLate |
| Deprovision | |||
| ComputePreRemoval | - | 15 | OneFuse_De-Provision_AnsibleTower |
List of vRA EBS Trigger Properties:
OneFuse_AnsibleTowerBehavior_FailOnBlankHost: 'true'
OneFuse_AnsibleTowerBehavior_FailOnBlankLimit:'true'
Troubleshooting
Troubleshoot in vRealize Orchestrator.
- Log in to vRealize Orchestrator.
- Turn on Verbose Logging and try again to see additional log messages in vRO Workflows:
- Select Library > Workflows from the left menu.
- Go to: OneFuse > Ansible Tower > vRA8 to find corresponding workflow runs and view logs.
- Optionally, run the workflows in the Manual folder to manually test.
- Optionally, configure timeouts for EBS and/or Configure timeouts for OneFuse modules.
Additional resources:
- Review Troubleshooting in OneFuse
- Review VMware troubleshooting resources