ibm / ibm.ibm_zos_zosmf / 2.5.0 / module / zmf_file_copy Copy data to z/OS USS file | "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_file_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 z/OS UNIX System Services (USS) file on z/OS system.
If the target USS file already exists, it can be overwritten. If the target USS file does not exist, it can be created with mode 644.
- name: Copy a local file to USS file /etc/profile zmf_file_copy: zmf_host: "sample.ibm.com" file_src: "/tmp/file_input/profile" file_dest: "/etc/profile"
- name: Copy a local file to USS file /etc/profile only if it does not exist zmf_file_copy: zmf_host: "sample.ibm.com" file_src: "/tmp/file_input/profile" file_dest: "/etc/profile" file_force: false
- name: Copy the contents to USS file /etc/profile zmf_file_copy: zmf_host: "sample.ibm.com" file_conntent: "Sample profile\nTZ=EST5EDT\n" file_dest: "/etc/profile"
- name: Copy a local file to USS file /etc/profile as binary zmf_file_copy: zmf_host: "sample.ibm.com" file_src: "/tmp/file_input/profile" file_dest: "/etc/profile" file_data_type: "binary"
- name: Copy a local file to USS file /etc/profile and convert from ISO8859-1 to IBM-037 zmf_file_copy: zmf_host: "sample.ibm.com" file_src: "/tmp/file_input/profile" file_dest: "/etc/profile" file_encoding: from: ISO8859-1 to: IBM-037
- name: Copy a local file to USS file /etc/profile and validate its checksum zmf_file_copy: zmf_host: "sample.ibm.com" file_src: "/tmp/file_input/profile" file_dest: "/etc/profile" file_checksum: "93822124D6E66E2213C64B0D10800224"
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 file_src: default: null description: - The local path on control node of the data to be copied to the target USS file. For example, C(/tmp/file_input/profile). - This path can be absolute or relative. The module will fail if I(file_src) has no read permission. - The data is interpreted as one of binary, text or 'diff -e' format according to the value of I(file_data_type) and I(file_diff). - If I(file_content) is supplied and I(file_data_type=text), I(file_src) is ignored. 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 file_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(file_crlf=true), CRLF characters are used. - This variable only take effects when I(file_data_type=text). required: false type: bool file_dest: description: - USS file on z/OS system where the data should be copied to. - This variable must consist of a fully qualified path and file name. For example, C(/etc/profile). required: true type: str file_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 USS file. 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(file_data_type=text). required: false type: bool file_force: default: true description: - Specifies whether the target USS file must always be overwritten. - If I(file_force=true) and I(file_checksum) is not supplied, the target USS file will always be overwritten. - If I(file_force=true) and I(file_checksum) is supplied, the target USS file will be overwritten only when the checksum is matched. - If I(file_force=false), the data will only be copied if the target USS file does not exist. required: false type: bool file_content: default: null description: - The contents to be copied to the target USS file. This variable is used instead of I(file_src). - This variable only take effects when I(file_data_type=text). - Each line of the contents should be terminated with C(\n). For example, C(Sample profile\nTZ=EST5EDT\n). - If I(file_content) is supplied and I(file_data_type=text), I(file_src) is ignored. required: false type: str 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 file_checksum: default: null description: - Specifies the checksum to be used to verify that the target USS file 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(file_force=true). required: false type: str file_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(file_data_type=text) and I(file_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 USS file. - Supported character sets rely on the charset conversion utility (iconv) version. The most common character sets are supported. required: true type: str type: dict file_data_type: choices: - text - binary default: text description: - Specifies whether data conversion is to be performed on the data to be copied. - When I(file_data_type=text), data conversion is performed. - You can use I(file_encoding) to specify which encodings the data to be copied should be converted from and to. - If I(file_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(file_crlf) to control whether each input text line is terminated with a carriage return line feed (CRLF) or a line feed (LF). - If I(file_crlf) is not supplied, LF characters are left intact by default. - You can use I(file_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(file_diff) is not supplied, the input is regarded as not consisting of commands by default. - When I(file_data_type=binary), no data conversion is performed. required: false type: str 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
changed: description: Indicates if any change is made during the module operation. returned: always type: bool file_checksum: description: The checksum of the updated USS file. returned: on success sample: 93822124D6E66E2213C64B0D10800224 type: str message: description: The output message generated by the module to indicate whether the USS file is successfully copied. returned: on success sample: sample1: The target USS file /etc/profile is created and updated successfully. sample2: The target USS file /etc/profile is updated successfully. sample7: No data is copied since the target USS file /etc/profile already exists and file_force is set to False. type: str