Bug 1369842 - Unable to override extra_vars sent to Ansible Tower3
Summary: Unable to override extra_vars sent to Ansible Tower3
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.6.0
Hardware: All
OS: All
medium
high
Target Milestone: GA
: 5.8.0
Assignee: Brandon Dunne
QA Contact: Pavol Kotvan
URL:
Whiteboard: tower
Depends On:
Blocks: 1397415
TreeView+ depends on / blocked
 
Reported: 2016-08-24 14:21 UTC by Kevin Morey
Modified: 2017-06-12 16:21 UTC (History)
11 users (show)

Fixed In Version: 5.8.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1397415 (view as bug list)
Environment:
Last Closed: 2017-06-12 16:21:15 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
tower job 360 screenshot (80.21 KB, image/png)
2016-08-24 14:21 UTC, Kevin Morey
no flags Details

Description Kevin Morey 2016-08-24 14:21:52 UTC
Created attachment 1193660 [details]
tower job 360 screenshot

Description of problem:
When attempting to execute an Ansible playbook via a button the extra_vars they are not overridden in Ansible Tower3. If i remove the Toer3 provider and add my Tower2 provider using the same button and the same playbook it works. My hunch is that the Tower3 API's might have changed?

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

How reproducible:
100%

Steps to Reproduce:
1. Setup your button as per Madhu's comments here: http://talk.manageiq.org/t/launching-ansible-tower-job-templates-from-manageiq/1394/10

Actual results:
the extra_vars are not overridden

Expected results:
that the extra vars are overridden

Additional info:
automate log launch output

[----] I, [2016-08-24T06:57:55.217031 #20698:df9990]  INFO -- : Q-task_id([resource_action_12000000000579]) Invoking [inline] method [/ManageIQ/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job] with inputs [{}]
[----] I, [2016-08-24T06:57:55.217816 #20698:df9990]  INFO -- : Q-task_id([resource_action_12000000000579]) <AEMethod [/ManageIQ/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job]> Starting
[----] I, [2016-08-24T06:57:55.744273 #20698:e96664]  INFO -- : Q-task_id([resource_action_12000000000579]) <AEMethod launch_ansible_job> Processing Job Template Create AWS ELB
[----] I, [2016-08-24T06:57:55.749015 #20698:e96664]  INFO -- : Q-task_id([resource_action_12000000000579]) <AEMethod launch_ansible_job> Job Arguments {:extra_vars=>{"elb_name"=>"km4iii4-elb", "instance_ids"=>"discarded"}, :limit=>"cfmer002"}
[----] I, [2016-08-24T06:57:56.589437 #20698:e96664]  INFO -- : Q-task_id([resource_action_12000000000579]) <AEMethod launch_ansible_job> Scheduled Job ID: 12000000000175 Ansible Job ID: 360
[----] I, [2016-08-24T06:57:56.627101 #20698:df9990]  INFO -- : Q-task_id([resource_action_12000000000579]) <AEMethod [/ManageIQ/ConfigurationManagement/AnsibleTower/Operations/StateMachines/Job/launch_ansible_job]> Ending

Comment 3 Bill Wei 2016-08-24 18:30:20 UTC
The problem was caused by a backward incompatible API change starting from AnsibleTower 3.0. So all our AnsibleTower provisioning will hit the same issue with AnsibleTower 3.0.

To allow accepting extra_vars at runtime on a job template the prompt for extra vars flag needs to be true on the job template. This change was made for security reason.

We either need to modify the flag to allow the extra_vars to be overridden, or disable extra_vars if the flag is off in the template.

Comment 6 CFME Bot 2016-10-04 20:12:18 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/7bf328550e8990c841b15fe240695a9c29af513b

commit 7bf328550e8990c841b15fe240695a9c29af513b
Author:     Brandon Dunne <bdunne>
AuthorDate: Mon Aug 29 17:53:38 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Subclass JobTemplateV2 for #launch
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client.rb                        |  2 ++
 .../base_models/job_template.rb                    | 30 ++----------------
 lib/ansible_tower_client/v2/job_template_v2.rb     | 36 ++++++++++++++++++++++
 3 files changed, 40 insertions(+), 28 deletions(-)
 create mode 100644 lib/ansible_tower_client/v2/job_template_v2.rb

Comment 7 CFME Bot 2016-10-04 20:12:24 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/d0d6d1754ca9f98c121f2a75356d3af0fa4450b6

commit d0d6d1754ca9f98c121f2a75356d3af0fa4450b6
Author:     Brandon Dunne <bdunne>
AuthorDate: Mon Aug 29 17:50:49 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Move JobTemplate model to a base_models directory
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client.rb                        |  3 +-
 .../base_models/job_template.rb                    | 54 ++++++++++++++++++++++
 lib/ansible_tower_client/job_template.rb           | 54 ----------------------
 3 files changed, 56 insertions(+), 55 deletions(-)
 create mode 100644 lib/ansible_tower_client/base_models/job_template.rb
 delete mode 100644 lib/ansible_tower_client/job_template.rb

Comment 8 CFME Bot 2016-10-04 20:12:30 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/797db9720530ad5cfa8d7b1bc2dafdb65a87d095

commit 797db9720530ad5cfa8d7b1bc2dafdb65a87d095
Author:     Brandon Dunne <bdunne>
AuthorDate: Mon Aug 29 17:56:05 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Dynamically select the class for the API version
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client/api.rb | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

Comment 9 CFME Bot 2016-10-04 20:12:36 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/9996aec8c4039e77d9e094bc891335f21442851c

commit 9996aec8c4039e77d9e094bc891335f21442851c
Author:     Brandon Dunne <bdunne>
AuthorDate: Mon Aug 29 17:57:17 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Cache the API version to prevent multiple calls when building classes
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client/connection.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 10 CFME Bot 2016-10-04 20:12:43 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/9b17f48ff978f82cc83335ce57de636d1b6f87ce

commit 9b17f48ff978f82cc83335ce57de636d1b6f87ce
Author:     Brandon Dunne <bdunne>
AuthorDate: Tue Aug 30 12:12:41 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Move remaining classes to base_models directory
    
    Select classes dynamically to allow for easier patching
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client.rb                        | 14 +++---
 lib/ansible_tower_client/ad_hoc_command.rb         | 12 -----
 lib/ansible_tower_client/api.rb                    | 56 ++++++++++++++++------
 .../base_models/ad_hoc_command.rb                  | 12 +++++
 lib/ansible_tower_client/base_models/group.rb      | 11 +++++
 lib/ansible_tower_client/base_models/host.rb       | 11 +++++
 lib/ansible_tower_client/base_models/inventory.rb  | 21 ++++++++
 .../base_models/inventory_source.rb                | 21 ++++++++
 .../base_models/inventory_update.rb                |  7 +++
 lib/ansible_tower_client/base_models/job.rb        | 17 +++++++
 lib/ansible_tower_client/group.rb                  | 11 -----
 lib/ansible_tower_client/host.rb                   | 11 -----
 lib/ansible_tower_client/inventory.rb              | 21 --------
 lib/ansible_tower_client/inventory_source.rb       | 21 --------
 lib/ansible_tower_client/inventory_update.rb       |  7 ---
 lib/ansible_tower_client/job.rb                    | 17 -------
 16 files changed, 149 insertions(+), 121 deletions(-)
 delete mode 100644 lib/ansible_tower_client/ad_hoc_command.rb
 create mode 100644 lib/ansible_tower_client/base_models/ad_hoc_command.rb
 create mode 100644 lib/ansible_tower_client/base_models/group.rb
 create mode 100644 lib/ansible_tower_client/base_models/host.rb
 create mode 100644 lib/ansible_tower_client/base_models/inventory.rb
 create mode 100644 lib/ansible_tower_client/base_models/inventory_source.rb
 create mode 100644 lib/ansible_tower_client/base_models/inventory_update.rb
 create mode 100644 lib/ansible_tower_client/base_models/job.rb
 delete mode 100644 lib/ansible_tower_client/group.rb
 delete mode 100644 lib/ansible_tower_client/host.rb
 delete mode 100644 lib/ansible_tower_client/inventory.rb
 delete mode 100644 lib/ansible_tower_client/inventory_source.rb
 delete mode 100644 lib/ansible_tower_client/inventory_update.rb
 delete mode 100644 lib/ansible_tower_client/job.rb

Comment 11 CFME Bot 2016-10-04 20:12:49 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/a90e7d3a4aeaeaf33e72cbf0dd3391a52a2016cf

commit a90e7d3a4aeaeaf33e72cbf0dd3391a52a2016cf
Author:     Brandon Dunne <bdunne>
AuthorDate: Tue Aug 30 16:57:10 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 10:56:30 2016 -0400

    Update specs to expect the correct class
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client/collection.rb |  3 +-
 spec/job_spec.rb                       |  2 +-
 spec/job_template_spec.rb              | 74 +++++++++++++++++++++-------------
 3 files changed, 49 insertions(+), 30 deletions(-)

Comment 12 CFME Bot 2016-10-04 20:12:56 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/144f70a291cf4ca3f648ca3972f7488225328348

commit 144f70a291cf4ca3f648ca3972f7488225328348
Author:     Brandon Dunne <bdunne>
AuthorDate: Tue Aug 30 17:19:11 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 11:55:14 2016 -0400

    Add tests to verify API V3 behavior on JobTemplate#launch
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 spec/job_template_spec.rb                    | 119 +++------------------------
 spec/job_template_v2_spec.rb                 |  70 ++++++++++++++++
 spec/support/shared_examples/job_template.rb |  62 ++++++++++++++
 3 files changed, 144 insertions(+), 107 deletions(-)
 create mode 100644 spec/job_template_v2_spec.rb
 create mode 100644 spec/support/shared_examples/job_template.rb

Comment 13 CFME Bot 2016-10-04 20:13:02 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/a50e3e1c3b406d871620bf01d8e85c1efc82825f

commit a50e3e1c3b406d871620bf01d8e85c1efc82825f
Author:     Brandon Dunne <bdunne>
AuthorDate: Fri Sep 2 10:53:34 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 11:55:21 2016 -0400

    Add BaseModel.base_class
    
    Allow subclasses to find their base class
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client/base_model.rb | 4 ++++
 1 file changed, 4 insertions(+)

Comment 14 CFME Bot 2016-10-04 20:13:08 UTC
New commit detected on ManageIQ/ansible_tower_client/master:
https://github.com/ManageIQ/ansible_tower_client/commit/563beeb43397210afb11bdc8241bf4b72c57e081

commit 563beeb43397210afb11bdc8241bf4b72c57e081
Author:     Brandon Dunne <bdunne>
AuthorDate: Wed Aug 31 15:52:38 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Fri Sep 2 11:55:21 2016 -0400

    Move API methods to Api class
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 lib/ansible_tower_client/api.rb        | 12 +++++++
 lib/ansible_tower_client/connection.rb | 12 -------
 spec/api_spec.rb                       | 47 ++++++++++++++++++++++++++-
 spec/connection_spec.rb                | 58 +++-------------------------------
 4 files changed, 62 insertions(+), 67 deletions(-)

Comment 16 CFME Bot 2016-10-19 16:06:25 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/8e94ef0794e2a74d84c72fd37a89ce2386d9713c

commit 8e94ef0794e2a74d84c72fd37a89ce2386d9713c
Author:     Brandon Dunne <bdunne>
AuthorDate: Wed Oct 12 12:15:14 2016 -0400
Commit:     Brandon Dunne <bdunne>
CommitDate: Wed Oct 12 12:15:14 2016 -0400

    Handle major version differences in the Ansible Tower API
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 Gemfile                                                                 | 2 +-
 .../manageiq/providers/ansible_tower/configuration_manager/refresher.rb | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comment 18 CFME Bot 2016-10-21 14:50:53 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/7d28b50e85333d59c4e2baeb7778b76d7dafc925

commit 7d28b50e85333d59c4e2baeb7778b76d7dafc925
Author:     Greg McCullough <gmccullo>
AuthorDate: Wed Oct 19 18:05:58 2016 +0200
Commit:     Oleg Barenboim <chessbyte>
CommitDate: Fri Oct 21 10:49:46 2016 -0400

    Merge pull request #11855 from bdunne/update_ansible_tower_client
    
    Handle major version differences in the Ansible Tower API
    (cherry picked from commit 1dd553885b646e027885f9ac0ad7ffbbd4da598e)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1369842

 Gemfile                                            |    2 +-
 .../configuration_manager/refresher.rb             |    2 +-
 .../configuration_manager/refresher_spec.rb        |    4 +-
 .../configuration_manager/refresher.yml            | 5511 ++++++++++++--------
 4 files changed, 3299 insertions(+), 2220 deletions(-)

Comment 23 Reartes Guillermo 2017-01-31 17:26:14 UTC
Hi,

I tried with CFME: 5.7.0.17 and ATOWER 3.0.3 and it seems to work.


In the playbook, the variable is:
name: "{{ username }}"

In the Job Template:

Extra variables is set to: 
username: demouser

And "prompt at launch" is checked.

In CloudForms, in the dialog, the variable is:
param_username.


I am able to execute a Job Template froma button to create or delete an username.
The user i specify to create/delete from ClouForms is created/deleted on the VM via Ansible Tower correctly.

Is this actually fixed? (it seems so, but Target Release is 5.8.0, so i ask)
If it is not fixed, should i default to Tower 2.4.x instead?

Cheers.

Comment 24 Brandon Dunne 2017-01-31 19:10:31 UTC
Yes, it is fixed in 5.7.0.7, the clone is https://bugzilla.redhat.com/show_bug.cgi?id=1397415 (currently marked as CLOSED / ERRATA)


Note You need to log in before you can comment on or make changes to this bug.