Manageiq Ansible Tower Service Catalog

providers
automate

#1

Hey. I want to ask that i have integrated the ansible tower into manageiq and my jobs are setup on the ansible tower i can create services of that jobs and also able to run and its working fine. But i want to know is it possible to change some parameters from manageiq into my original yaml script when the service is going to be ordered ? for example at my ansible tower jobs scripts i have created an script of os_server.yml which will create an instance in openstack and it calls the API of openstack. is it possible to change the name using service dialog when ordering the service from manageiq ???


#2

@gmccullough can you help @Asad_Rajput ?


#3

@Asad_Rajput - Yes, what you are describing sounds possible.

When you add the Tower provider we inventory the Job Templates. From there you create a Service Dialog from the JobTemplate which is used when configuring the Ansible Tower Catalog Item. (Sounds like you have done all this and it is working.)

What you need to do is modify the Service Dialog and add additional fields which will be passed as extraVars to Tower as part of the service order.

Depending on the version of ManageIQ that you are running you want to navigate to the Automate -> Customization -> Service Dialogs (Left Nav) and select the dialog you are using with your Catalog Item.

Edit the dialog and add a new field. The important thing here is to prefix the field with param_ so the data gets passed along to Tower. For example, to pass the extraVar “new_name” to Tower the field should be called “param_new_name”.

Of course the Playbook that the JobTemplate is using will need to be updated to use this new variable as well.


#4

Sir. I am using manageiq:fine in docker container, when i navigate to ->Customization->Service Dialog accordion or create new one diaglog. Than there is dialog information, dialog button, box, element where i can find field ?and where to pass param_new_name parameters ?

Kindly check the screen shots and guide me.


#5


@gmccullough
Sir Kindly check this i have changed param_name and when i order the service it ask:
Name:
Description:
But the parameters are not changing parameters are same.
this is my script which runs on tower it calls the API of openstack and create the security group inside the openstack.

  • name: Deploy on OpenStack
    hosts: 10.81.1.142
    gather_facts: false
    tasks:
    • name: Create a security group
      os_security_group:
      state: present
      auth:
      auth_url: http://10.81.1.141:5000/v3
      username: asad
      password: pakistan
      project_name: gocha1
      user_domain_name: default
      project_domain_name: default
      name: apple
      description: this is for apple users

#6

@gmccullough @Fryguy Hey, can one help me out here ??


#7

@bill Can you verify that this last screenshot looks correct? I believe the issue here is that they are not using substitution on the extraVar we pass when launching the Job Template.


#8

@Asad_Rajput I am not good at composing ansible playbook. It seems to me that in your playbook you did not declare name is a variable. Even if a variable named name is passed in, how do you use it?


#9

@bill @gmccullough The Name Which i am using in playbook is in yaml format and it is using shade module for automation of openstack using its API. So question you asked me for passing named as a name in my playbook is the method of os_security_group if i dont use name than it will not work. If you could help me to automate security_groups of openstack using manageiq automation other than ansible-tower than please guide me on that way. my task is just to automate openstack cloud using mangeiq for creating service catalogs :slight_smile:


#10

Hi Asad

There are some examples of calling Ansible Tower job templates from ManageIQ/CloudForms Automate in these chapters and blogs:

https://pemcg.gitbooks.io/mastering-automation-in-cloudforms-4-2-and-manage/content/running_an_ansible_tower_job_from_a_button/chapter.html

https://pemcg.gitbooks.io/mastering-automation-in-cloudforms-4-2-and-manage/content/creating_an_ansible_tower_service_catalog_item_and_bundle/chapter.html

One the of the things that catches people out is that you need to make sure that you have the ‘Prompt on launch’ tickbox ticked in Tower for the limits and extra_vars, otherwise ManageIQ/CloudForms won’t be able to override them when it launches the job template.

Hope this helps,
pemcg


#11

@Asad_Rajput try to modify your playbook

vars:
  sg_name: apple

tasks:
  name: Create a security group
  ...
    name: {{ sg_name }}

Try to avoid use a variable just call name because it is too common and confusing.
Then in the service dialog create a textfield param_sg_name


#12

@bill Dear the problem is this, i am using shade module os_security_group. Check the link please
http://docs.ansible.com/ansible/latest/os_security_group_module.html
The option of name in my script is required there is no any option to add vars: for name if so than please guide i have tried alot of time there are errors in playbook.


#13

Can you post your final script (playbook) and the error?


#14

@bill Dear i will share you a detail question that i really want to do with screen shot so it will be easy for you to understand. :slight_smile: