mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 02:31:03 -03:30
Merge pull request #12115 from sean-m-sullivan/workflow_node_updates
update workflow nodes to allow workflows and system jobs
This commit is contained in:
@@ -261,7 +261,7 @@ options:
|
|||||||
type:
|
type:
|
||||||
description:
|
description:
|
||||||
- Name of unified job template type to run in the workflow.
|
- Name of unified job template type to run in the workflow.
|
||||||
- Can be a job_template, project, inventory_source, workflow_approval.
|
- Can be a job_template, project, inventory_source, system_job, workflow_approval, workflow_job_template.
|
||||||
type: str
|
type: str
|
||||||
timeout:
|
timeout:
|
||||||
description:
|
description:
|
||||||
@@ -490,13 +490,17 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
|
|||||||
if workflow_node['unified_job_template']['type'] is None:
|
if workflow_node['unified_job_template']['type'] is None:
|
||||||
module.fail_json(msg='Could not find unified job template type in workflow_nodes {1}'.format(workflow_node))
|
module.fail_json(msg='Could not find unified job template type in workflow_nodes {1}'.format(workflow_node))
|
||||||
if workflow_node['unified_job_template']['type'] == 'inventory_source':
|
if workflow_node['unified_job_template']['type'] == 'inventory_source':
|
||||||
organization_id = module.resolve_name_to_id('organizations', workflow_node['unified_job_template']['inventory']['organization']['name'])
|
if 'inventory' in workflow_node['unified_job_template']:
|
||||||
search_fields['organization'] = organization_id
|
if 'organization' in workflow_node['unified_job_template']['inventory']:
|
||||||
elif workflow_node['unified_job_template']['type'] == 'workflow_approval':
|
organization_id = module.resolve_name_to_id('organizations', workflow_node['unified_job_template']['inventory']['organization']['name'])
|
||||||
pass
|
search_fields['organization'] = organization_id
|
||||||
else:
|
else:
|
||||||
|
pass
|
||||||
|
elif 'organization' in workflow_node['unified_job_template']:
|
||||||
organization_id = module.resolve_name_to_id('organizations', workflow_node['unified_job_template']['organization']['name'])
|
organization_id = module.resolve_name_to_id('organizations', workflow_node['unified_job_template']['organization']['name'])
|
||||||
search_fields['organization'] = organization_id
|
search_fields['organization'] = organization_id
|
||||||
|
else:
|
||||||
|
pass
|
||||||
unified_job_template = module.get_one('unified_job_templates', name_or_id=workflow_node['unified_job_template']['name'], **{'data': search_fields})
|
unified_job_template = module.get_one('unified_job_templates', name_or_id=workflow_node['unified_job_template']['name'], **{'data': search_fields})
|
||||||
if unified_job_template:
|
if unified_job_template:
|
||||||
workflow_node_fields['unified_job_template'] = unified_job_template['id']
|
workflow_node_fields['unified_job_template'] = unified_job_template['id']
|
||||||
|
|||||||
@@ -585,6 +585,10 @@
|
|||||||
name: Default
|
name: Default
|
||||||
name: "{{ jt2_name }}"
|
name: "{{ jt2_name }}"
|
||||||
type: job_template
|
type: job_template
|
||||||
|
- identifier: Cleanup Job
|
||||||
|
unified_job_template:
|
||||||
|
name: Cleanup Activity Stream
|
||||||
|
type: system_job
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
@@ -624,6 +628,12 @@
|
|||||||
organization:
|
organization:
|
||||||
name: Default
|
name: Default
|
||||||
type: inventory_source
|
type: inventory_source
|
||||||
|
- identifier: Workflow inception
|
||||||
|
unified_job_template:
|
||||||
|
name: "{{ wfjt_name }}"
|
||||||
|
organization:
|
||||||
|
name: Default
|
||||||
|
type: workflow_job_template
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- name: Kick off a workflow and wait for it
|
- name: Kick off a workflow and wait for it
|
||||||
|
|||||||
Reference in New Issue
Block a user