Ansible Tower

Configure and use the OneFuse Ansible Tower module with VMware vRealize Automation 7.6

To learn more about this OneFuse module, refer to Ansible Tower.

Prerequisites

  1. Configure OneFuse Property Set(s) and OneFuse Module Policies.
  2. Run OneFuse Configuration per vRA Tenant.
  3. Review the OneFuse Modules overview for vRealize Automation 7.6.
  4. Create a new vRA Blueprint (if none exist) or determine which existing Blueprint(s) will utilize this OneFuse Module.

Configure the Blueprint

  1. Know the name of the OneFuse Endpoint created via OneFuse Configuration.
  2. Determine which OneFuse Ansible Tower Policies to run for this Blueprint.
  3. Determine when to run each OneFuse Ansible Tower Policy for the deployment provisioning lifecycle with vRA’s EBS'.
  4. Update the Blueprint to add in necessary vRA Properties to invoke OneFuse Ansible Tower Policies.
  5. Deploy the Blueprint to provision a vRA Deployment and run Provision Job Template(s).
  6. Destroy the vRA Deployment to run Deprovision Job Template(s), if any.

Update the Blueprint

  1. Log in to the vRA Tenant
  2. Select the Design tab from the top menu bar
  3. Select the Blueprints tab from the left menu
  4. Edit the Blueprint and perform the below:

Add in necessary vRA Properties

The following vRA Properties need to be added to the Blueprint’s Properties > Custom Properties 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):

  • OneFuse_AnsibleTowerPolicy_Trigger_<EBSExecutionString>
  • Replace <EBSExecutionString> with an appropriate Event Broker Subscription.

OR:

Option 2. Trigger all EBS state(s):

  • OneFuse_AnsibleTowerPolicy_Trigger

Example vRA Custom Properties (in key: value pair format)

OneFuse_AnsibleTowerBehavior_FailOnBlankHost: true
OneFuse_AnsibleTowerBehavior_FailOnBlankLimit: true

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.
  • Replace <CustomID> with a unique, user-defined friendly label.
  • (Optional) <Ansible Tower Host> is a specific hostname (FQDN) or IP address of the host to add to the Ansible Tower Inventory.
  • (Optional) <Ansible Tower Limit> is a valid limit definition to pass to Ansible Tower. This can be a specific hostname (FQDN), IP address, or any valid limit pattern. See Patterns: targeting hosts and groups.

Example vRA Custom Properties (in key: value pair format)

# Execute 2 OneFuse Ansible Tower Policies

# <EBSExecutionString> is replaced with ProvisionedPreLate

# -- 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") }}

OneFuse_AnsibleTowerPolicy_Trigger_ProvisionedPreLate: true
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_001Apache: onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_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 <count>
OneFuse_AnsibleTowerBehavior_RetrySleepSeconds <seconds>
  • <count>: Number of times the workflow should retry. Default: 1.
  • <seconds>: Sleep time between retries in seconds. Default: 120.

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:

EBS Execution Subscription State EBS Priority EBS Name
Provision
BuildingPre Early 15 OneFuse_Provision_AnsibleTower_BuildingPreEarly
BuildingPre Late 2005 OneFuse_Provision_AnsibleTower_BuildingPreLate
ProvisionedPre Early 15 OneFuse_Provision_AnsibleTower_ProvisionedPreEarly
ProvisionedPre Late 2005 OneFuse_Provision_AnsibleTower_ProvisionedPreLate
Deprovision
MachineDisposingPost - 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 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, nor 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.
# Execute 2 OneFuse Ansible Tower Policies

# <EBSExecutionString> is replaced with ProvisionedPreLate

# -- 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") }}

OneFuse_AnsibleTowerPolicy_Trigger_ProvisionedPreLate: true
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_001Apache: onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_002BasicSetup: onefuse:linux_setup:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}

Specify sorting with CustomID:

When executing multiple different OneFuse Module’s 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 ProvisionedPreLate

# -- 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") }}

OneFuse_AnsibleTowerPolicy_Trigger_ProvisionedPreLate: true
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_001Apache: onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_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. 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> See examples below

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

Examples:

  • 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).

Custom property placement methods

Influence Custom Properties for Resources using different methods:

Method Description
Basic Add a Custom Property to the vSphere machine on the blueprint canvas, or to the blueprint layer itself.
Advanced 1 Add a Custom Property to an existing or new vRA Property Group.
Advanced 2 Add a Custom Property to a more global level, such as vCenter Endpoint (to run on all deployments) and/or a Reservation (to run on all deployments using that reservation), etc.

Learn more: Understanding Custom Properties Precedence

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 "" (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.

Compiled example vRA Custom Properties

Review the example below of vRA Custom Properties (in key: value pair format) for this OneFuse Module.

# Execute 2 OneFuse Ansible Tower Policies

# <EBSExecutionString> is replaced with ProvisionedPreLate

# -- 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") }}

OneFuse_AnsibleTowerPolicy_Trigger_ProvisionedPreLate: true
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_001Apache: onefuse:linux_Apache:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}
OneFuse_AnsibleTowerPolicy_ProvisionedPreLate_002BasicSetup: onefuse:linux_setup:{{ OneFuse_VmNic0.fqdn }}:{{ OneFuse_VmNic0.fqdn | required("Limit is not defined") }}

Provision

Deploy a Blueprint 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
BuildingPre Early 15 OneFuse_Provision_AnsibleTower_BuildingPreEarly
BuildingPre Late 2005 OneFuse_Provision_AnsibleTower_BuildingPreLate
ProvisionedPre Early 15 OneFuse_Provision_AnsibleTower_ProvisionedPreEarly
ProvisionedPre Late 2005 OneFuse_Provision_AnsibleTower_ProvisionedPreLate
Deprovision
MachineDisposingPost - 15 OneFuse_De-Provision_AnsibleTower

List of vRA EBS trigger properties:

OneFuse_AnsibleTowerBehavior_FailOnBlankHost: true
OneFuse_AnsibleTowerBehavior_FailOnBlankLimit: true

Troubleshooting

Troubleshoot in vRealize Orchestrator.

  1. Log in to vRealize Orchestrator.
  2. 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 > vRA7 to find corresponding workflow runs and view logs
    • Optionally, run the workflows in the Manual folder to manually test
  3. Optionally, configure timeouts for EBS and/or Configure timeouts for OneFuse modules.

Additional resources: