Start Template Properties
An Automic Automation Start Template job represents either a job template or a workflow template on the Ansible Tower environment with which it communicates through the Connection object. When you execute the Automic Automation Start Template Job, you trigger a run of the template on that target cloud environment. You can then monitor its execution from Automic Automation too. You define the Automic Automation Start Template job on various pages. This topic explains how to configure the Start Template Job page.
Remember, you must select the Ansible Tower Agent on the Attributes object definition page.
-
To configure an Automic Automation Start Template Job you must know certain parameters that are defined in the job on Ansible Tower, such as the Organization, Template ID and so forth. If you are not aware of them, you must request them from the team that works with the target cloud solution.
-
For an explanation of Ansible Tower terms and concepts, please refer to the official product documentation at https://docs.ansible.com/.
-
Connection
Connection object that has the relevant information to connect to the Ansible Tower environment. To search for a Connection object, start typing its name to limit the list of the objects that match your input.
-
Organization
This is the highest level in the Ansible Tower object hierarchy. It is a logical collection of users, teams, projects and inventories. Ansible Tower job and workflow templates reside in organizations. You select here the organization where the template resides that this Start Template Job should trigger. You have the following options:
-
Enter the name of the organization in the input field.
-
Click the browser button to open a dialog where you can search for and select the organization. The list in this dialog displays all the organizations available in the target cloud solution.
-
-
Job Type
Select the type of Ansible Tower job that this Start Job will trigger:
-
Workflow Template
Select this option for the Start Template Job to trigger the execution of a particular workflow template on your Ansible Tower environment.
-
Job Template
Select this option for the Start Template Job to trigger the execution of a particular job template on your Ansible Tower environment.
-
-
Template ID
Name of the template as defined on your Ansible Tower environment. This is the job on Ansible Tower that this Start Template job will trigger. You have two options:
-
Enter the name in the input field.
-
Click the browser button to open a dialog where you can search for and select it. The list in this dialog displays all the template IDs in the Organization that you have previously selected.
-
-
Extra Variable Data
So far, the standard definition fields on this page define the most important Job attributes. Use the Extra Variable Data if you want to specify additional attributes. Here you can write variables in JSON format for Ansible Tower job/workflow template attributes other than the ones available on this page. When the Automic Automation is executed, these values are passed on to the Ansible Tower job alongside the standard ones.
-
None
No additional fields are defined.
-
File Path
Path where the JSON file is stored that contains the additional variables and their values.
-
JSON
Select this option to display an input field where you can write the variables in JSON format.
Note: If you specify additional variables that are not defined in the Ansible Tower workflow/job template, the following error message is displayed in the Agent Log:
{"extra_vars":["Variables <variable name> are not allowed on launch. Check the Prompt on Launch setting on the Workflow Job Template to include Extra Variables."]}
-
-
Retrieve Job Output
This option lets you retrieve the event log (the job output) with execution information from the Ansible Tower environment. Specify here when the event log should be downloaded, either when the execution fails or always.
-
Job Output File Path
Enter the path where the event log will be stored. If you leave this field empty, the event log is stored in the temp folder of the Agent installation directory.
Consider the following:
-
If you enter the path but do not provide a name for the file, the following name will be used: event_logs_<JOB_RUN_ID>.
-
If you enter a path but the directory is missing, when executing the Job will create the directory.
-
If an output file already exists in the specified path, it will be overwritten.
-
-
Set Output Variables
This option lets you define variables that parse the content of the downloaded event log. You can then use the variables you define here for further processing. For example:
-
You add this Start Template Job to a Workflow. You use output variables in its Post Conditions tab and apply conditional actions to subsequent tasks in the Workflow based on the content of the variables.
-
You use the output variables in the scripts you write on the Process pages of the Job.
In the Output Variable Name you enter the name of the variable. The variable name CANNOT contain spaces.
In the JSON Expression column you write the JSON expression that specifies the value of the output variable.
If the JSON expression that you have defined returns multiple records and you want to store them under the same variable name, select Use Array.
Example:
We create a job and add two output variables
-
Output Variable Name: NAME
JSON Expression: $['count']. This will result in the number that results from
User Array: No
-
Output Variable Name: summary
JSON Expression: $.results[0].summary_fields.job. This will list the content of the job fields within summary_fields.
User Array: Yes
When the job executes, it writes the output to the event log. Based on the specified JSON expressions, the content of the log is parsed and the results are stored in the output variables.
To see the result of the parsing process once the Job has executed, do the following:
-
Open the Executions list.
-
If the list contains more than one execution of the job, select the one that you are interested in.
-
Select the Details button.
-
The Details pane contains information about the execution of the Job. Scroll down until you see the Object variables section. It displays the content of the resolved variables.
-
See also: