Bug 1378606

Summary: launch_ansible_job doesn't support multiple Ansible Tower providers in CloudForms
Product: Red Hat CloudForms Management Engine Reporter: Jerome Marc <jmarc>
Component: AutomateAssignee: mkanoor
Status: CLOSED CURRENTRELEASE QA Contact: Pavol Kotvan <pakotvan>
Severity: medium Docs Contact:
Priority: high    
Version: 5.6.0CC: dajohnso, jhardy, jmarc, kmorey, mfalesni, mkanoor, nstephan, obarenbo, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: automate:tower
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1411359 (view as bug list) Environment:
Last Closed: 2017-06-12 16:58:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Ansible Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1411359    
Attachments:
Description Flags
Ansible_Tower_Job - impossible to specify Ansible Tower Provider none

Description Jerome Marc 2016-09-22 21:50:36 UTC
Description of problem:
The launch_ansible_job lookup in / ManageIQ / ConfigurationManagement / AnsibleTower / Operations / StateMachines / Job / launch_ansible_job  will always returned the first element of the result.

I have two Ansible Tower providers with a Job Template in each of them with same name (e.g. Dev & Prod environments). Running an Ansible Tower from a button on a VM will always pick-up the first Ansible template job. 

The alternative would be to specify a job template id but i cannot see it anywhere in the UI.

Version-Release number of selected component (if applicable):
5.6.1.2.20160810181333_8ba817b 

How reproducible:
Always

Steps to Reproduce:
1. Have two Ansible Tower provider setup in CloudForms. Each provider has a Job Template performing two actions but with the same name.
2. Add a button to run the job template on  a VM.
3. Run the job template by clicking on the button.

Actual results:
CloudForms will look up for the job template by name and only return the first job template and run it (in the first Ansible Tower provider).

Expected results:
I want to be able to specify which Ansible Tower provider to use (similar to Service Items) in launch_ansible_job or a way to find out the job template id from the UI to specify it when creating my button on the VM.

Additional info:

Comment 2 mkanoor 2016-09-30 16:45:39 UTC
Can we have the automation.log for this issue.
We do support passing in the job_template_id into the method which can pick up a template by id.
How is the job being launched is it thru a button or thru instances in the Automate State Machine as part of some other provisioning workflow.

Comment 3 Jerome Marc 2016-09-30 18:03:21 UTC
(In reply to mkanoor from comment #2)
> Can we have the automation.log for this issue.
> We do support passing in the job_template_id into the method which can pick
> up a template by id.
> How is the job being launched is it thru a button or thru instances in the
> Automate State Machine as part of some other provisioning workflow.

I agree that job_template_id would work. However, as I mentioned earlier, there is no way to find the job_template_id from the UI. As an operator, it is then impossible to complete this use case, where two job templates have the same name on different Ansible Tower providers.

I have attached a screenshot. I am suggesting to add the option to specify the Ansible provider name as a parameter for Ansible_Tower_Job. This way, an operator can launch the job template without having to look up its job_template_id.

Comment 4 Jerome Marc 2016-09-30 18:04:10 UTC
Created attachment 1206333 [details]
Ansible_Tower_Job - impossible to specify Ansible Tower Provider

Comment 6 CFME Bot 2016-11-28 19:16:35 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/23f8ac3d643e3e45796e5d37e0ed56cc14df6580

commit 23f8ac3d643e3e45796e5d37e0ed56cc14df6580
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Mon Oct 3 18:01:16 2016 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Tue Nov 1 14:05:16 2016 -0400

    Support provider name & template name to uniquely identify
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1378606
    
    Optionally support 'ansible_provider_name' to uniquely identify a
    job template. This is needed where you might have multiple Ansible
    Towers with the same named templates.

 .../Job.class/__methods__/launch_ansible_job.rb     | 21 +++++++++++++++++----
 .../method_validation/launch_ansible_job_spec.rb    | 19 ++++++++++++++++++-
 2 files changed, 35 insertions(+), 5 deletions(-)