fix job launch inputs

This commit is contained in:
sean-m-ssullivan
2021-05-01 19:14:55 -05:00
parent 929ed3e09d
commit 5993db76d3
2 changed files with 27 additions and 9 deletions

View File

@@ -176,22 +176,34 @@ def main():
optional_args = {}
# Extract our parameters
name = module.params.get('name')
optional_args['job_type'] = module.params.get('job_type')
inventory = module.params.get('inventory')
organization = module.params.get('organization')
credentials = module.params.get('credentials')
optional_args['limit'] = module.params.get('limit')
optional_args['tags'] = module.params.get('tags')
optional_args['extra_vars'] = module.params.get('extra_vars')
optional_args['scm_branch'] = module.params.get('scm_branch')
optional_args['skip_tags'] = module.params.get('skip_tags')
optional_args['verbosity'] = module.params.get('verbosity')
optional_args['diff_mode'] = module.params.get('diff_mode')
optional_args['credential_passwords'] = module.params.get('credential_passwords')
wait = module.params.get('wait')
interval = module.params.get('interval')
timeout = module.params.get('timeout')
for field_name in (
'job_type',
'limit',
'extra_vars',
'scm_branch',
'verbosity',
'diff_mode',
'credential_passwords',
):
field_val = module.params.get(field_name)
if field_val is not None:
optional_args[field_name] = field_val
# Special treatment of tags parameters
job_tags = module.params.get('tags')
if job_tags is not None:
optional_args['job_tags'] = ",".join(job_tags)
skip_tags = module.params.get('skip_tags')
if skip_tags is not None:
optional_args['skip_tags'] = ",".join(skip_tags)
# Create a datastructure to pass into our job launch
post_data = {}
for key in optional_args.keys():

View File

@@ -48,6 +48,8 @@
job_type: run
ask_credential: true
ask_inventory: true
ask_tags_on_launch: true
ask_skip_tags_on_launch: true
state: present
register: result
@@ -56,6 +58,10 @@
job_template: "{{ jt_name1 }}"
inventory: "Demo Inventory"
credential: "Demo Credential"
tags:
- sometimes
skip_tags:
- always
register: result
- assert: