ibm.ibm_zos_core.zos_unarchive (1.9.0) — module

Unarchive files and data sets in z/OS.

| "added in version" 1.7.0 of ibm.ibm_zos_core"

Authors: Oscar Fernando Flores Garcia (@fernandofloresg)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install ibm.ibm_zos_core:==1.9.0


Add to requirements.yml

  collections:
    - name: ibm.ibm_zos_core
      version: 1.9.0

Description

The C(zos_unarchive) module unpacks an archive after optionally transferring it to the remote system.

For supported archive formats, see option C(format).

Supported sources are USS (UNIX System Services) or z/OS data sets.

Mixing MVS data sets with USS files for unarchiving is not supported.

The archive is sent to the remote as binary, so no encoding is performed.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Simple extract
- name: Copy local tar file and unpack it on the managed z/OS node.
  zos_unarchive:
    src: "./files/archive_folder_test.tar"
    format:
      name: tar
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# use include
- name: Unarchive a bzip file selecting only a file to unpack.
  zos_unarchive:
    src: "/tmp/test.bz2"
    format:
      name: bz2
    include:
      - 'foo.txt'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Use exclude
- name: Unarchive a terse data set and excluding data sets from unpacking.
  zos_unarchive:
    src: "USER.ARCHIVE.RESULT.TRS"
    format:
      name: terse
    exclude:
      - USER.ARCHIVE.TEST1
      - USER.ARCHIVE.TEST2
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# List option
- name: List content from XMIT
  zos_unarchive:
    src: "USER.ARCHIVE.RESULT.XMIT"
    format:
      name: xmit
      format_options:
        use_adrdssu: True
    list: True

Inputs

    
src:
    description:
    - The remote absolute path or data set of the archive to be uncompressed.
    - I(src) can be a USS file or MVS data set name.
    - USS file paths should be absolute paths.
    - MVS data sets supported types are C(SEQ), C(PDS), C(PDSE).
    required: true
    type: str

dest:
    description:
    - The remote absolute path or data set where the content should be unarchived to.
    - I(dest) can be a USS file, directory or MVS data set name.
    - If dest has missing parent directories, they will not be created.
    required: false
    type: str

list:
    default: false
    description:
    - Will list the contents of the archive without unpacking.
    required: false
    type: bool

mode:
    description:
    - The permission of the uncompressed files.
    - If C(dest) is USS, this will act as Unix file mode, otherwise ignored.
    - It should be noted that modes are octal numbers. The user must either add a leading
      zero so that Ansible's YAML parser knows it is an octal number (like C(0644) or
      C(01777))or quote it (like C('644') or C('1777')) so Ansible receives a string and
      can do its own conversion from string into number. Giving Ansible a number without
      following one of these rules will end up with a decimal number which will have unexpected
      results.
    - The mode may also be specified as a symbolic mode (for example, ``u+rwx`` or ``u=rw,g=r,o=r``)
      or a special string `preserve`.
    - I(mode=preserve) means that the file will be given the same permissions as the source
      file.
    required: false
    type: str

force:
    default: false
    description:
    - If set to true and the remote file or data set dest exists, the dest will be deleted.
    required: false
    type: bool

group:
    description:
    - Name of the group that will own the file system objects.
    - 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.
    - This option is only applicable if C(dest) is USS, otherwise ignored.
    required: false
    type: str

owner:
    description:
    - Name of the user that should own the filesystem object, as would be passed to the
      chown command.
    - When left unspecified, it uses the current user unless you are root, in which case
      it can preserve the previous ownership.
    required: false
    type: str

format:
    description:
    - The compression type and corresponding options to use when archiving data.
    required: true
    suboptions:
      format_options:
        description:
        - Options specific to a compression format.
        required: false
        suboptions:
          dest_volumes:
            description:
            - When I(use_adrdssu=True), specify the volume the data sets will be written
              to.
            - If no volume is specified, storage management rules will be used to determine
              the volume where the file will be unarchived.
            - If the storage administrator has specified a system default unit name and
              you do not set a volume name for non-system-managed data sets, then the
              system uses the volumes associated with the default unit name. Check with
              your storage administrator to determine whether a default unit name has
              been specified.
            elements: str
            type: list
          use_adrdssu:
            default: false
            description:
            - If set to true, the C(zos_archive) module will use Data Facility Storage
              Management Subsystem data set services (DFSMSdss) program ADRDSSU to uncompress
              data sets from a portable format after using C(xmit) or C(terse).
            type: bool
          xmit_log_data_set:
            description:
            - Provide the name of a data set to store xmit log output.
            - If the data set provided does not exist, the program will create it.
            - 'If the data set provided exists, the data set must have the following attributes:
              LRECL=255, BLKSIZE=3120, and RECFM=VB'
            - When providing the I(xmit_log_data_set) name, ensure there is adequate space.
            type: str
        type: dict
      name:
        choices:
        - bz2
        - gz
        - tar
        - zip
        - terse
        - xmit
        - pax
        description:
        - The compression format to use.
        required: true
        type: str
    type: dict

exclude:
    description:
    - List the directory and file or data set names that you would like to exclude from
      the unarchive action.
    - Mutually exclusive with include.
    elements: str
    required: false
    type: list

include:
    description:
    - A list of directories, files or data set names to extract from the archive.
    - When C(include) is set, only those files will we be extracted leaving the remaining
      files in the archive.
    - Mutually exclusive with exclude.
    elements: str
    required: false
    type: list

tmp_hlq:
    description:
    - Override the default high level qualifier (HLQ) for temporary data sets.
    - The default HLQ is the Ansible user used to execute the module and if that is not
      available, then the environment variable value C(TMPHLQ) is used.
    required: false
    type: str

remote_src:
    default: false
    description:
    - If set to true, C(zos_unarchive) retrieves the archive from the remote system.
    - If set to false, C(zos_unarchive) searches the local machine (Ansible controller)
      for the archive.
    required: false
    type: bool

dest_data_set:
    description:
    - Data set attributes to customize a C(dest) data set that the archive will be copied
      into.
    required: false
    suboptions:
      block_size:
        description:
        - The block size to use for the data set.
        required: false
        type: int
      directory_blocks:
        description:
        - The number of directory blocks to allocate to the data set.
        required: false
        type: int
      key_length:
        description:
        - The key length to use when creating a KSDS data set.
        - I(key_length) is required when I(type=KSDS).
        - I(key_length) should only be provided when I(type=KSDS)
        required: false
        type: int
      key_offset:
        description:
        - The key offset to use when creating a KSDS data set.
        - I(key_offset) is required when I(type=KSDS).
        - I(key_offset) should only be provided when I(type=KSDS)
        required: false
        type: int
      name:
        description:
        - Desired name for destination dataset.
        required: false
        type: str
      record_format:
        choices:
        - FB
        - VB
        - FBA
        - VBA
        - U
        description:
        - If the destination data set does not exist, this sets the format of the data
          set. (e.g C(FB))
        - Choices are case-insensitive.
        required: false
        type: str
      record_length:
        description:
        - The length of each record in the data set, in bytes.
        - For variable data sets, the length must include the 4-byte prefix area.
        - 'Defaults vary depending on format: If FB/FBA 80, if VB/VBA 137, if U 0.'
        required: false
        type: int
      sms_data_class:
        description:
        - The data class for an SMS-managed dataset.
        - Optional for SMS-managed datasets that do not match an SMS-rule.
        - Not valid for datasets that are not SMS-managed.
        - Note that all non-linear VSAM datasets are SMS-managed.
        required: false
        type: str
      sms_management_class:
        description:
        - The management class for an SMS-managed dataset.
        - Optional for SMS-managed datasets that do not match an SMS-rule.
        - Not valid for datasets that are not SMS-managed.
        - Note that all non-linear VSAM datasets are SMS-managed.
        required: false
        type: str
      sms_storage_class:
        description:
        - The storage class for an SMS-managed dataset.
        - Required for SMS-managed datasets that do not match an SMS-rule.
        - Not valid for datasets that are not SMS-managed.
        - Note that all non-linear VSAM datasets are SMS-managed.
        required: false
        type: str
      space_primary:
        description:
        - If the destination I(dest) data set does not exist , this sets the primary space
          allocated for the data set.
        - The unit of space used is set using I(space_type).
        required: false
        type: int
      space_secondary:
        description:
        - If the destination I(dest) data set does not exist , this sets the secondary
          space allocated for the data set.
        - The unit of space used is set using I(space_type).
        required: false
        type: int
      space_type:
        choices:
        - K
        - M
        - G
        - CYL
        - TRK
        description:
        - If the destination data set does not exist, this sets the unit of measurement
          to use when defining primary and secondary space.
        - Valid units of size are C(K), C(M), C(G), C(CYL), and C(TRK).
        required: false
        type: str
      type:
        choices:
        - SEQ
        - PDS
        - PDSE
        default: SEQ
        description:
        - Organization of the destination
        required: false
        type: str
    type: dict

Outputs

dest_path:
  description:
  - Destination path where archive was unpacked.
  returned: always
  type: str
missing:
  description: Any files or data sets not found during extraction.
  returned: success
  type: str
src:
  description: File path or data set name unpacked.
  returned: always
  type: str
targets:
  description: List of files or data sets in the archive.
  elements: str
  returned: success
  type: list

See also