Create a service dialog from an AnsibleTower job template


#1

Recently I was asked whether we can create a service dialog out of the survey spec in an AnsibleTower job template. The answer is yes - it is already in place in manageiq as a convenience tool, but it seems not everybody knows where it is and how to use it.

On page Configuration -> Management -> Ansible Tower Job Templates, once a job template is selected, menu Configuration -> Create Service Dialog from this Job Template is enabled. After given a name, a service dialog is created and stored in the database. This is how it looks for the above sample job template:

There are three sections in the dialog:

Options

Every auto-generated dialog has a text field called Limit. Here you can further limit at runtime the nodes the playbook can be deployed to. Please reference to Ansible documentation for the usage and syntax of limit

Survey

An AnsibleTower job template can optionally define a set of survey questions with descriptions and constraints. These are questions that normally a user needs to answer during the deployment of the playbook. These survey specs are translated into corresponding ManageIQ service dialog fields.

Extra Variables

An AnsibleTower job template can further define a set of extra variables with default values that advanced users can override. There is no description for the extra variables, and they are less likely to be modified. Therefore they are present in a read-only text field. If you really need to override some of the variables you need to edit the dialog and uncheck the read-only attribute for the text field.

This service dialog tool only serves as a convenience for you to begin with. The resulting dialog is mainly target to be used by a catalog item with type AnsibleTower; but you have the freedom to further tailor to your own need. For example you may want to remove the limit section if the dialog is to be used by a button to launch an AnsibleTower job for a VM. You may also want to delete the entire variable section if you don’t want your user to see and raise unnecessary questions at all. Once the dialog is created please go ahead and try to edit it. It helps you to get familiar with how the dialog fields are auto-named. You need to add prefix to the field keys if the dialog is to be used by a bundle and the values of the fields need to be passed unto the child items.

Lastly you don’t have to use the machine generated service dialog. You can always use your creativity to design your own service dialog with a different layout.

You may already notice that the way to create a service dialog from an AnsibleTower job template is very similar to the way creating a dialog from an Orchestration Template. If you never used it before you can go to Services -> Catalogs -> Orchestration Templates and try it out!


#2

I have a couple of questions

  1. Would the “Create Service Dialog from this Job Template” be only enabled if the Job Template has an associated Survey?

  2. If the user changes the Survey in the Ansible Tower for the Job Template e.g. adding/deleting/updating parameters. And the user creates the new Dialog using ManageIQ would there be some connection to the old Dialog that was generated? Would the Service Dialog have a new name or would it use the old name?

  3. Is there parity between the data types supported in Survey creation and the data types supported in the ManageIQ dialog?

  4. If there are any invalid data types would CFME create a partial dialog that the user could then embellish?


#3

No. The option is enabled for any job template. At least the limit section is added regardless the template has survey spec or extra vars or not. The other sections are optionally added based on the existence of survey spec or extra vars.


#4

Each creation is independent. No connection is made to previously generated dialogs. The name is supplied by the user who selects the menu. An error will be raised if the name has been used.[quote=“mkanoor, post:2, topic:1927”]
Is there parity between the data types supported in Survey creation and the data types supported in the ManageIQ dialog?
If there are any invalid data types would CFME create a partial dialog that the user could then embellish?
[/quote]

Currently any survey spec is translated to dropdown (single selection), text area, or text field. Text field is the fallback option, so the dialog creation will always complete. User can continue to edit the dialog and embellish the way they want.

Recently CFME added support to multi-selection dropdown. We will enhance the dialog generation tool soon.