Bug 1623636 - [RFE] Allow for Instance Calls in Automate State Machine to Specify a Different Zone for Task to be Run
Summary: [RFE] Allow for Instance Calls in Automate State Machine to Specify a Differe...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.9.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.11.0
Assignee: Lucy Fu
QA Contact: Nandini Chandra
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-08-29 19:04 UTC by myoder
Modified: 2023-03-24 14:12 UTC (History)
9 users (show)

Fixed In Version: 5.11.0.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-12-12 13:34:23 UTC
Category: Feature
Cloudforms Team: Ansible
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:4199 0 None None None 2019-12-12 13:34:46 UTC

Description myoder 2018-08-29 19:04:11 UTC
Description of problem:

We have multi-zone setup.  Ansible tower provider is in a zone with 4 workers. When trying to execute ansible tower template from a worker in another zone outside of the firewall it will not execute but instead gives a connection error. It would appear that the worker outside of the firewall is trying to connect direct to the ansible tower provider. I through what would happen is since the Ansible provider is in a different zone that the request would be put into the worker queue for that zone and be executed from there.

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

How reproducible:
always

Steps to Reproduce:
1. Have a provider (AWS) in zone 1, and a ansible tower provider in zone2
2. Appliance in zone1 is behind a firewall, and cannot communicate with the tower provider in zone2
3. Create an AWS Service Catalog
4. In a post provision step, have one of the instances calling an ansible tower job template

Actual results:
The appliance in zone 1 is unable to communicate to the tower provider, so that state fails

Expected results:
The ability to specify which zone a state/instance in the state machine will be ran from

Additional info:

Comment 3 myoder 2018-08-29 19:11:59 UTC
This is the current work around, and a question if there is a better way to do this:

If i run it through a method with option[:miq_zone] set then it works as expected. while this is a nice work around its not as efficient as just creating an instance for the playbooks we need (vs an entire method). is there a way to modify launch_ansible_job to take that option?

  def ansible_inventory()
    attrs = {}
    attrs['job_template_name'] = "ansible_inventory"
    attrs['dialog_param_host_name'] = @vm.name
    attrs['dialog_param_host_ip'] =  @vm.ipaddresses.first
    attrs['dialog_param_host_action'] =  @action
    attrs['dialog_param_inventories'] = @inventories
    attrs['Vm::vm'] = @vm.id
    options = {}
    options[:namespace]     = ANSIBLE_NAMESPACE
    options[:class_name]    = ANSIBLE_STATE_MACHINE_CLASS
    options[:instance_name] = ANSIBLE_STATE_MACHINE_INSTANCE
    options[:user_id]       = $evm.vmdb(:user).find_by_userid('admin').id
    options[:miq_zone] = "Internal Vmware Zone"
    options[:attrs]         = attrs
    auto_approve            = true
    $evm.execute('create_automation_request', options, 'admin', auto_approve)
  end

Kind Regards,
Yoder

Comment 7 CFME Bot 2019-05-13 21:01:30 UTC
New commits detected on ManageIQ/manageiq-providers-ansible_tower/master:

https://github.com/ManageIQ/manageiq-providers-ansible_tower/commit/26a58b6b21028398ccaa2ce9f5dd46aef6d8f918
commit 26a58b6b21028398ccaa2ce9f5dd46aef6d8f918
Author:     Lucy Fu <lufu>
AuthorDate: Mon Apr 29 17:17:13 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Mon Apr 29 17:17:13 2019 -0400

    Queue signal with specified priority.

    https://bugzilla.redhat.com/show_bug.cgi?id=1623636

 app/models/manageiq/providers/ansible_tower/automation_manager/template_runner.rb | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)


https://github.com/ManageIQ/manageiq-providers-ansible_tower/commit/ed8b3bd86e1986bb370e4688eb14a85a3c725321
commit ed8b3bd86e1986bb370e4688eb14a85a3c725321
Author:     Lucy Fu <lufu>
AuthorDate: Mon Apr 29 17:18:46 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Mon Apr 29 17:18:46 2019 -0400

    Add method wait_on_ansible_job.

    https://bugzilla.redhat.com/show_bug.cgi?id=1623636

 app/models/manageiq/providers/ansible_tower/automation_manager/template_runner.rb | 17 +-
 spec/models/manageiq/providers/ansible_tower/automation_manager/template_runner_spec.rb | 2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

Comment 8 CFME Bot 2019-05-16 12:21:54 UTC
New commit detected on ManageIQ/manageiq-automation_engine/master:

https://github.com/ManageIQ/manageiq-automation_engine/commit/097396efa58872928aa4a353612e71a5ab79894b
commit 097396efa58872928aa4a353612e71a5ab79894b
Author:     Lucy Fu <lufu>
AuthorDate: Tue May  7 11:25:11 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Tue May  7 11:25:11 2019 -0400

    Expose Ansible Tower TemplateRunner to service model.

    https://bugzilla.redhat.com/show_bug.cgi?id=1623636

 lib/miq_automation_engine/service_models/miq_ae_service_manageiq-providers-ansible_tower-automation_manager-template_runner.rb | 10 +
 spec/service_models/miq_ae_service_manageiq-providers-ansible_tower-automation_manager-template_runner_spec.rb | 19 +
 2 files changed, 29 insertions(+)

Comment 9 CFME Bot 2019-05-20 18:07:26 UTC
New commit detected on ManageIQ/manageiq-content/master:

https://github.com/ManageIQ/manageiq-content/commit/f28660823cc4bed63e3b163bf0d48d7027babf64
commit f28660823cc4bed63e3b163bf0d48d7027babf64
Author:     Lucy Fu <lufu>
AuthorDate: Mon Apr 29 17:15:31 2019 -0400
Commit:     Lucy Fu <lufu>
CommitDate: Mon Apr 29 17:15:31 2019 -0400

    Launch ansible job with a specified zone.

    https://bugzilla.redhat.com/show_bug.cgi?id=1623636

 content/automate/ManageIQ/AutomationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/launch_ansible_job.rb | 20 +-
 spec/content/automate/ManageIQ/AutomationManagement/AnsibleTower/Operations/StateMachines/Job.class/__methods__/launch_ansible_job_spec.rb | 14 +-
 2 files changed, 32 insertions(+), 2 deletions(-)

Comment 13 Nandini Chandra 2019-07-05 23:02:14 UTC
Lucy,

Thanks for

Comment 14 Lucy Fu 2019-07-08 21:56:32 UTC
Zone selection is only for catalog item and should not be available for catalog bundle.

After remove the zone for catalog bundle, test went thru with two catalog item provisioning requests sent to different zones.
 
[----] I, [2019-07-08T16:44:43.492188 #46697:2ac533e1c5bc]  INFO -- : MIQ(MiqGenericWorker::Runner#get_message_via_drb) Message id: [99000000004544], MiqWorker id: [99000000000055], Zone: [], Role: [ems_operations], Server: [], MiqTask id: [], Ident: [generic], Target id: [], Instance id: [99000000000026], Task id: [], Command: [ServiceTemplateProvisionTask.execute], Timeout: [600], Priority: [100], State: [dequeue], Deliver On: [], Data: [], Args: [], Dequeued in: [5.914896029] seconds
[----] I, [2019-07-08T16:44:43.492328 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(MiqQueue#deliver) Message id: [99000000004544], Delivering...
[----] I, [2019-07-08T16:44:43.600044 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(ServiceTemplateProvisionTask#execute) Executing Service_Template_Provisioning request: [Provisioning [bundle] for Service [bundle]]
[----] I, [2019-07-08T16:44:43.898296 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(ServiceTemplateProvisionTask#execute) Service_Template_Provisioning initiated
[----] I, [2019-07-08T16:44:43.950055 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(ServiceTemplateProvisionTask#deliver_to_automate) Queuing Service_Template_Provisioning: [Provisioning [vsphere] for Service [vsphere]]...
[----] I, [2019-07-08T16:44:44.112806 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(MiqQueue.put) Message id: [99000000004549],  id: [], Zone: [default], Role: [automate], Server: [], MiqTask id: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqAeEngine.deliver], Timeout: [600], Priority: [100], State: [ready], Deliver On: [], Data: [], Args: [{:object_type=>"ServiceTemplateProvisionTask", :object_id=>99000000000027, :namespace=>"Service/Provisioning/StateMachines", :class_name=>"ServiceProvision_Template", :instance_name=>"CatalogItemInitialization", :automate_message=>"create", :attrs=>{"request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>99000000000017}, :user_id=>99000000000001, :miq_group_id=>99000000000002, :tenant_id=>99000000000001}]

[----] I, [2019-07-08T16:44:44.146298 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) 
MIQ(ServiceTemplateProvisionTask#deliver_to_automate) Queuing Service_Template_Provisioning: [Provisioning [ansible-job] for Service [ansible-job]]...
[----] I, [2019-07-08T16:44:44.424360 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(MiqQueue.put) Message id: [99000000004550],  id: [], Zone: [zone1], Role: [automate], Server: [], MiqTask id: [], Ident: [generic], Target id: [], Instance id: [], Task id: [], Command: [MiqAeEngine.deliver], Timeout: [600], Priority: [100], State: [ready], Deliver On: [], Data: [], Args: [{:object_type=>"ServiceTemplateProvisionTask", :object_id=>99000000000030, :namespace=>"AutomationManagement/AnsibleTower/Service/Provisioning/StateMachines", :class_name=>"Provision", :instance_name=>"CatalogItemInitialization", :automate_message=>"create", :attrs=>{"request"=>"clone_to_service", :service_action=>"Provision", "Service::Service"=>99000000000018}, :user_id=>99000000000001, :miq_group_id=>99000000000002, :tenant_id=>99000000000001}]

[----] I, [2019-07-08T16:44:44.452755 #46697:2ac533e1c5bc]  INFO -- : Q-task_id([r99000000000009_service_template_provision_task_99000000000026]) MIQ(ServiceTemplateProvisionTask#do_request) Service Provision started

Comment 15 Nandini Chandra 2019-07-09 15:56:59 UTC
Reported the following BZ so that the zone selection option can be removed for catalog bundles.

https://bugzilla.redhat.com/show_bug.cgi?id=1728309  Zone selection shouldn't be available for catalog bundles

Comment 17 errata-xmlrpc 2019-12-12 13:34:23 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://access.redhat.com/errata/RHBA-2019:4199


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