Bug 1348232

Summary: Extra Vars not passed to Ansible Tower when using custom state machines in service catalog
Product: Red Hat CloudForms Management Engine Reporter: lkerner
Component: AutomateAssignee: mkanoor
Status: CLOSED CURRENTRELEASE QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: high    
Version: 5.6.0CC: cpelland, jhardy, kmorey, lkerner, mkanoor, nstephan, obarenbo, simaishi, sshveta, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: tower
Fixed In Version: 5.7.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1352012 (view as bug list) Environment:
Last Closed: 2017-01-11 20:02:02 UTC Type: Bug
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:    
Bug Blocks: 1352012    

Description lkerner 2016-06-20 14:06:15 UTC
Description of problem:
When creating a service catalog item that first provisions either a vCenter or RHEV VM and then launches an Ansible playbook with extra vars, CloudForms does not pass the extra vars to Ansible Tower. 

Version-Release number of selected component (if applicable):
CFME Version 5.6.0.9-rc2.20160531154046_b4e2f6d


How reproducible: always

Steps to Reproduce:
1. Create a service catalog item that provisions either a vCenter or RHEV VM using /Service/Provisioning/StateMachines/ServiceProvision_Template/CatalogItemInitialization as the provisioning entry point. 

2. Modify the provisioning workflow in Infrastructure->Vm->Provisioning->StateMachines->VMProvision_VM->Provision_VM from Template by adding an "Ansible Job" post provisioning step that launches your specific Ansible Playbook. Example: /ConfigurationManagement/AnsibleTower/RunTemplates/STIG 


Actual results:
CloudForms correctly provisions the vCenter or RHEV VM and Ansible Tower launches the correct playbook. However no extra vars are sent from CloudForms to Ansible Tower. 

Expected results:
CloudForms provisions the vCenter or RHEV VM and the Ansible Tower job with all the extra vars sent from CloudForms is executed on the newly provisioned VM. 


Additional info:
I spoke with Madhu Kanoor about this issue, so he is familiar with this bugzilla.

Comment 3 CFME Bot 2016-06-22 13:26:16 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/cdd9ab23185e42c2876769729027f3a409070499

commit cdd9ab23185e42c2876769729027f3a409070499
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Mon Jun 20 15:35:18 2016 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Mon Jun 20 15:35:18 2016 -0400

    Use Ansbile extra vars defined in options hash
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1348232
    
    Users create service dialog to collect ansible extra vars these
    get stored in the options hash by CatalogItemInitialization.
    The Automate method wasn't looking at the options hash to get
    the ansible extra vars.

 .../Job.class/__methods__/launch_ansible_job.rb    | 17 ++++++++--
 .../method_validation/launch_ansible_job_spec.rb   | 37 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 3 deletions(-)

Comment 6 CFME Bot 2016-07-06 11:46:29 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/b486f599834e576b4dbc5e8b2a010beb09303c12

commit b486f599834e576b4dbc5e8b2a010beb09303c12
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Thu Jun 23 17:46:54 2016 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Thu Jun 23 17:46:54 2016 -0400

    Ansible extra variables missing when called from button
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1348232
    
    PR #9306 broke the passing in of variables from button.

 .../StateMachines/Job.class/__methods__/launch_ansible_job.rb      | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comment 7 mkanoor 2016-07-08 18:53:29 UTC
Fixed in PR https://github.com/ManageIQ/manageiq/pull/9426

Comment 8 Shveta 2016-08-03 21:21:16 UTC
Please provide more steps to recreate this issue .b

Comment 9 Kevin Morey 2016-08-24 13:45:20 UTC
I think you want to follow the steps outlined in: Launch an Ansible Job Template from a button in ManageIQ

http://talk.manageiq.org/t/launching-ansible-tower-job-templates-from-manageiq/1394

Comment 10 Shveta 2016-11-07 08:49:49 UTC
Assigning to Pavol for Ansible .

Comment 13 mkanoor 2016-12-12 20:34:24 UTC
Hi Pavol,
Do you still need info from me.
Thanks,
Madhu