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:
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
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.
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!