shanemcd.awx.job_template (20.0.14) — module

create, update, or destroy Automation Platform Controller job templates.

Authors: Wayne Witzel III (@wwitzel3)

preview | supported by community

Install collection

Install with ansible-galaxy collection install shanemcd.awx:==20.0.14


Add to requirements.yml

  collections:
    - name: shanemcd.awx
      version: 20.0.14

Description

Create, update, or destroy Automation Platform Controller job templates. See U(https://www.ansible.com/tower) for an overview.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add start notification to Job Template
  job_template:
    name: "Ping"
    notification_templates_started:
      - Notification1
      - Notification2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove Notification1 start notification from Job Template
  job_template:
    name: "Ping"
    notification_templates_started:
      - Notification2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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"

Inputs

    
name:
    description:
    - Name to use for the job template.
    required: true
    type: str

forks:
    description:
    - The number of parallel or simultaneous processes to use while executing the playbook.
    type: int

limit:
    description:
    - A host pattern to further constrain the list of hosts managed or affected by the
      playbook
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Desired state of the resource.
    type: str

labels:
    description:
    - The labels applied to this job template
    - Must be created with the labels module first. This will error if the label has not
      been created.
    elements: str
    type: list

project:
    description:
    - Name of the project to use for the job template.
    type: str

timeout:
    description:
    - Maximum time in seconds to wait for a job to finish (server-side).
    type: int

job_tags:
    description:
    - Comma separated list of the tags to use for the job template.
    type: str

job_type:
    choices:
    - run
    - check
    description:
    - The job type to use for the job template.
    type: str

new_name:
    description:
    - Setting this option will change the existing name (looked up via the name field.
    type: str

playbook:
    description:
    - Path to the playbook to use for the job template within the project provided.
    type: str

copy_from:
    description:
    - 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.
    type: str

diff_mode:
    aliases:
    - diff_mode_enabled
    description:
    - Enable diff mode for the job template.
    type: bool

inventory:
    description:
    - Name of the inventory to use for the job template.
    type: str

skip_tags:
    description:
    - Comma separated list of the tags to skip for the job template.
    type: str

verbosity:
    choices:
    - 0
    - 1
    - 2
    - 3
    - 4
    default: 0
    description:
    - Control the output level Ansible produces as the playbook runs. 0 - Normal, 1 -
      Verbose, 2 - More Verbose, 3 - Debug, 4 - Connection Debug.
    type: int

credential:
    description:
    - Name of the credential to use for the job template.
    - Deprecated, use 'credentials'.
    type: str

extra_vars:
    description:
    - Specify C(extra_vars) for the template.
    type: dict

scm_branch:
    default: ''
    description:
    - Branch to use in job run. Project default used if blank. Only allowed if project
      allow_override field is set to true.
    type: str

credentials:
    description:
    - List of credentials to use for the job template.
    elements: str
    type: list

description:
    description:
    - Description to use for the job template.
    type: str

survey_spec:
    description:
    - JSON/YAML dict formatted survey definition.
    type: dict

organization:
    description:
    - 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.
    type: str

start_at_task:
    description:
    - Start the playbook at the task matching this name.
    type: str

become_enabled:
    description:
    - Activate privilege escalation.
    type: bool

force_handlers:
    aliases:
    - force_handlers_enabled
    default: 'no'
    description:
    - Enable forcing playbook handlers to run even if a task fails.
    type: bool

survey_enabled:
    description:
    - Enable a survey on the job template.
    type: bool

use_fact_cache:
    aliases:
    - fact_caching_enabled
    description:
    - Enable use of fact caching for the job template.
    type: bool

validate_certs:
    aliases:
    - tower_verify_ssl
    description:
    - Whether to allow insecure connections to AWX.
    - If C(no), SSL certificates will not be validated.
    - This should only be used on personally controlled sites using self-signed certificates.
    - If value not set, will try environment variable C(CONTROLLER_VERIFY_SSL) and then
      config files
    type: bool

controller_host:
    aliases:
    - tower_host
    description:
    - URL to your Automation Platform Controller instance.
    - If value not set, will try environment variable C(CONTROLLER_HOST) and then config
      files
    - If value not specified by any means, the value of C(127.0.0.1) will be used
    type: str

host_config_key:
    description:
    - Allow provisioning callbacks using this host config key.
    type: str

instance_groups:
    description:
    - list of Instance Groups for this Organization to run on.
    elements: str
    type: list

job_slice_count:
    default: '1'
    description:
    - The number of jobs to slice into at runtime. Will cause the Job Template to launch
      a workflow if value is greater than 1.
    type: int

webhook_service:
    choices:
    - ''
    - github
    - gitlab
    description:
    - Service that webhook requests will be accepted from
    type: str

vault_credential:
    description:
    - Name of the vault credential to use for the job template.
    - Deprecated, use 'credentials'.
    type: str

custom_virtualenv:
    description:
    - 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
    type: str

allow_simultaneous:
    aliases:
    - concurrent_jobs_enabled
    description:
    - Allow simultaneous runs of the job template.
    type: bool

ask_tags_on_launch:
    aliases:
    - ask_tags
    description:
    - Prompt user for job tags on launch.
    type: bool

webhook_credential:
    description:
    - Personal Access Token for posting back the status to the service API
    type: str

ask_limit_on_launch:
    aliases:
    - ask_limit
    description:
    - Prompt user for a limit on launch.
    type: bool

controller_password:
    aliases:
    - tower_password
    description:
    - Password for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_PASSWORD) and then
      config files
    type: str

controller_username:
    aliases:
    - tower_username
    description:
    - Username for your controller instance.
    - If value not set, will try environment variable C(CONTROLLER_USERNAME) and then
      config files
    type: str

controller_oauthtoken:
    aliases:
    - tower_oauthtoken
    description:
    - 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 C(CONTROLLER_OAUTH_TOKEN) and then
      config files
    type: raw
    version_added: 3.7.0
    version_added_collection: shanemcd.awx

execution_environment:
    description:
    - Execution Environment to use for the JT.
    type: str

ask_job_type_on_launch:
    aliases:
    - ask_job_type
    description:
    - Prompt user for job type on launch.
    type: bool

controller_config_file:
    aliases:
    - tower_config_file
    description:
    - Path to the controller config file.
    - If provided, the other locations for config files will not be considered.
    type: path

ask_diff_mode_on_launch:
    aliases:
    - ask_diff_mode
    description:
    - Prompt user to enable diff mode (show changes) to files when supported by modules.
    type: bool

ask_inventory_on_launch:
    aliases:
    - ask_inventory
    description:
    - Prompt user for inventory on launch.
    type: bool

ask_skip_tags_on_launch:
    aliases:
    - ask_skip_tags
    description:
    - Prompt user for job tags to skip on launch.
    type: bool

ask_variables_on_launch:
    aliases:
    - ask_extra_vars
    description:
    - Prompt user for (extra_vars) on launch.
    type: bool

ask_verbosity_on_launch:
    aliases:
    - ask_verbosity
    description:
    - Prompt user to choose a verbosity level on launch.
    type: bool

ask_credential_on_launch:
    aliases:
    - ask_credential
    description:
    - Prompt user for credential on launch.
    type: bool

ask_scm_branch_on_launch:
    description:
    - Prompt user for (scm branch) on launch.
    type: bool

notification_templates_error:
    description:
    - list of notifications to send on error
    elements: str
    type: list

notification_templates_started:
    description:
    - list of notifications to send on start
    elements: str
    type: list

notification_templates_success:
    description:
    - list of notifications to send on success
    elements: str
    type: list