awx.awx.job_template module – create, update, or destroy Automation Platform Controller job templates.
Note
This module is part of the awx.awx collection (version 19.4.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install awx.awx
.
To use it in a playbook, specify: awx.awx.job_template
.
Synopsis
Create, update, or destroy Automation Platform Controller job templates. See https://www.ansible.com/tower for an overview.
Parameters
Parameter |
Comments |
---|---|
Allow simultaneous runs of the job template. Choices:
|
|
Prompt user for credential on launch. Choices:
|
|
Prompt user to enable diff mode (show changes) to files when supported by modules. Choices:
|
|
Prompt user for inventory on launch. Choices:
|
|
Prompt user for job type on launch. Choices:
|
|
Prompt user for a limit on launch. Choices:
|
|
Prompt user for (scm branch) on launch. Choices:
|
|
Prompt user for job tags to skip on launch. Choices:
|
|
Prompt user for job tags on launch. Choices:
|
|
Prompt user for (extra_vars) on launch. Choices:
|
|
Prompt user to choose a verbosity level on launch. Choices:
|
|
Activate privilege escalation. Choices:
|
|
Path to the controller config file. If provided, the other locations for config files will not be considered. |
|
URL to your Automation Platform Controller instance. If value not set, will try environment variable If value not specified by any means, the value of |
|
The OAuth token to use. This value can be in one of two formats. A string which is the token itself. (i.e. bqV5txm97wqJqtkxlMkhQz0pKhRMMX) A dictionary structure as returned by the token module. If value not set, will try environment variable |
|
Password for your controller instance. If value not set, will try environment variable |
|
Username for your controller instance. If value not set, will try environment variable |
|
Name or id to copy the job template from. This will copy an existing job template and change any parameters supplied. The new job template name will be the one provided in the name parameter. The organization parameter is not used in this, to facilitate copy from one organization to another. Provide the id or use the lookup plugin to provide the id if multiple job templates share the same name. |
|
Name of the credential to use for the job template. Deprecated, use ‘credentials’. |
|
List of credentials to use for the job template. |
|
Local absolute file path containing a custom Python virtualenv to use. Only compatible with older versions of AWX/Tower Deprecated, will be removed in the future |
|
Description to use for the job template. |
|
Enable diff mode for the job template. Choices:
|
|
Execution Environment to use for the JT. |
|
Specify |
|
Enable forcing playbook handlers to run even if a task fails. Choices:
|
|
The number of parallel or simultaneous processes to use while executing the playbook. |
|
Allow provisioning callbacks using this host config key. |
|
list of Instance Groups for this Organization to run on. |
|
Name of the inventory to use for the job template. |
|
The number of jobs to slice into at runtime. Will cause the Job Template to launch a workflow if value is greater than 1. Default: “1” |
|
Comma separated list of the tags to use for the job template. |
|
The job type to use for the job template. Choices:
|
|
The labels applied to this job template |
|
A host pattern to further constrain the list of hosts managed or affected by the playbook |
|
Name to use for the job template. |
|
Setting this option will change the existing name (looed up via the name field. |
|
list of notifications to send on error |
|
list of notifications to send on start |
|
list of notifications to send on success |
|
Organization the job template exists in. Used to help lookup the object, cannot be modified using this module. The Organization is inferred from the associated project If not provided, will lookup by name only, which does not work with duplicates. Requires Automation Platform Version 3.7.0 or AWX 10.0.0 IS NOT backwards compatible with earlier versions. |
|
Path to the playbook to use for the job template within the project provided. |
|
Name of the project to use for the job template. |
|
Branch to use in job run. Project default used if blank. Only allowed if project allow_override field is set to true. Default: “” |
|
Comma separated list of the tags to skip for the job template. |
|
Start the playbook at the task matching this name. |
|
Desired state of the resource. Choices:
|
|
Enable a survey on the job template. Choices:
|
|
JSON/YAML dict formatted survey definition. |
|
Maximum time in seconds to wait for a job to finish (server-side). |
|
Enable use of fact caching for the job template. Choices:
|
|
Whether to allow insecure connections to AWX. If This should only be used on personally controlled sites using self-signed certificates. If value not set, will try environment variable Choices:
|
|
Name of the vault credential to use for the job template. Deprecated, use ‘credentials’. |
|
Control the output level Ansible produces as the playbook runs. 0 - Normal, 1 - Verbose, 2 - More Verbose, 3 - Debug, 4 - Connection Debug. Choices:
Default: 0 |
|
Personal Access Token for posting back the status to the service API |
|
Service that webhook requests will be accepted from Choices:
|
Notes
Note
JSON for survey_spec can be found in the API Documentation. See https://docs.ansible.com/ansible-tower/latest/html/towerapi/api_ref.html#/Job_Templates/Job_Templates_job_templates_survey_spec_create for POST operation payload example.
If no config_file is provided we will attempt to use the tower-cli library defaults to find your host information.
config_file should be in the following format host=hostname username=username password=password
Examples
- name: Create Ping job template
job_template:
name: "Ping"
job_type: "run"
organization: "Default"
inventory: "Local"
project: "Demo"
playbook: "ping.yml"
credentials:
- "Local"
state: "present"
controller_config_file: "~/tower_cli.cfg"
survey_enabled: yes
survey_spec: "{{ lookup('file', 'my_survey.json') }}"
- name: Add start notification to Job Template
job_template:
name: "Ping"
notification_templates_started:
- Notification1
- Notification2
- name: Remove Notification1 start notification from Job Template
job_template:
name: "Ping"
notification_templates_started:
- Notification2
- name: Copy Job Template
job_template:
name: copy job template
copy_from: test job template
job_type: "run"
inventory: Copy Foo Inventory
project: test
playbook: hello_world.yml
state: "present"
Authors
Wayne Witzel III (@wwitzel3)