f5networks.f5_modules.bigip_ucs_fetch (1.28.0) — module

Fetches a UCS file from remote nodes

| "added in version" 1.0.0 of f5networks.f5_modules"

Authors: Tim Rupp (@caphrim007), Wojciech Wypior (@wojtek0806)

Install collection

Install with ansible-galaxy collection install f5networks.f5_modules:==1.28.0


Add to requirements.yml

  collections:
    - name: f5networks.f5_modules
      version: 1.28.0

Description

This module is used for fetching UCS files from remote machines and storing them locally in a file tree, organized by hostname. This module was written to create and transfer UCS files that might not be present, it does not require UCS file to be pre-created. So a missing remote UCS is not an error unless C(fail_on_missing) is set to 'yes'.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download a new UCS
  bigip_ucs_fetch:
    src: cs_backup.ucs
    dest: /tmp/cs_backup.ucs
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Only create new UCS, no download
  bigip_ucs_fetch:
    src: cs_backup.ucs
    only_create_file: true
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Recreate UCS file left on device - remove file first
  bigip_ucs:
    ucs: cs_backup.ucs
    state: absent
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Recreate UCS file left on device - create new file
  bigip_ucs_fetch:
    src: cs_backup.ucs
    only_create_file: true
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

Inputs

    
src:
    description:
    - The name of the UCS file to create on the remote server for downloading.
    - The file is retrieved or created in /var/local/ucs/.
    - This option is mandatory when C(only_create_file) is set to C(true).
    type: str

dest:
    description:
    - A directory to save the UCS file into.
    - 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 is only 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:
    - Creates a backup file including the timestamp information so you can get the original
      file back if you overwrote 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

provider:
    description:
    - A dict object containing connection details.
    suboptions:
      auth_provider:
        description:
        - Configures the auth provider for to obtain authentication tokens from the remote
          device.
        - This option is really used when working with BIG-IQ devices.
        type: str
      no_f5_teem:
        default: false
        description:
        - If C(yes), TEEM telemetry data is not sent to F5.
        - You may omit this option by setting the environment variable C(F5_TELEMETRY_OFF).
        - Previously used variable C(F5_TEEM) is deprecated as its name was confusing.
        type: bool
      password:
        aliases:
        - pass
        - pwd
        description:
        - The password for the user account used to connect to the BIG-IP or the BIG-IQ.
        - You may omit this option by setting the environment variable C(F5_PASSWORD).
        required: true
        type: str
      server:
        description:
        - The BIG-IP host or the BIG-IQ host.
        - You may omit this option by setting the environment variable C(F5_SERVER).
        required: true
        type: str
      server_port:
        default: 443
        description:
        - The BIG-IP server port.
        - You may omit this option by setting the environment variable C(F5_SERVER_PORT).
        type: int
      timeout:
        description:
        - Specifies the timeout in seconds for communicating with the network device for
          either connecting or sending commands.  If the timeout is exceeded before the
          operation is completed, the module will error.
        type: int
      transport:
        choices:
        - rest
        default: rest
        description:
        - Configures the transport connection to use when connecting to the remote device.
        type: str
      user:
        description:
        - The username to connect to the BIG-IP or the BIG-IQ. This user must have administrative
          privileges on the device.
        - You may omit this option by setting the environment variable C(F5_USER).
        required: true
        type: str
      validate_certs:
        default: true
        description:
        - If C(no), SSL certificates are not validated. Use this only on personally controlled
          sites using self-signed certificates.
        - You may omit this option by setting the environment variable C(F5_VALIDATE_CERTS).
        type: bool
    type: dict
    version_added: 1.0.0
    version_added_collection: f5networks.f5_modules

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

async_timeout:
    default: 150
    description:
    - Parameter used when creating new UCS file on a 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

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.
    - This option always takes precedence over C(create_on_missing), hence when set to
      C(true), the module will always fail if the UCS is missing, even if C(create_on_missing)
      option is set to C(true).
    - When set to C(false), with C(create_on_missing) set to C(false) the module will
      return no change if the ucs file is missing on device.
    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).
    type: bool
    version_added: 1.12.0
    version_added_collection: f5networks.f5_modules

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.
    - When set to C(false), with C(fail_on_missing) set to C(false) the module will return
      no change if the ucs file is missing on device.
    type: bool

encryption_password:
    description:
    - Password to use to encrypt the UCS file if desired.
    type: str

Outputs

backup_file:
  description: Name of the backup file.
  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 the UCS was saved to.
  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
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, this
    is a randomly generated filename.
  returned: changed
  sample: cs_backup.ucs
  type: str
uid:
  description: Owner ID of the UCS file, after execution.
  returned: success
  sample: 100
  type: int