ibm / ibm.ibm_zos_core / 1.3.6 / module / zos_fetch Fetch data from z/OS | "added in version" 1.1.0 of ibm.ibm_zos_core" Authors: Asif Mahmud (@asifmahmud) This plugin has a corresponding action plugin.ibm.ibm_zos_core.zos_fetch (1.3.6) — module
Install with ansible-galaxy collection install ibm.ibm_zos_core:==1.3.6
collections: - name: ibm.ibm_zos_core version: 1.3.6
This module fetches a UNIX System Services (USS) file, PS(sequential data set), PDS, PDSE, member of a PDS or PDSE, or KSDS(VSAM data set) from a remote z/OS system.
When fetching a sequential data set, the destination file name will be the same as the data set name.
When fetching a PDS or PDSE, the destination will be a directory with the same name as the PDS or PDSE.
When fetching a PDS/PDSE member, destination will be a file.
Files that already exist at C(dest) will be overwritten if they are different than C(src).
- name: Fetch file from USS and store in /tmp/fetched/hostname/tmp/somefile zos_fetch: src: /tmp/somefile dest: /tmp/fetched
- name: Fetch a sequential data set and store in /tmp/SOME.DATA.SET zos_fetch: src: SOME.DATA.SET dest: /tmp/ flat: true
- name: Fetch a PDS as binary and store in /tmp/SOME.PDS.DATASET zos_fetch: src: SOME.PDS.DATASET dest: /tmp/ flat: true is_binary: true
- name: Fetch a UNIX file and don't validate its checksum zos_fetch: src: /tmp/somefile dest: /tmp/ flat: true validate_checksum: false
- name: Fetch a VSAM data set zos_fetch: src: USER.TEST.VSAM dest: /tmp/ flat: true
- name: Fetch a PDS member named 'DATA' zos_fetch: src: USER.TEST.PDS(DATA) dest: /tmp/ flat: true
- name: Fetch a USS file and convert from IBM-037 to ISO8859-1 zos_fetch: src: /etc/profile dest: /tmp/ encoding: from: IBM-037 to: ISO8859-1 flat: true
src: description: - Name of a UNIX System Services (USS) file, PS(sequential data set), PDS, PDSE, member of a PDS, PDSE or KSDS(VSAM data set). - USS file paths should be absolute paths. required: true type: str dest: description: - Local path where the file or data set will be stored. - If dest is an existing file or directory, the contents will be overwritten. required: true type: path flat: default: 'true' description: - Override the default behavior of appending hostname/path/to/file to the destination. If set to "true", the file or data set will be fetched to the destination directory without appending remote hostname to the destination. required: false type: bool encoding: description: - Specifies which encodings the fetched data set should be converted from and to. If this parameter is not provided, encoding conversions will not take place. required: false suboptions: from: description: - The character set of the source I(src). - Supported character sets rely on the charset conversion utility (iconv) version; the most common character sets are supported. required: true type: str to: description: - The destination I(dest) character set for the output to be written as. - Supported character sets rely on the charset conversion utility (iconv) version; the most common character sets are supported. required: true type: str type: dict is_binary: default: 'false' description: - Specifies if the file being fetched is a binary. required: false type: bool sftp_port: description: - Indicates which port should be used to connect to the remote z/OS system to perform data transfer. - If this parameter is not specified, C(ansible_port) will be used. - If C(ansible_port) is not specified, port 22 will be used. required: false type: int use_qualifier: default: 'false' description: - Indicates whether the data set high level qualifier should be used when fetching. required: false type: bool fail_on_missing: default: 'true' description: - When set to true, the task will fail if the source file is missing. required: false type: bool validate_checksum: default: 'true' description: - Verify that the source and destination checksums match after the files are fetched. required: false type: bool ignore_sftp_stderr: default: false description: - During data transfer through sftp, the module fails if the sftp command directs any content to stderr. The user is able to override this behavior by setting this parameter to C(true). By doing so, the module would essentially ignore the stderr stream produced by sftp and continue execution. required: false type: bool
checksum: description: The SHA256 checksum of the fetched file or data set. checksum validation is performed for all USS files and sequential data sets. returned: success and src is a non-partitioned data set sample: 8d320d5f68b048fc97559d771ede68b37a71e8374d1d678d96dcfa2b2da7a64e type: str data_set_type: description: Indicates the fetched data set type. returned: success sample: PDSE type: str dest: description: The destination file path on the controlling machine. returned: success sample: /tmp/SOME.DATA.SET type: str file: description: The source file path or data set on the remote machine. returned: success sample: SOME.DATA.SET type: str is_binary: description: Indicates the transfer mode that was used to fetch. returned: success sample: true type: bool msg: description: Message returned on failure. returned: failure sample: The source 'TEST.DATA.SET' does not exist or is uncataloged. type: str note: description: Notice of module failure when C(fail_on_missing) is false. returned: failure and fail_on_missing=false sample: The data set USER.PROCLIB does not exist. No data was fetched. type: str rc: description: The return code of a USS command or MVS command, if applicable. returned: failure sample: 8 type: int stderr: description: The stderr of a USS command or MVS command, if applicable returned: failure sample: File /tmp/result.log not found. type: str stderr_lines: description: List of strings containing individual lines from stderr. returned: failure sample: - u'Unable to traverse PDS USER.TEST.PDS not found' type: list stdout: description: The stdout from a USS command or MVS command, if applicable. returned: failure sample: DATA SET 'USER.PROCLIB' NOT IN CATALOG type: str stdout_lines: description: List of strings containing individual lines from stdout returned: failure sample: - u'USER.TEST.PDS NOT IN CATALOG..' type: list