ansible.builtin.tower_job_launch (v2.9.24) — module

Launch an Ansible Job.

| "added in version" 2.3 of ansible.builtin"

Authors: Wayne Witzel III (@wwitzel3)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.24

Description

Launch an Ansible Tower jobs. See U(https://www.ansible.com/tower) for an overview.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Launch a job template
- name: Launch a job
  tower_job_launch:
    job_template: "My Job Template"
  register: job
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Wait for job max 120s
  tower_job_wait:
    job_id: "{{ job.id }}"
    timeout: 120
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Launch job template with inventory and credential for prompt on launch
- name: Launch a job with inventory and credential
  tower_job_launch:
    job_template: "My Job Template"
    inventory: "My Inventory"
    credential: "My Credential"
  register: job
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Wait for job max 120s
  tower_job_wait:
    job_id: "{{ job.id }}"
    timeout: 120

Inputs

    
tags:
    description:
    - Specific tags to use for from playbook.

limit:
    description:
    - Limit to use for the I(job_template).

job_type:
    choices:
    - run
    - check
    - scan
    description:
    - Job_type to use for the job, only used if prompt for job_type is set.

inventory:
    description:
    - Inventory to use for the job, only used if prompt for inventory is set.

credential:
    description:
    - Credential to use for job, only used if prompt for credential is set.

extra_vars:
    description:
    - Extra_vars to use for the job_template. Prepend C(@) if a file.

job_template:
    description:
    - Name of the job template to use.
    required: true

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

job_explanation:
    description:
    - Job explanation field.

use_job_endpoint:
    default: 'no'
    description:
    - Disable launching jobs from job template.
    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: awx.awx

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

Outputs

id:
  description: job id of the newly launched job
  returned: success
  sample: 86
  type: int
status:
  description: status of newly launched job
  returned: success
  sample: pending
  type: str