@ -58,11 +58,24 @@ extends_documentation_fragment: tower
'''
'''
EXAMPLES = '''
EXAMPLES = '''
# Launch a job template
- name : Launch a job
- name : Launch a job
tower_job_launch :
tower_job_launch :
job_template : " My Job Template "
job_template : " My Job Template "
register : job
register : job
- name : Wait for job max 120 s
tower_job_wait :
job_id : job . id
timeout : 120
# Launch job template with inventory and credential for prompt on launch
- name : Launch a job with inventory and credential
tower_job_launch :
job_template : " My Job Template "
inventory : " My Inventory "
credential : " My Credential "
register : job
- name : Wait for job max 120 s
- name : Wait for job max 120 s
tower_job_wait :
tower_job_wait :
job_id : job . id
job_id : job . id
@ -96,10 +109,10 @@ except ImportError:
def main ( ) :
def main ( ) :
argument_spec = dict (
argument_spec = dict (
job_template = dict ( required = True ),
job_template = dict ( required = True , type = ' str ' ),
job_type = dict ( choices = [ ' run ' , ' check ' , ' scan ' ] ) ,
job_type = dict ( choices = [ ' run ' , ' check ' , ' scan ' ] ) ,
inventory = dict ( ) ,
inventory = dict ( type = ' str ' , default = None ) ,
credential = dict ( ) ,
credential = dict ( type = ' str ' , default = None ) ,
limit = dict ( ) ,
limit = dict ( ) ,
tags = dict ( type = ' list ' ) ,
tags = dict ( type = ' list ' ) ,
extra_vars = dict ( type = ' list ' ) ,
extra_vars = dict ( type = ' list ' ) ,
@ -126,6 +139,7 @@ def main():
for field in lookup_fields :
for field in lookup_fields :
try :
try :
name = params . pop ( field )
name = params . pop ( field )
if name :
result = tower_cli . get_resource ( field ) . get ( name = name )
result = tower_cli . get_resource ( field ) . get ( name = name )
params [ field ] = result [ ' id ' ]
params [ field ] = result [ ' id ' ]
except exc . NotFound as excinfo :
except exc . NotFound as excinfo :