108
108
True if the state was changed, otherwise False.
109
109
returned: always
110
110
type: bool
111
+ sample: True
111
112
jobs:
112
113
description:
113
114
The output information for a list of jobs matching specified criteria.
153
154
The job entry subsystem that MVS uses to do work.
154
155
type: str
155
156
sample: STL1
156
- cpu_time :
157
+ origin_node :
157
158
description:
158
- Sum of the CPU time used by each job step, in microseconds .
159
- type: int
160
- sample: 5
159
+ Origin node that submitted the job.
160
+ type: str
161
+ sample: "STL1"
161
162
execution_node:
162
163
description:
163
164
Execution node that picked the job and executed it.
164
165
type: str
165
166
sample: "STL1"
166
- origin_node :
167
+ cpu_time :
167
168
description:
168
- Origin node that submitted the job.
169
- type: str
170
- sample: "STL1"
169
+ Sum of the CPU time used by each job step, in microseconds .
170
+ type: int
171
+ sample: 5
171
172
ret_code:
172
173
description:
173
174
Return code output collected from job log.
210
211
The CC returned for this step in the DD section.
211
212
type: int
212
213
sample: 0
213
-
214
214
sample:
215
215
ret_code: {
216
216
"msg": "CC 0000",
217
217
"msg_code": "0000",
218
218
"msg_txt": "",
219
- "code": 0,
220
- "steps": [
221
- { "step_name": "STEP0001",
222
- "step_cc": 0
223
- }
224
- ]
219
+ "code": 0
225
220
}
221
+ steps:
222
+ description:
223
+ Series of JCL steps that were executed and their return codes.
224
+ type: list
225
+ elements: dict
226
+ contains:
227
+ step_name:
228
+ description:
229
+ Name of the step shown as "was executed" in the DD section.
230
+ type: str
231
+ sample: "STEP0001"
232
+ step_cc:
233
+ description:
234
+ The CC returned for this step in the DD section.
235
+ type: int
236
+ sample: 0
237
+ sample:
238
+ "steps": [
239
+ { "step_name": "STEP0001",
240
+ "step_cc": 0
241
+ }
242
+ ]
226
243
job_class:
227
244
description:
228
245
Job class for this job.
277
294
"job_name": "LINKJOB",
278
295
"owner": "ADMIN",
279
296
"job_id": "JOB01427",
280
- "ret_code": "null",
281
- "job_class": "K",
282
297
"content_type": "JOB",
283
- "svc_class": "?",
298
+ "ret_code": { "msg" : "CC", "msg_code" : "0000", "code" : "0", msg_txt : "CC" },
299
+ "steps": [
300
+ { "step_name": "STEP0001",
301
+ "step_cc": 0
302
+ }
303
+ ],
304
+ "job_class": "STC",
305
+ "svc_class": "null",
284
306
"priority": 1,
285
307
"asid": 0,
286
308
"creation_date": "2023-05-03",
287
309
"creation_time": "12:13:00",
310
+ "program_name": "BPXBATCH",
288
311
"queue_position": 3,
289
312
"execution_time": "00:00:02",
290
313
"system": "STL1",
298
321
"owner": "ADMIN",
299
322
"job_id": "JOB16577",
300
323
"content_type": "JOB",
301
- "ret_code": { "msg": "CANCELED", "code": "null" },
324
+ "ret_code": { "msg" : "CANCELED", "msg_code" : "null", "code" : "null", msg_txt : "CANCELED" },
325
+ "steps" : [],
302
326
"job_class": "A",
303
327
"svc_class": "E",
304
328
"priority": 0,
307
331
"creation_time": "12:14:00",
308
332
"queue_position": 0,
309
333
"execution_time": "00:00:03",
334
+ "program_name": "null",
310
335
"system": "STL1",
311
336
"subsystem": "STL1",
312
337
"cpu_time": 1414,
313
338
"execution_node": "STL1",
314
339
"origin_node": "STL1"
315
340
},
316
341
]
317
- message :
342
+ msg :
318
343
description:
319
344
Message returned on failure.
320
345
type: str
@@ -349,7 +374,7 @@ def run_module():
349
374
job_id = dict (type = "str" , required = False ),
350
375
)
351
376
352
- result = dict (changed = False , message = "" )
377
+ result = dict (changed = False )
353
378
354
379
module = AnsibleModule (argument_spec = module_args , supports_check_mode = True )
355
380
@@ -379,6 +404,7 @@ def run_module():
379
404
jobs_raw = query_jobs (name , id , owner )
380
405
if jobs_raw :
381
406
jobs = parsing_jobs (jobs_raw )
407
+ result ["changed" ] = True
382
408
else :
383
409
jobs = None
384
410
@@ -436,8 +462,8 @@ def parsing_jobs(jobs_raw):
436
462
Parsed jobs.
437
463
"""
438
464
jobs = []
439
- ret_code = {}
440
465
for job in jobs_raw :
466
+ ret_code = job .get ("ret_code" )
441
467
# Easier to see than checking for an empty string, JOB NOT FOUND was
442
468
# replaced with None in the jobs.py and msg_txt field describes the job query instead
443
469
if job .get ("ret_code" ) is None :
@@ -449,30 +475,32 @@ def parsing_jobs(jobs_raw):
449
475
450
476
if "AC" in status_raw :
451
477
# the job is active
452
- ret_code = None
478
+ ret_code ["msg" ] = None
479
+ ret_code ["msg_code" ] = None
480
+ ret_code ["code" ] = None
481
+ ret_code ["msg_txt" ] = None
482
+
453
483
elif "CC" in status_raw :
454
484
# status = 'Completed normally'
455
- ret_code = {
456
- "msg" : status_raw ,
457
- "code" : job .get ("ret_code" ).get ("code" ),
458
- }
485
+ ret_code ["msg" ] = status_raw
486
+
459
487
elif "ABEND" in status_raw :
460
488
# status = 'Ended abnormally'
461
- ret_code = {
462
- "msg" : status_raw ,
463
- "code" : job .get ("ret_code" ).get ("code" ),
464
- }
489
+ ret_code ["msg" ] = status_raw
490
+
465
491
elif "ABENDU" in status_raw :
466
492
# status = 'Ended abnormally'
467
- ret_code = { "msg" : status_raw , "code" : job . get ( "ret_code" ). get ( "code" )}
493
+ ret_code [ "msg" ] = status_raw
468
494
469
495
elif "CANCELED" in status_raw or "JCLERR" in status_raw or "JCL ERROR" in status_raw or "JOB NOT FOUND" in status_raw :
470
496
# status = status_raw
471
- ret_code = {"msg" : status_raw , "code" : None }
497
+ ret_code ["msg" ] = status_raw
498
+ ret_code ["code" ] = None
499
+ ret_code ["msg_code" ] = None
472
500
473
501
else :
474
502
# status = 'Unknown'
475
- ret_code = { "msg" : status_raw , "code" : job . get ( "ret_code" ). get ( "code" )}
503
+ ret_code [ "msg" ] = status_raw
476
504
477
505
job_dict = {
478
506
"job_name" : job .get ("job_name" ),
@@ -485,6 +513,7 @@ def parsing_jobs(jobs_raw):
485
513
"execution_node" : job .get ("execution_node" ),
486
514
"origin_node" : job .get ("origin_node" ),
487
515
"ret_code" : ret_code ,
516
+ "steps" : job .get ("steps" ),
488
517
"job_class" : job .get ("job_class" ),
489
518
"svc_class" : job .get ("svc_class" ),
490
519
"priority" : job .get ("priority" ),
0 commit comments