ibm / ibm.ibm_zos_zosmf / 2.5.0 / module / zmf_dataset_copy Copy data to z/OS data set or member | "added in version" 2.9 of ibm.ibm_zos_zosmf" Authors: Yang Cao (@zosmf-Young), Yun Juan Yang (@zosmf-Robyn) preview | supported by communityibm.ibm_zos_zosmf.zmf_dataset_copy (2.5.0) — module
Install with ansible-galaxy collection install ibm.ibm_zos_zosmf:==2.5.0
collections: - name: ibm.ibm_zos_zosmf version: 2.5.0
Copy data from Ansible control node to a sequential data set, or a member of a partitioned data set (PDS or PDSE) on z/OS system.
Copy file or data set from z/OS system to a data set or member on z/OS system.
If the target data set or member already exists, it can be overwritten.
If the target data set does not exist, it can be allocated based on I(dataset_create_like), the size of the local data, or the source data set.
If the target member does not exist, it can be created.
- name: Copy a local file to data set ZOSMF.ANSIBLE.PS zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/tmp/dataset_input/sample1" dataset_dest: "ZOSMF.ANSIBLE.PS"
- name: Copy a local file to PDS member ZOSMF.ANSIBLE.PDS(MEMBER) only if it does not exist zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/tmp/dataset_input/member01" dataset_dest: "ZOSMF.ANSIBLE.PDS(MEMBER)" dataset_force: false
- name: Copy the contents to data set ZOSMF.ANSIBLE.PS zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_conntent: "Sample profile\nTZ=EST5EDT\n" dataset_dest: "ZOSMF.ANSIBLE.PS"
- name: Copy a local file to uncataloged PDS member ZOSMF.ANSIBLE.PDS(MEMBER) as binary zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/tmp/dataset_input/member01" dataset_dest: "ZOSMF.ANSIBLE.PDS(MEMBER)" dataset_dest_volser: "VOL001" dataset_data_type: "binary"
- name: Copy a local file to data set ZOSMF.ANSIBLE.PS and convert from ISO8859-1 to IBM-037 zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/tmp/dataset_input/sample1" dataset_dest: "ZOSMF.ANSIBLE.PS" dataset_encoding: from: ISO8859-1 to: IBM-037
- name: Copy a local file to data set ZOSMF.ANSIBLE.PS and validate its checksum zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/tmp/dataset_input/sample1" dataset_dest: "ZOSMF.ANSIBLE.PS" dataset_checksum: "93822124D6E66E2213C64B0D10800224"
- name: Copy a remote file to data set ZOSMF.ANSIBLE.PS zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/etc/profile" dataset_dest: "ZOSMF.ANSIBLE.PS" dataset_src_zos: true
- name: Copy a remote file to data set ZOSMF.ANSIBLE.PDS(MEMBER) only if it does not exist zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "/etc/profile" dataset_dest: "ZOSMF.ANSIBLE.PDS(MEMBER)" dataset_src_zos: true dataset_force: false
- name: Copy a remote sequential data set to data set ZOSMF.ANSIBLE.PS zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "ZOSMF.ANSIBLE.REMOTE.PS" dataset_dest: "ZOSMF.ANSIBLE.PS" dataset_src_zos: true
- name: Copy a remote partitioned data set to data set ZOSMF.ANSIBLE.PDS without the like-named members zmf_dataset_copy: zmf_host: "sample.ibm.com" dataset_src: "ZOSMF.ANSIBLE.REMOTE.PDS" dataset_dest: "ZOSMF.ANSIBLE.PDS" dataset_src_zos: true dataset_force: false
zmf_crt: default: null description: - Location of the PEM-formatted certificate chain file to be used for HTTPS client authentication. - If I(zmf_credential) is supplied, I(zmf_crt) is ignored. - If I(zmf_credential) is not supplied, I(zmf_crt) is required when I(zmf_user) and I(zmf_password) are not supplied. required: false type: str zmf_key: default: null description: - Location of the PEM-formatted file with your private key to be used for HTTPS client authentication. - If I(zmf_credential) is supplied, I(zmf_key) is ignored. - If I(zmf_credential) is not supplied, I(zmf_key) is required when I(zmf_user) and I(zmf_password) are not supplied. required: false type: str zmf_host: default: null description: - Hostname of the z/OSMF server. - If I(zmf_credential) is supplied, I(zmf_host) is ignored. - If I(zmf_credential) is not supplied, I(zmf_host) is required. required: false type: str zmf_port: default: null description: - Port number of the z/OSMF server. - If I(zmf_credential) is supplied, I(zmf_port) is ignored. required: false type: int zmf_user: default: null description: - User name to be used for authenticating with z/OSMF server. - If I(zmf_credential) is supplied, I(zmf_user) is ignored. - If I(zmf_credential) is not supplied, I(zmf_user) is required when I(zmf_crt) and I(zmf_key) are not supplied. - If I(zmf_credential) is not supplied and I(zmf_crt) and I(zmf_key) are supplied, I(zmf_user) and I(zmf_password) are ignored. required: false type: str dataset_src: default: null description: - 'If I(dataset_src_zos=false), this variable specifies the local path on control node of the data to be copied to. For example, C(/tmp/dataset_input/member01). This path can be absolute or relative. The module will fail if I(dataset_src) has no read permission. The data is interpreted as one of binary, text, record or ''diff -e'' format according to the value of I(dataset_data_type) and I(dataset_diff). If I(dataset_content) is supplied and I(dataset_data_type=text), I(dataset_src) is ignored. ' - 'If I(dataset_src_zos=true), this variable specifies the source file or data set from z/OS system to be copied to. If this variable specifies the source file, it should be the absolute source file name, for example, C(/etc/profile). If this variable specifies the source data set, it should be the name of the data set or member, for example, C(ZOSMF.ANSIBLE.PS) or ``ZOSMF.ANSIBLE.PDS(MEMBER)``. If the source data set is uncataloged, you can use I(dataset_src_volser) to specify the volume of the uncataloged source data set. ' required: false type: str dataset_crlf: default: false description: - Specifies whether each input text line is terminated with a carriage return line feed (CRLF) or a line feed (LF). - If I(dataset_crlf=true), CRLF characters are used. - This variable only take effects when I(dataset_src_zos=false). - This variable only take effects when I(dataset_data_type=text). required: false type: bool dataset_dest: description: - Data set or the name of the PDS or PDSE member on z/OS system where the data should be copied to. - This variable must consist of a fully qualified data set name. The length of the data set name cannot exceed 44 characters. - For example, specifying a data set like C(ZOSMF.ANSIBLE.PS), or a PDS or PDSE member like ``ZOSMF.ANSIBLE.PDS(MEMBER)``. - 'If I(dataset_src_zos=false), I(dataset_dest) should be a sequential data set or a member of a partitioned data set on z/OS system. If I(dataset_dest) does not exist, it will be allocated based on I(dataset_create_like) if supplied, or the size of the local data. ' - 'If I(dataset_src_zos=true) and I(dataset_src) specifies a USS file, I(dataset_dest) should be a sequential data set or a member of an existing partitioned data set on z/OS system. If I(dataset_dest) specifies a nonexistent sequential data set, it will be allocated. ' - 'If I(dataset_src_zos=true) and I(dataset_src) specifies a sequential data set, I(dataset_dest) should also be a sequential data set on z/OS system. If I(dataset_dest) does not exist, it will be allocated based on I(dataset_src). ' - 'If I(dataset_src_zos=true) and I(dataset_src) specifies a partitioned data set, I(dataset_dest) should also be a partitioned data set without specific member provided on z/OS system. If I(dataset_dest) does not exist, it will be allocated based on I(dataset_src). ' - 'If I(dataset_src_zos=true) and I(dataset_src) specifies a member of a partitioned data set, I(dataset_dest) should be an existing sequential data set or a member of a partitioned data set on z/OS system. If I(dataset_dest) specifies a member of a nonexistent partitioned data set, it will be allocated based on I(dataset_src). ' required: true type: str dataset_diff: default: false description: - Specifies whether the input consists of commands in the same format as produced by the z/OS UNIX 'diff -e' command. - These commands are used to add, replace and delete lines in the target data set. The following commands are supported. - C(a) - C(c) - C(d) - C(s/.//) - opt C(g|<n>), where C(g) means global, C(n) means search and replace C(n) times. - Each command may be optionally preceded by a line or line range, as allowed by the z/OS UNIX 'ed' command. - The module will fail if an error is detected while processing a command. - This variable only take effects when I(dataset_src_zos=false). - This variable only take effects when I(dataset_data_type=text). required: false type: bool zmf_password: default: null description: - Password to be used for authenticating with z/OSMF server. - If I(zmf_credential) is supplied, I(zmf_password) is ignored. - If I(zmf_credential) is not supplied, I(zmf_password) is required when I(zmf_crt) and I(zmf_key) are not supplied. - If I(zmf_credential) is not supplied and I(zmf_crt) and I(zmf_key) are supplied, I(zmf_user) and I(zmf_password) are ignored. required: false type: str dataset_force: default: true description: - Specifies whether the target data set must always be overwritten. - If I(dataset_force=true) and I(dataset_checksum) is not supplied, the target data set or member will always be overwritten. - If I(dataset_force=true) and I(dataset_checksum) is supplied, the target data set or member will be overwritten only when the checksum is matched. - If I(dataset_force=false), the source data will only be copied if the target data set or member does not exist. required: false type: bool zmf_credential: default: null description: - Authentication credentials, returned by module C(zmf_authenticate), for the successful authentication with z/OSMF server. - If I(zmf_credential) is supplied, I(zmf_host), I(zmf_port), I(zmf_user), I(zmf_password), I(zmf_crt) and I(zmf_key) are ignored. required: false suboptions: LtpaToken2: default: null description: - The value of Lightweight Third Party Access (LTPA) token, which supports strong encryption. - If I(jwtToken) is not supplied, I(LtpaToken2) is required. required: false type: str jwtToken: default: null description: - The value of JSON Web token, which supports strong encryption. - If I(LtpaToken2) is not supplied, I(jwtToken) is required. required: false type: str zmf_host: description: Hostname of the z/OSMF server. required: true type: str zmf_port: default: null description: Port number of the z/OSMF server. required: false type: int type: dict dataset_content: default: null description: - The contents to be copied to the target data set or member. This variable is used instead of I(dataset_src). - This variable only take effects when I(dataset_src_zos=false). - This variable only take effects when I(dataset_data_type=text). - Each line of the contents should be terminated with C(\n). For example, C(Sample profile\nTZ=EST5EDT\n). - If I(dataset_content) is supplied and I(dataset_data_type=text), I(dataset_src) is ignored. required: false type: str dataset_src_zos: default: false description: - Specifies whether the source file or data set from z/OS system will be copied. - If I(dataset_src_zos=false), the local data from Ansible control node will be copied to the target data set or member. - If I(dataset_src_zos=true), the source file or data set from z/OS system will be copied to the target data set or member. required: false type: bool dataset_checksum: default: null description: - Specifies the checksum to be used to verify that the target data set to copy to is not changed since the checksum was generated. - The module will fail and no data will be copied if the checksum is not matched which means the target data set has been modified. - This variable only take effects when I(dataset_src_zos=false). - This variable only take effects when I(dataset_force=true). required: false type: str dataset_encoding: default: null description: - Specifies which encodings the data to be copied should be converted from and to. - This variable only take effects when I(dataset_src_zos=false). - This variable only take effects when I(dataset_data_type=text) and I(dataset_diff=false). required: false suboptions: from: description: - The character set of the data to be copied. - 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 character set for the target data set. - Supported character sets rely on the charset conversion utility (iconv) version. The most common character sets are supported. required: true type: str type: dict dataset_data_type: choices: - text - binary - record default: text description: - Specifies whether data conversion is to be performed on the data to be copied. - This variable only take effects when I(dataset_src_zos=false). - When I(dataset_data_type=text), data conversion is performed. - You can use I(dataset_encoding) to specify which encodings the data to be copied should be converted from and to. - Each line of data, delimited by a Line Feed (LF), is converted and written as a record to the target data set. - The LF character is removed and the data is padded with the space character to the end of the record if it is a fixed record size data set. - For variable record size data set, the record is written without padding. - the module will fail if the record size of the data set is smaller than any line of text since not all data was written. - If I(dataset_encoding) is not supplied, the data transfer process converts each byte from C(ISO8859-1) to C(IBM-1047) by default. - You can use I(dataset_crlf) to control whether each input text line is terminated with a carriage return line feed (CRLF) or a line feed (LF). - If I(dataset_crlf) is not supplied, LF characters are left intact by default. - You can use I(dataset_diff) to specify whether the input consists of commands in the same format as produced by the z/OS UNIX 'diff -e' command. - If I(dataset_diff) is not supplied, the input is regarded as not consisting of commands by default. - When I(dataset_data_type=binary), no data conversion is performed. - The data is written to the data set without respect to record boundaries. All records will be written at their maximum record length. - For fixed length record data set, the last record will be padded with nulls if required. - When I(dataset_data_type=record), no data conversion is performed. - Each logical record is preceded by the 4-byte big endian record length of the record that follows. This length doesn't include the prefix length. - For example, a zero-length record is 4 bytes of zeros with nothing following. required: false type: str dataset_src_volser: default: null description: - The volume serial to identify the volume to be searched for an uncataloged source data set or member. - The length of the volume serial cannot exceed six characters. Wildcard characters are not supported. Indirect volume serials are not supported. - This variable only take effects when I(dataset_src_zos=true). required: false type: str dataset_create_like: default: null description: - When copying a local data to a non-existing PDS, PDSE or PS, specify a model data set to allocate the target data set. - For example, specifying a model data set like C(ZOSMF.ANSIBLE.MODEL), member name should not be provided in this variable. - This variable only take effects when I(dataset_src_zos=false). - If this variable is not supplied, the target data set will be allocated based on the size of the local data. - The primary extent tracks will be specified as 4 times the size of the local data specified by I(dataset_src) or I(dataset_content). - If I(dataset_data_type=text), then C(RECFM=FB) and C(LRECL=80) will be used to allocate the target data set. - If I(dataset_data_type=binary) or I(dataset_data_type=record), then C(RECFM=U) will be used to allocate the target data set. required: false type: str dataset_dest_volser: default: null description: - The volume serial to identify the volume to be searched for an uncataloged target data set or member. - The length of the volume serial cannot exceed six characters. Wildcard characters are not supported. Indirect volume serials are not supported. - If this variable is provided and I(dataset_dest) is a nonexistent data set, I(dataset_dest_volser) must point to a volume on a 3390 device. required: false type: str dataset_migrate_recall: choices: - wait - nowait - error default: wait description: - Specifies how a migrated data set is handled. - When I(dataset_migrate_recall=wait), the migrated data set is recalled synchronously. - When I(dataset_migrate_recall=nowait), request the migrated data set to be recalled, but do not wait. - When I(dataset_migrate_recall=error), do not attempt to recall the migrated data set. required: false type: str
changed: description: Indicates if any change is made during the module operation. returned: always type: bool dataset_checksum: description: The checksum of the updated data set when the local data is copied to. returned: on success sample: 93822124D6E66E2213C64B0D10800224 type: str message: description: The output message generated by the module to indicate whether the data set or member is successfully copied. returned: on success sample: sample1: The target data set ZOSMF.ANSIBLE.PDS is created successfully, and ZOSMF.ANSIBLE.PDS(MEMBER) is updated successfully. sample2: The target data set ZOSMF.ANSIBLE.PS is updated successfully. sample7: No data is copied since the target data set ZOSMF.ANSIBLE.PS already exists and dataset_force is set to False. type: str