ibmi_submit_job – Submit a job on IBM i system. This module functions like SBMJOB.
Synopsis
The
ibmi_submit_job
module submits a job on IBM i system.It waits until the submitted job turns into expected status that is specified.
Parameters
- become_user
The name of the user profile that the IBM i task will run under.
Use this option to set a user with desired privileges to run the task.
required: falsetype: str- become_user_password
Use this option to set the password of the user specified in
become_user
.required: falsetype: str- check_interval
The time interval between current and next checks of the expected status of the submitted job. This option will be ignored if
*NONE
is specified for option status.required: Falsetype: strdefault: 1m- cmd
A command that runs in the batch job.
required: Truetype: str- parameters
The parameters that SBMJOB will take. Other than CMD, all other parameters need to be specified here. The default values of parameters for SBMJOB will be taken if not specified.
required: Falsetype: str- status
The expect status list. The module will wait for the job to be turned into one of the expected status specified. If one of the expect status specified matches the status of submitted job, it will return. If
*NONE
is specified, the module will not wait for anything and return right after the job is submitted. The valid options are*NONE
,*ACTIVE
,*COMPLETE
,*JOBQ
,*OUTQ
.required: falsetype: listelements: strdefault: [’*NONE’]- time_out
The max time that the module waits for the submitted job is turned into expected status. It returns if the status of the submitted job is not turned into the expected status within the time_out time. This option will be ignored if
*NONE
is specified for option status.required: Falsetype: strdefault: 1m
Examples
- name: Submit a batch job and run CALL QGPL/PGM1
ibm.power_ibmi.ibmi_submit_job:
cmd: 'CALL QGPL/PGM1'
parameters: 'JOB(TEST)'
check_interval: '30s'
time_out: '80s'
status: ['*OUTQ', '*COMPLETE']
Notes
Note
Ansible hosts file need to specify ansible_python_interpreter=/QOpenSys/pkgs/bin/python3(or python2)
See Also
Return Values
- start
The task execution start timereturned: When job has been submitted and task has waited for the job status for some timetype: strsample: 2019-12-02 11:07:53.757435- end
The task execution end timereturned: When job has been submitted and task has waited for the job status for some timetype: strsample: 2019-12-02 11:07:54.064969- delta
The task execution delta timereturned: When job has been submitted and task has waited for the job status for some timetype: strsample: 0:00:00.307534- stdout
The task standard outputreturned: When rc as non-zero(failure)type: strsample: CPC2102: Library TESTLIB created- stderr
The task standard errorreturned: When rc as non-zero(failure)type: strsample: CPF2111:Library TESTLIB already exists- sbmjob_cmd
The SBMJOB CL command that has been used.returned: alwaystype: strsample: SBMJOB CMD(CRTLIB LIB(TESTLIB))- rc
The task return code (0 means success, non-zero means failure)returned: alwaystype: intsample: 255- stdout_lines
The task standard output split in linesreturned: When rc as non-zero(failure)type: listsample:["CPC2102: Library TESTLIB created."]- stderr_lines
The task standard error split in linesreturned: When rc as non-zero(failure)type: listsample:["CPF2111:Library TESTLIB already exists."]