In the Darga release we have added support for Ansible Tower Job Templates, as part of this feature an Ansible Tower is added as a Provider and we fetch the Inventory and Job Templates information from Ansible Tower and store it in VMDB.
The use case presented here will
Launch an Ansible Job Template from a button in ManageIQ
(1) Both Ansible Tower and the ManageIQ should be working with the same providers.
(2) The inventory group in Ansible should have “Update on Launch” enabled, this allows Ansible to update its inventory with the newly provisioned VM before it launches the job.
Add Ansible Tower as a provider
Configuration -> Configuration Management -> Configuration -> Add a new Provider URL => https://<ansible_tower>/api/v1 After the Provider has been added Configuration -> Refresh Relationships and Power States Wait for the Refresh to end.
New automate classes for supporting Ansible Tower Job Templates
* Name of Job Template * Parameters .... for the Job Template * Launch the State Machine to execute the Job Template
A place holder missing instance has been provided that uses the instance name to set the name of the job template.
* WaitForIP Waits for the VM to be powered on and ip address * Launch Launch the ansible job * WaitForCompletion Wait for the job template to end
Creating a new button for VM’s
Navigate to Automate -> Customizations -> Buttons -> VM and Instance
Select the Unassigned Buttons folder
Add a new Button
Please note that the Object Details section should have
System/Process = Request
Message = create
Request = Ansible_Tower_Job
Just like in the picture above.
You specify the name of your Job Template in the Attribute/Value Pairs section
is the parameter that stores the name of your template associated with this button.
Assign the button to the VM Actions
Buttons -> VM and Instance -> VM Actions -> Edit this Button Group
To test this navigate to
Compute -> Infrastructure -> Virtual Machines
Select a VM
Click on the VM Actions and run select the Button from the drop down
This should launch a Job on the Ansible Tower