f5networks / f5networks.f5_bigip / 3.4.0 / module / bigip_ucs_fetch Fetches a UCS file from remote nodes | "added in version" 1.0.0 of f5networks.f5_bigip" Authors: Wojciech Wypior (@wojtek0806)f5networks.f5_bigip.bigip_ucs_fetch (3.4.0) — module
Install with ansible-galaxy collection install f5networks.f5_bigip:==3.4.0
collections: - name: f5networks.f5_bigip version: 3.4.0
This module is used for fetching UCS files from remote machines and storing them locally in a file tree, organized by hostname. Note that this module is written to transfer UCS files that might not be present, so a missing remote UCS won't be an error unless fail_on_missing is set to 'yes'.
- name: Create a new UCS bigip_ucs_fetch: dest: /tmp/cs_backup.ucs register: task
- name: Check for task completion and download created UCS bigip_ucs_fetch: dest: /tmp/cs_backup.ucs src: "{{ task.src }}" task_id: "{{ task.task_id }}" timeout: 300
- name: Download an existing UCS bigip_ucs_fetch: src: cs_backup.ucs dest: /tmp/cs_backup.ucs
- name: Only create new UCS, no download bigip_ucs_fetch: src: cs_backup.ucs only_create_file: true
- name: Recreate UCS file left on device - remove file first bigip_ucs: ucs: cs_backup.ucs state: absent
- name: Recreate UCS file left on device - create new file bigip_ucs_fetch: src: cs_backup.ucs only_create_file: true
src: description: - The name of the UCS file to create on the remote server for downloading. - If not given the name will be randomly generated when creating UCS file on the device. - The parameter is required when C(task_id) is defined otherwise file download will fail. - The file is retrieved or created in the /var/local/ucs/ directory. - This option is mandatory when C(only_create_file) is set to C(true). type: str dest: description: - A directory into which the UCS file is saved. - This option is mandatory when C(only_create_file) is set to C(false). type: path mode: description: - The permissions the resulting filesystem object should have. - For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers. You must give Ansible enough information to parse them correctly. For consistent results, quote octal numbers (for example, V('644') or V('1777')) so Ansible receives a string and can do its own conversion from string into number. Adding a leading zero (for example, V(0755)) works sometimes, but can fail in loops and some other circumstances. - Giving Ansible a number without following either of these rules will end up with a decimal number which will have unexpected results. - As of Ansible 1.8, the mode may be specified as a symbolic mode (for example, V(u+rwx) or V(u=rw,g=r,o=r)). - If O(mode) is not specified and the destination filesystem object B(does not) exist, the default C(umask) on the system will be used when setting the mode for the newly created filesystem object. - If O(mode) is not specified and the destination filesystem object B(does) exist, the mode of the existing filesystem object will be used. - Specifying O(mode) is the best way to ensure filesystem objects are created with the correct permissions. See CVE-2020-1736 for further details. type: raw force: default: true description: - If C(false), the file will only be transferred if the destination does not exist. type: bool group: description: - Name of the group that should own the filesystem object, as would be fed to I(chown). - When left unspecified, it uses the current group of the current user unless you are root, in which case it can preserve the previous ownership. type: str owner: description: - Name of the user that should own the filesystem object, as would be fed to I(chown). - When left unspecified, it uses the current user unless you are root, in which case it can preserve the previous ownership. - Specifying a numeric username will be assumed to be a user ID and not a username. Avoid numeric usernames to avoid this confusion. type: str backup: default: false description: - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly. type: bool serole: description: - The role part of the SELinux filesystem object context. - When set to V(_default), it will use the C(role) portion of the policy if available. type: str setype: description: - The type part of the SELinux filesystem object context. - When set to V(_default), it will use the C(type) portion of the policy if available. type: str seuser: description: - The user part of the SELinux filesystem object context. - By default it uses the V(system) policy, where applicable. - When set to V(_default), it will use the C(user) portion of the policy if available. type: str selevel: description: - The level part of the SELinux filesystem object context. - This is the MLS/MCS attribute, sometimes known as the C(range). - When set to V(_default), it will use the C(level) portion of the policy if available. type: str task_id: description: - The ID of the async task as returned by the system in a previous module run. - Used to query the status of the task on the device, useful with longer running operations that require restarting services. - Parameter is mutually exclusive with C(only_create_file). type: str timeout: default: 150 description: - Parameter used when creating a new UCS file on the device. - The number of seconds to wait for the API async interface to complete its task. - The accepted value range is between C(150) and C(1800) seconds. type: int attributes: aliases: - attr description: - The attributes the resulting filesystem object should have. - To get supported flags look at the man page for I(chattr) on the target system. - This string should contain the attributes in the same order as the one displayed by I(lsattr). - The C(=) operator is assumed as default, otherwise C(+) or C(-) operators need to be included in the string. type: str version_added: '2.3' version_added_collection: ansible.builtin unsafe_writes: default: false description: - Influence when to use atomic operation to prevent data corruption or inconsistent reads from the target filesystem object. - By default this module uses atomic operations to prevent data corruption or inconsistent reads from the target filesystem objects, but sometimes systems are configured or just broken in ways that prevent this. One example is docker mounted filesystem objects, which cannot be updated atomically from inside the container and can only be written in an unsafe manner. - This option allows Ansible to fall back to unsafe methods of updating filesystem objects when atomic operations fail (however, it doesn't force Ansible to perform unsafe writes). - IMPORTANT! Unsafe writes are subject to race conditions and can lead to data corruption. type: bool version_added: '2.2' version_added_collection: ansible.builtin fail_on_missing: default: false description: - Make the module fail if the UCS file on the remote system is missing. type: bool only_create_file: default: false description: - If C(true), the file is created on the device and not downloaded. If the UCS archive exists on the device, no change is made and the file is not downloaded. - To recreate UCS files left on the device, remove them with the C(bigip_ucs) module before running this module with C(only_create_file) set to C(true). - Parameter is mutually exclusive with C(task_id). type: bool version_added: 1.12.0 version_added_collection: f5networks.f5_bigip create_on_missing: default: true description: - Creates the UCS based on the value of C(src) if the file does not already exist on the remote system. type: bool encryption_password: description: - Password used to encrypt the UCS file, if desired. type: str
backup_file: description: Name of backup file created. returned: changed and if backup=yes sample: /path/to/file.txt.2015-02-12@22:09~ type: str checksum: description: The SHA1 checksum of the downloaded file. returned: success or changed sample: 7b46bbe4f8ebfee64761b5313855618f64c64109 type: str dest: description: Location on the ansible host to which the UCS was saved. returned: success sample: /path/to/file.txt type: str gid: description: Group ID of the UCS file, after execution. returned: success sample: 100 type: int group: description: Group of the UCS file, after execution. returned: success sample: httpd type: str md5sum: description: The MD5 checksum of the downloaded file. returned: changed or success sample: 96cacab4c259c4598727d7cf2ceb3b45 type: str message: description: Informative message of the task status. returned: changed sample: Import success type: dict mode: description: Permissions of the target UCS, after execution. returned: success sample: 420 type: str owner: description: Owner of the UCS file, after execution. returned: success sample: httpd type: str size: description: Size of the target UCS, after execution. returned: success sample: 1220 type: int src: description: - Name of the UCS file on the remote BIG-IP to download. If not specified, then the filename is randomly generated. returned: changed sample: cs_backup.ucs type: str task_id: description: The task ID returned by the system. returned: changed sample: hash/dictionary of values type: dict uid: description: Owner ID of the UCS file, after execution. returned: success sample: 100 type: int