awx.awx.workflow_job_template – create, update, or destroy Automation Platform Controller workflow job templates.

Note

This plugin is part of the awx.awx collection (version 19.2.2).

To install it use: ansible-galaxy collection install awx.awx.

To use it in a playbook, specify: awx.awx.workflow_job_template.

Synopsis

  • Create, update, or destroy Automation Platform Controller workflow job templates.

  • Replaces the deprecated tower_workflow_template module.

  • Use workflow_job_template_node after this, or use the schema parameter to build the workflow’s graph

Parameters

Parameter Choices/Defaults Comments
allow_simultaneous
boolean
    Choices:
  • no
  • yes
Allow simultaneous runs of the workflow job template.
ask_inventory_on_launch
boolean
    Choices:
  • no
  • yes
Prompt user for inventory on launch of this workflow job template
ask_limit_on_launch
boolean
    Choices:
  • no
  • yes
Prompt user for limit on launch of this workflow job template
ask_scm_branch_on_launch
boolean
    Choices:
  • no
  • yes
Prompt user for SCM branch on launch of this workflow job template
ask_variables_on_launch
boolean
    Choices:
  • no
  • yes
Prompt user for extra_vars on launch.
controller_config_file
path
Path to the controller config file.
If provided, the other locations for config files will not be considered.

aliases: tower_config_file
controller_host
string
URL to your Automation Platform Controller instance.
If value not set, will try environment variable CONTROLLER_HOST and then config files
If value not specified by any means, the value of 127.0.0.1 will be used

aliases: tower_host
controller_oauthtoken
raw
added in 3.7.0 of awx.awx
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 CONTROLLER_OAUTH_TOKEN and then config files

aliases: tower_oauthtoken
controller_password
string
Password for your controller instance.
If value not set, will try environment variable CONTROLLER_PASSWORD and then config files

aliases: tower_password
controller_username
string
Username for your controller instance.
If value not set, will try environment variable CONTROLLER_USERNAME and then config files

aliases: tower_username
copy_from
string
Name or id to copy the workflow job template from.
This will copy an existing workflow job template and change any parameters supplied.
The new workflow 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 workflow job templates share the same name.
description
string
Optional description of this workflow job template.
destroy_current_schema
boolean
    Choices:
  • no ←
  • yes
Set in order to destroy current schema on the workflow.
This option is used for full schema update, if not used, nodes not described in schema will persist and keep current associations and links.
extra_vars
dictionary
Variables which will be made available to jobs ran inside the workflow.
inventory
string
Inventory applied as a prompt, assuming job template prompts for inventory
labels
list / elements=string
The labels applied to this job template
limit
string
Limit applied as a prompt, assuming job template prompts for limit
name
string / required
Name of this workflow job template.
new_name
string
Setting this option will change the existing name.
notification_templates_approvals
list / elements=string
list of notifications to send on start
notification_templates_error
list / elements=string
list of notifications to send on error
notification_templates_started
list / elements=string
list of notifications to send on start
notification_templates_success
list / elements=string
list of notifications to send on success
organization
string
Organization the workflow job template exists in.
Used to help lookup the object, cannot be modified using this module.
If not provided, will lookup by name only, which does not work with duplicates.
schema
list / elements=dictionary
A json list of nodes and their coresponding options. The following suboptions describe a single node.
all_parents_must_converge
boolean
    Choices:
  • no
  • yes
If enabled then the node will only run if all of the parent nodes have met the criteria to reach this node
diff_mode
boolean
    Choices:
  • no
  • yes
Run diff mode, applied as a prompt, if job template prompts for diff mode
extra_data
dictionary
Default:
{}
Variables to apply at launch time.
Will only be accepted if job template prompts for vars or has a survey asking for those vars.
identifier
string / required
An identifier for this node that is unique within its workflow.
It is copied to workflow job nodes corresponding to this node.
inventory
string
Inventory applied as a prompt, if job template prompts for inventory
job_tags
string
Job tags applied as a prompt, if job template prompts for job tags
job_type
string
    Choices:
  • run
  • check
Job type applied as a prompt, if job template prompts for job type
limit
string
Limit to act on, applied as a prompt, if job template prompts for limit
related
dictionary
Related items to this workflow node.
Must include credentials, failure_nodes, always_nodes, success_nodes, even if empty.
always_nodes
list / elements=string
Nodes that will run after this node completes.
List of node identifiers.
identifier
string
Identifier of Node that will run after this node completes given this option.
credentials
list / elements=string
Credentials to be applied to job as launch-time prompts.
List of credential names.
Uniqueness is not handled rigorously.
name
string
Name Credentials to be applied to job as launch-time prompts.
failure_nodes
list / elements=string
Nodes that will run after this node on failure.
List of node identifiers.
identifier
string
Identifier of Node that will run after this node completes given this option.
success_nodes
list / elements=string
Nodes that will run after this node on success.
List of node identifiers.
identifier
string
Identifier of Node that will run after this node completes given this option.
scm_branch
string
SCM branch applied as a prompt, if job template prompts for SCM branch
skip_tags
string
Tags to skip, applied as a prompt, if job tempalte prompts for job tags
state
string
    Choices:
  • present ←
  • absent
Desired state of the resource.
unified_job_template
dictionary
Name of unified job template to run in the workflow.
Can be a job template, project sync, inventory source sync, etc.
Omit if creating an approval node (not yet implemented).
description
string
Optional description of this workflow approval template.
inventory
dictionary
Name of key for use in model for organizational reference
Only Valid and used if referencing an inventory sync
This parameter is mutually exclusive with suboption organization.
organization
dictionary
Name of key for use in model for organizational reference
name
string
The organization of the inventory the node exists in.
Used for looking up the job template or project, not a direct model field.
name
string
Name of unified job template to run in the workflow.
Can be a job template, project, inventory source, etc.
organization
dictionary
Name of key for use in model for organizational reference
Only Valid and used if referencing a job template or project sync
This parameter is mutually exclusive with suboption inventory.
name
string
The organization of the job template or project sync the node exists in.
Used for looking up the job template or project sync, not a direct model field.
timeout
integer
Default:
0
The amount of time (in seconds) to wait before Approval is canceled. A value of 0 means no timeout.
Only Valid and used if referencing an Approval Node
type
string
Name of unified job template type to run in the workflow.
Can be a job_template, project, inventory_source, workflow_approval.
verbosity
string
    Choices:
  • 0
  • 1
  • 2
  • 3
  • 4
  • 5
Verbosity applied as a prompt, if job template prompts for verbosity
scm_branch
string
SCM branch applied as a prompt, assuming job template prompts for SCM branch
state
string
    Choices:
  • present ←
  • absent
Desired state of the resource.
survey_enabled
boolean
    Choices:
  • no
  • yes
Setting that variable will prompt the user for job type on the workflow launch.
survey_spec
dictionary
The definition of the survey associated to the workflow.

aliases: survey
validate_certs
boolean
    Choices:
  • no
  • yes
Whether to allow insecure connections to AWX.
If 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 CONTROLLER_VERIFY_SSL and then config files

aliases: tower_verify_ssl
webhook_credential
string
Personal Access Token for posting back the status to the service API
webhook_service
string
    Choices:
  • github
  • gitlab
Service that webhook requests will be accepted from

Notes

Note

  • 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 a workflow job template
  workflow_job_template:
    name: example-workflow
    description: created by Ansible Playbook
    organization: Default

- name: Create a workflow job template with schema in template
  awx.awx.workflow_job_template:
    name: example-workflow
    inventory: Demo Inventory
    extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
    schema:
      - identifier: node101
        unified_job_template:
          name: example-project
          inventory:
            organization:
              name: Default
          type: inventory_source
        related:
          success_nodes: []
          failure_nodes:
            - identifier: node201
          always_nodes: []
          credentials: []
      - identifier: node201
        unified_job_template:
          organization:
            name: Default
          name: job template 1
          type: job_template
        credentials: []
        related:
          success_nodes:
            - identifier: node301
          failure_nodes: []
          always_nodes: []
          credentials: []
      - identifier: node202
        unified_job_template:
          organization:
            name: Default
          name: example-project
          type: project
        related:
          success_nodes: []
          failure_nodes: []
          always_nodes: []
          credentials: []
      - identifier: node301
        all_parents_must_converge: false
        unified_job_template:
          organization:
            name: Default
          name: job template 2
          type: job_template
        related:
          success_nodes: []
          failure_nodes: []
          always_nodes: []
          credentials: []
  register: result

- name: Copy a workflow job template
  workflow_job_template:
    name: copy-workflow
    copy_from: example-workflow
    organization: Foo

- name: Create a workflow job template with schema in template
  awx.awx.workflow_job_template:
    name: example-workflow
    inventory: Demo Inventory
    extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
    schema:
      - identifier: node101
        unified_job_template:
          name: example-project
          inventory:
            organization:
              name: Default
          type: inventory_source
        related:
          success_nodes: []
          failure_nodes:
            - identifier: node201
          always_nodes: []
          credentials: []
      - identifier: node201
        unified_job_template:
          organization:
            name: Default
          name: job template 1
          type: job_template
        credentials: []
        related:
          success_nodes:
            - identifier: node301
          failure_nodes: []
          always_nodes: []
          credentials: []
      - identifier: node202
        unified_job_template:
          organization:
            name: Default
          name: example-project
          type: project
        related:
          success_nodes: []
          failure_nodes: []
          always_nodes: []
          credentials: []
      - identifier: node301
        all_parents_must_converge: false
        unified_job_template:
          organization:
            name: Default
          name: job template 2
          type: job_template
        related:
          success_nodes: []
          failure_nodes: []
          always_nodes: []
          credentials: []
  register: result

Authors

  • John Westcott IV (@john-westcott-iv)