mirror of
https://github.com/ansible/awx.git
synced 2026-03-22 03:17:39 -02:30
update awx collection workflow module schema with new options (#13162)
This commit is contained in:
@@ -84,7 +84,7 @@ options:
|
|||||||
type: str
|
type: str
|
||||||
execution_environment:
|
execution_environment:
|
||||||
description:
|
description:
|
||||||
- Execution Environment to use for the JT.
|
- Execution Environment to use for the job template.
|
||||||
type: str
|
type: str
|
||||||
custom_virtualenv:
|
custom_virtualenv:
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -208,6 +208,29 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Limit to act on, applied as a prompt, if job template prompts for limit
|
- Limit to act on, applied as a prompt, if job template prompts for limit
|
||||||
type: str
|
type: str
|
||||||
|
forks:
|
||||||
|
description:
|
||||||
|
- The number of parallel or simultaneous processes to use while executing the playbook, if job template prompts for forks
|
||||||
|
type: int
|
||||||
|
job_slice_count:
|
||||||
|
description:
|
||||||
|
- The number of jobs to slice into at runtime, if job template prompts for job slices. Will cause the Job Template to launch a workflow if value is greater than 1.
|
||||||
|
type: int
|
||||||
|
default: '1'
|
||||||
|
timeout:
|
||||||
|
description:
|
||||||
|
- Maximum time in seconds to wait for a job to finish (server-side), if job template prompts for timeout.
|
||||||
|
type: int
|
||||||
|
execution_environment:
|
||||||
|
description:
|
||||||
|
- Name of Execution Environment to be applied to job as launch-time prompts.
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Name of Execution Environment to be applied to job as launch-time prompts.
|
||||||
|
- Uniqueness is not handled rigorously.
|
||||||
|
type: str
|
||||||
diff_mode:
|
diff_mode:
|
||||||
description:
|
description:
|
||||||
- Run diff mode, applied as a prompt, if job template prompts for diff mode
|
- Run diff mode, applied as a prompt, if job template prompts for diff mode
|
||||||
@@ -298,7 +321,6 @@ options:
|
|||||||
related:
|
related:
|
||||||
description:
|
description:
|
||||||
- Related items to this workflow node.
|
- Related items to this workflow node.
|
||||||
- Must include credentials, failure_nodes, always_nodes, success_nodes, even if empty.
|
|
||||||
type: dict
|
type: dict
|
||||||
suboptions:
|
suboptions:
|
||||||
always_nodes:
|
always_nodes:
|
||||||
@@ -342,6 +364,46 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Name Credentials to be applied to job as launch-time prompts.
|
- Name Credentials to be applied to job as launch-time prompts.
|
||||||
elements: str
|
elements: str
|
||||||
|
organization:
|
||||||
|
description:
|
||||||
|
- Name of key for use in model for organizational reference
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The organization of the credentials exists in.
|
||||||
|
type: str
|
||||||
|
labels:
|
||||||
|
description:
|
||||||
|
- Labels to be applied to job as launch-time prompts.
|
||||||
|
- List of Label names.
|
||||||
|
- Uniqueness is not handled rigorously.
|
||||||
|
type: list
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Name Labels to be applied to job as launch-time prompts.
|
||||||
|
elements: str
|
||||||
|
organization:
|
||||||
|
description:
|
||||||
|
- Name of key for use in model for organizational reference
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The organization of the label node exists in.
|
||||||
|
type: str
|
||||||
|
instance_groups:
|
||||||
|
description:
|
||||||
|
- Instance groups to be applied to job as launch-time prompts.
|
||||||
|
- List of Instance group names.
|
||||||
|
- Uniqueness is not handled rigorously.
|
||||||
|
type: list
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Name of Instance groups to be applied to job as launch-time prompts.
|
||||||
|
elements: str
|
||||||
destroy_current_nodes:
|
destroy_current_nodes:
|
||||||
description:
|
description:
|
||||||
- Set in order to destroy current workflow_nodes on the workflow.
|
- Set in order to destroy current workflow_nodes on the workflow.
|
||||||
@@ -474,11 +536,21 @@ EXAMPLES = '''
|
|||||||
name: Default
|
name: Default
|
||||||
name: job template 2
|
name: job template 2
|
||||||
type: job_template
|
type: job_template
|
||||||
|
execution_environment:
|
||||||
|
name: My EE
|
||||||
related:
|
related:
|
||||||
success_nodes: []
|
credentials:
|
||||||
failure_nodes: []
|
- name: cyberark
|
||||||
always_nodes: []
|
organization:
|
||||||
credentials: []
|
name: Default
|
||||||
|
instance_groups:
|
||||||
|
- name: SunCavanaugh Cloud
|
||||||
|
- name: default
|
||||||
|
labels:
|
||||||
|
- name: Custom Label
|
||||||
|
- name: Another Custom Label
|
||||||
|
organization:
|
||||||
|
name: Default
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
'''
|
'''
|
||||||
@@ -547,6 +619,9 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
|
|||||||
'limit',
|
'limit',
|
||||||
'diff_mode',
|
'diff_mode',
|
||||||
'verbosity',
|
'verbosity',
|
||||||
|
'forks',
|
||||||
|
'job_slice_count',
|
||||||
|
'timeout',
|
||||||
'all_parents_must_converge',
|
'all_parents_must_converge',
|
||||||
'state',
|
'state',
|
||||||
):
|
):
|
||||||
@@ -555,6 +630,10 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
|
|||||||
workflow_node_fields[field_name] = field_val
|
workflow_node_fields[field_name] = field_val
|
||||||
if workflow_node['identifier']:
|
if workflow_node['identifier']:
|
||||||
search_fields = {'identifier': workflow_node['identifier']}
|
search_fields = {'identifier': workflow_node['identifier']}
|
||||||
|
if 'execution_environment' in workflow_node:
|
||||||
|
workflow_node_fields['execution_environment'] = module.get_one(
|
||||||
|
'execution_environments', name_or_id=workflow_node['execution_environment']['name']
|
||||||
|
)['id']
|
||||||
|
|
||||||
# Set Search fields
|
# Set Search fields
|
||||||
search_fields['workflow_job_template'] = workflow_node_fields['workflow_job_template'] = workflow_id
|
search_fields['workflow_job_template'] = workflow_node_fields['workflow_job_template'] = workflow_id
|
||||||
@@ -641,15 +720,26 @@ def create_workflow_nodes_association(module, response, workflow_nodes, workflow
|
|||||||
# Get id's for association fields
|
# Get id's for association fields
|
||||||
association_fields = {}
|
association_fields = {}
|
||||||
|
|
||||||
for association in ('always_nodes', 'success_nodes', 'failure_nodes', 'credentials'):
|
for association in (
|
||||||
|
'always_nodes',
|
||||||
|
'success_nodes',
|
||||||
|
'failure_nodes',
|
||||||
|
'credentials',
|
||||||
|
'labels',
|
||||||
|
'instance_groups',
|
||||||
|
):
|
||||||
# Extract out information if it exists
|
# Extract out information if it exists
|
||||||
# Test if it is defined, else move to next association.
|
# Test if it is defined, else move to next association.
|
||||||
|
prompt_lookup = ['credentials', 'labels', 'instance_groups']
|
||||||
if association in workflow_node['related']:
|
if association in workflow_node['related']:
|
||||||
id_list = []
|
id_list = []
|
||||||
|
lookup_data = {}
|
||||||
for sub_name in workflow_node['related'][association]:
|
for sub_name in workflow_node['related'][association]:
|
||||||
if association == 'credentials':
|
if association in prompt_lookup:
|
||||||
endpoint = 'credentials'
|
endpoint = association
|
||||||
lookup_data = {'name': sub_name['name']}
|
if 'organization' in sub_name:
|
||||||
|
lookup_data['organization'] = module.resolve_name_to_id('organizations', sub_name['organization']['name'])
|
||||||
|
lookup_data['name'] = sub_name['name']
|
||||||
else:
|
else:
|
||||||
endpoint = 'workflow_job_template_nodes'
|
endpoint = 'workflow_job_template_nodes'
|
||||||
lookup_data = {'identifier': sub_name['identifier']}
|
lookup_data = {'identifier': sub_name['identifier']}
|
||||||
|
|||||||
@@ -729,6 +729,24 @@
|
|||||||
organization:
|
organization:
|
||||||
name: Default
|
name: Default
|
||||||
type: workflow_job_template
|
type: workflow_job_template
|
||||||
|
forks: 12
|
||||||
|
job_slice_count: 2
|
||||||
|
timeout: 23
|
||||||
|
execution_environment:
|
||||||
|
name: "{{ ee1 }}"
|
||||||
|
related:
|
||||||
|
credentials:
|
||||||
|
- name: "{{ scm_cred_name }}"
|
||||||
|
organization:
|
||||||
|
name: Default
|
||||||
|
instance_groups:
|
||||||
|
- name: "{{ ig1 }}"
|
||||||
|
- name: "{{ ig2 }}"
|
||||||
|
labels:
|
||||||
|
- name: "{{ label1 }}"
|
||||||
|
- name: "{{ label2 }}"
|
||||||
|
organization:
|
||||||
|
name: "{{ org_name }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Delete copied workflow job template
|
- name: Delete copied workflow job template
|
||||||
|
|||||||
Reference in New Issue
Block a user