Bug 1417309 - [RFE] Allow for Ansible_Tower_Job to launch job templates even if no VM is in context
Summary: [RFE] Allow for Ansible_Tower_Job to launch job templates even if no VM is in...
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: GA
: cfme-future
Assignee: John Hardy
QA Contact: Nandini Chandra
Whiteboard: tower
Depends On:
TreeView+ depends on / blocked
Reported: 2017-01-27 22:58 UTC by Jerome Marc
Modified: 2019-11-07 16:15 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-11-07 16:15:26 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:

Attachments (Terms of Use)

Description Jerome Marc 2017-01-27 22:58:00 UTC
Description of problem:
I want to launch Ansible Job Templates on objects where a VM is not in context. The current implementation of Ansible_Tower_Job requires a VM in context in wait_for_ip. In my use case, I want to add custom buttons on Hosts or Providers (e.g. to manage AWS Services using Ansible Job Templates). The current implementation does not allow me to launch the Ansible Job Template for any other objects than VMs/Services.

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

How reproducible:

Steps to Reproduce:
1. Have an Ansible Job Template to perform generic operations
2. Create a custom button on a Provider and associate the job template
3. Launch the Job Template by clicking on the button on the provider

Actual results:
The job template launch fails as there is no VM in context on a provider

Expected results:
The job template launch should work

Additional info:
My current workaround (there is surely something nicer) is to modify / ManageIQ / ConfigurationManagement / AnsibleTower / Operations / StateMachines / Job / wait_for_ip to provide my ansible-tower VM as vm object in the vm_not_found method:

  def vm_not_found
    @handle.log(:info, "Use Ansible Tower VM (BZ workaround) to launch Ansible Job Template")
    vm = $evm.vmdb('vm').find_by_name('ansible-tower')
    if vm
      @handle.root['ae_result'] = 'ok'
      @handle.log(:info, "VM found: #{vm.name}")
      @handle.root['ae_result'] = 'error'
      @handle.log(:error, "VM not found")

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