shanemcd.awx.workflow_job_template (20.0.14) — module

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

Authors: John Westcott IV (@john-westcott-iv)

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 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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a workflow job template
  workflow_job_template:
    name: example-workflow
    description: created by Ansible Playbook
    organization: Default
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Copy a workflow job template
  workflow_job_template:
    name: copy-workflow
    copy_from: example-workflow
    organization: Foo
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
name:
    description:
    - Name of this workflow job template.
    required: true
    type: str

limit:
    description:
    - Limit applied as a prompt, assuming job template prompts for limit
    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

schema:
    description:
    - A json list of nodes and their coresponding options. The following suboptions describe
      a single node.
    elements: dict
    suboptions:
      all_parents_must_converge:
        description:
        - If enabled then the node will only run if all of the parent nodes have met the
          criteria to reach this node
        type: bool
      diff_mode:
        description:
        - Run diff mode, applied as a prompt, if job template prompts for diff mode
        type: bool
      extra_data:
        default: {}
        description:
        - Variables to apply at launch time.
        - Will only be accepted if job template prompts for vars or has a survey asking
          for those vars.
        type: dict
      identifier:
        description:
        - An identifier for this node that is unique within its workflow.
        - It is copied to workflow job nodes corresponding to this node.
        required: true
        type: str
      inventory:
        description:
        - Inventory applied as a prompt, if job template prompts for inventory
        type: str
      job_tags:
        description:
        - Job tags applied as a prompt, if job template prompts for job tags
        type: str
      job_type:
        choices:
        - run
        - check
        description:
        - Job type applied as a prompt, if job template prompts for job type
        type: str
      limit:
        description:
        - Limit to act on, applied as a prompt, if job template prompts for limit
        type: str
      related:
        description:
        - Related items to this workflow node.
        - Must include credentials, failure_nodes, always_nodes, success_nodes, even if
          empty.
        suboptions:
          always_nodes:
            description:
            - Nodes that will run after this node completes.
            - List of node identifiers.
            suboptions:
              identifier:
                description:
                - Identifier of Node that will run after this node completes given this
                  option.
                elements: str
            type: list
          credentials:
            description:
            - Credentials to be applied to job as launch-time prompts.
            - List of credential names.
            - Uniqueness is not handled rigorously.
            suboptions:
              name:
                description:
                - Name Credentials to be applied to job as launch-time prompts.
                elements: str
            type: list
          failure_nodes:
            description:
            - Nodes that will run after this node on failure.
            - List of node identifiers.
            suboptions:
              identifier:
                description:
                - Identifier of Node that will run after this node completes given this
                  option.
                elements: str
            type: list
          success_nodes:
            description:
            - Nodes that will run after this node on success.
            - List of node identifiers.
            suboptions:
              identifier:
                description:
                - Identifier of Node that will run after this node completes given this
                  option.
                elements: str
            type: list
        type: dict
      scm_branch:
        description:
        - SCM branch applied as a prompt, if job template prompts for SCM branch
        type: str
      skip_tags:
        description:
        - Tags to skip, applied as a prompt, if job tempalte prompts for job tags
        type: str
      state:
        choices:
        - present
        - absent
        default: present
        description:
        - Desired state of the resource.
        type: str
      unified_job_template:
        description:
        - 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).
        suboptions:
          description:
            description:
            - Optional description of this workflow approval template.
            type: str
          inventory:
            description:
            - 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 C(organization).
            suboptions:
              organization:
                description:
                - Name of key for use in model for organizational reference
                suboptions:
                  name:
                    description:
                    - The organization of the inventory the node exists in.
                    - Used for looking up the job template or project, not a direct model
                      field.
                    type: str
                type: dict
            type: dict
          name:
            description:
            - Name of unified job template to run in the workflow.
            - Can be a job template, project, inventory source, etc.
            type: str
          organization:
            description:
            - 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 C(inventory).
            suboptions:
              name:
                description:
                - 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.
                type: str
            type: dict
          timeout:
            default: 0
            description:
            - 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: int
          type:
            description:
            - Name of unified job template type to run in the workflow.
            - Can be a job_template, project, inventory_source, workflow_approval.
            type: str
        type: dict
      verbosity:
        choices:
        - '0'
        - '1'
        - '2'
        - '3'
        - '4'
        - '5'
        description:
        - Verbosity applied as a prompt, if job template prompts for verbosity
        type: str
    type: list

new_name:
    description:
    - Setting this option will change the existing name.
    type: str

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

inventory:
    description:
    - Inventory applied as a prompt, assuming job template prompts for inventory
    type: str

extra_vars:
    description:
    - Variables which will be made available to jobs ran inside the workflow.
    type: dict

scm_branch:
    description:
    - SCM branch applied as a prompt, assuming job template prompts for SCM branch
    type: str

description:
    description:
    - Optional description of this workflow job template.
    type: str

survey_spec:
    aliases:
    - survey
    description:
    - The definition of the survey associated to the workflow.
    type: dict

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

survey_enabled:
    description:
    - Setting that variable will prompt the user for job type on the workflow launch.
    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

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

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

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

ask_limit_on_launch:
    description:
    - Prompt user for limit on launch of this workflow 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: shanemcd.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

destroy_current_schema:
    default: false
    description:
    - 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.
    type: bool

ask_inventory_on_launch:
    description:
    - Prompt user for inventory on launch of this workflow job template
    type: bool

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

ask_scm_branch_on_launch:
    description:
    - Prompt user for SCM branch on launch of this workflow job template
    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

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