zos_operator – Execute operator command
Synopsis
Execute an operator command and receive the output.
Parameters
- cmd
The command to execute.
If the command contains single-quotations, another set of single quotes must be added.
For example, change the command “…,P=’DSN3EPX,-DBC1,S’” to “…,P=’’DSN3EPX,-DBC1,S’’ “.
If the command contains any special characters ($, &, etc), they must be escaped using double backslashes like \\\$.
For example, to display job by job name the command would be
cmd:"\\$dj''HELLO''"By default, the command will be converted to uppercase before execution, to control this behavior, see the case_sensitive option below.
required: Truetype: str- verbose
Return diagnostic messages that describes the commands execution, options, buffer and response size.
required: Falsetype: booldefault: False- wait_time
Set maximum time in seconds to wait for the commands to execute.
When set to 0, the system default is used.
This option is helpful on a busy system requiring more time to execute commands.
Setting wait can instruct if execution should wait the full wait_time.
required: Falsetype: intdefault: 1- time_unit
Set the
wait_timeunit of time, which can bes(seconds) orcs(centiseconds).required: Falsetype: strdefault: schoices: s, cs- case_sensitive
If
true, the command will not be converted to uppercase before execution. Instead, the casing will be preserved just as it was written in a task.required: Falsetype: booldefault: False
Attributes
- action
- support: nonedescription: Indicates this has a corresponding action plugin so some parts of the options can be executed on the controller.
- async
- support: fulldescription: Supports being used with the
asynckeyword. - check_mode
- support: nonedescription: Can run in check_mode and return changed status prediction without modifying target. If not supported, the action will be skipped.
Examples
- name: Execute an operator command to show device status and allocation
zos_operator:
cmd: 'd u'
- name: Execute an operator command to show device status and allocation with verbose information
zos_operator:
cmd: 'd u'
verbose: true
- name: Execute an operator command to purge all job logs (requires escaping)
zos_operator:
cmd: "\\$PJ(*)"
- name: Execute operator command to show jobs, always waiting 5 seconds for response
zos_operator:
cmd: 'd a,all'
wait_time: 5
- name: Display the system symbols and associated substitution texts.
zos_operator:
cmd: 'D SYMBOLS'
- name: Execute an operator command to show device status and allocation wait 10 centiseconds.
zos_operator:
cmd: 'd u'
wait_time: 10
time_unit: 'cs'
Notes
Note
Commands may need to use specific prefixes like $, they can be discovered by issuing the following command D OPDATA,PREFIX.
Return Values
- rc
Return code for the submitted operator command.
returned: alwaystype: int- cmd
Operator command submitted.
returned: alwaystype: strsample: d u,all- elapsed
The number of seconds or centiseconds that elapsed waiting for the command to complete.
returned: alwaystype: floatsample:51.53- wait_time
The maximum time in the time_unit set to wait for the commands to execute.
returned: alwaystype: intsample: 5- time_unit
The time unit set for wait_time.
returned: alwaystype: strsample: s- stdout
The standard output from the operator command execution.
returned: alwaystype: strsample: EC000000 2022244 16:00:49.00 ISF031I CONSOLE OMVS0000 ACTIVATED EC000000 2022244 16:00:49.00 -D U,ALL EC000000 2022244 16:00:49.00 IEE457I 16.00.49 UNIT STATUS 645 UNIT TYPE STATUS VOLSER VOLSTATE SS 0000 3390 F-NRD /RSDNT 0 0001 3211 OFFLINE 0- stdout_lines
The standard output split into individual lines.
returned: alwaystype: listelements: strsample:[ "EC000000 2022244 16:00:49.00 ISF031I CONSOLE OMVS0000 ACTIVATED", "EC000000 2022244 16:00:49.00 -D U,ALL ", "EC000000 2022244 16:00:49.00 IEE457I 16.00.49 UNIT STATUS 645", " UNIT TYPE STATUS VOLSER VOLSTATE SS", " 0000 3390 F-NRD /RSDNT 0", " 0001 3211 OFFLINE 0", " 0002 3211 OFFLINE 0", " 0008 3211 OFFLINE 0", " 0009 3277 OFFLINE 0", " 000C 2540 A 0", " 000E 1403 A 0", " 000F 1403 A 0", " 0010 3211 A 0", " 0011 3211 A 0" ]
- stderr
The standard error from the operator command execution.
returned: alwaystype: str- stderr_lines
The standard error split into individual lines.
returned: alwaystype: listelements: str- changed
Indicates if any changes were made during module operation. Given operator commands may introduce changes that are unknown to the module. True is always returned unless either a module or command failure has occurred.
returned: alwaystype: boolsample:true