Bug 1352012

Summary: Extra Vars not passed to Ansible Tower when using custom state machines in service catalog
Product: Red Hat CloudForms Management Engine Reporter: John Prause <jprause>
Component: AutomateAssignee: mkanoor
Status: CLOSED ERRATA QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: high    
Version: 5.6.0CC: cpelland, jhardy, lkerner, mkanoor, obarenbo, pakotvan, tfitzger
Target Milestone: GAKeywords: ZStream
Target Release: 5.6.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: service
Fixed In Version: 5.6.1.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1348232 Environment:
Last Closed: 2016-08-18 17:54:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1348232    
Bug Blocks:    

Comment 4 Shveta 2016-08-08 17:48:56 UTC
Hi Madhu , 

Please provider more steps to verify this bug .
 What can i specify in Postprovision for Provisioning a Vmware Catalog item .

Thanks,
Shveta

Comment 5 mkanoor 2016-08-08 20:32:01 UTC
Hi,
For this use case the customer had a regular service dialog to provision a single vm, which is different from having an "Ansible type" service, which directly works with the Ansible Job Template.

In their use case they would first provision the VM and then after provisioning run the Ansbile Job Template on the newly provisioned VM.

The dialog was built to pick up Ansible vars from the end user. So for example if they created the following 2 parameters in the service dialog which are going to be used during post provisioning when we are running the Ansible Job Template.

e.g.

param_package_name = "http"
param_package_ver  = "3.1"

These attributes are stored in the service options hash, and the earlier code wasn't looking at these fields. This fix was to look at the options hash and parse out the parameters and send it to Ansible Tower.

In the above example the parameter is stored in the options hash as
dialog_param_package_name
dialog_param_package_ver

When we send it to Ansible Tower it will go in as
package_name
package_ver

The param will be removed

When creating the dialog pleas make sure that any parameters they want to pass will be listed with param_

To test this feature you would have to update the post provision step in the Provisiong state machine to call the Ansible Tower State Machine, which is defined in ManageIQ/Infrastructure/Vm/Provisioning/StateMachines/VMProvision_Template.
You can take the PostProvision state and point it to /ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/default

During the post provision phase we will connect to Ansbile Tower and execute the Job Template.

To test this you would have to create your owns Ansible Tower Job Template, and that template should take run tine params also called extra_vars in Ansible.

To see if the Job has been executed properly you should check the Ansbile tower to see what parameters were passed in.

Thanks,
Madhu

Comment 8 errata-xmlrpc 2016-08-18 17:54:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-1634.html