ibm.ibm_zos_zosmf.zmf_dataset (3.0.1) — module

Manage 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 community

Install collection

Install with ansible-galaxy collection install ibm.ibm_zos_zosmf:==3.0.1


Add to requirements.yml

  collections:
    - name: ibm.ibm_zos_zosmf
      version: 3.0.1

Description

Create, delete and operate on a sequential or partitioned data set, or a member of partitioned data set (PDS or PDSE) on z/OS system.

The available operations include rename data set or member, migrate data set and recall the migrated data set.

When forcing data set replacement, contents will not be preserved.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a sequential data set ZOSMF.ANSIBLE.PS if it does not exist
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "present"
    dataset_type: "PS"
    dataset_create_attributes:
      primary: 10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a sequential data set ZOSMF.ANSIBLE.PS depending on the model data set ZOSMF.ANSIBLE.MODEL
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "present"
    dataset_type: "PS"
    dataset_create_like: "ZOSMF.ANSIBLE.MODEL"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Replace a partitioned data set ZOSMF.ANSIBLE.PDS if it exists
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PDS"
    dataset_state: "present"
    dataset_type: "PDS"
    dataset_replace: true
    dataset_create_attributes:
      primary: 10
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create a data set member ZOSMF.ANSIBLE.PDS(MEMBER) to an existing PDS, replace if member exists
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PDS(MEMBER)"
    dataset_state: "present"
    dataset_type: "MEMBER"
    dataset_replace: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rename a data set ZOSMF.ANSIBLE.PS to ZOSMF.ANSIBLE.PS01
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "present"
    dataset_type: "PS"
    dataset_new_name: "ZOSMF.ANSIBLE.PS01"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Rename a data set member ZOSMF.ANSIBLE.PDS(MEMBER) to ZOSMF.ANSIBLE.PDS(MEMBER01)
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PDS(MEMBER)"
    dataset_state: "present"
    dataset_type: "MEMBER"
    dataset_new_name: "ZOSMF.ANSIBLE.PDS(MEMBER01)"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a data set ZOSMF.ANSIBLE.PS
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "absent"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Migrate a data set ZOSMF.ANSIBLE.PS
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "migrated"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Recall a data set ZOSMF.ANSIBLE.PS and wait for the completion of the request
  zmf_dataset:
    zmf_host: "sample.ibm.com"
    dataset_name: "ZOSMF.ANSIBLE.PS"
    dataset_state: "recalled"
    dataset_migrate_recall: "wait"

Inputs

    
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_name:
    description:
    - Name of the data set or member being managed.
    - 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)``.
    required: true
    type: str

dataset_type:
    choices:
    - PS
    - PDS
    - PDSE
    - MEMBER
    default: PS
    description:
    - The type to be used when creating a data set or member.
    - When I(dataset_type=MEMBER), I(dataset_name) should be a member of an existing partitioned
      data set.
    - This variable only take effects when I(dataset_state=present).
    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

dataset_state:
    choices:
    - present
    - absent
    - migrated
    - recalled
    description:
    - The final state desired for specified data set or member.
    - 'If I(dataset_state=present) and I(dataset_name) does not exist, I(dataset_name)
      is created, the module completes successfully with C(changed=True).

      '
    - 'If I(dataset_state=present) and I(dataset_name) exists, when I(dataset_replace=true),
      the existing data set is deleted, and a new data set is created with the same name
      and desired attributes, the module completes successfully with C(changed=True).

      '
    - 'If I(dataset_state=present) and I(dataset_name) exists, when I(dataset_replace=false),
      no action taken, the module completes successfully with C(changed=False).

      '
    - 'If I(dataset_state=absent) and I(dataset_name) does not exist, no action taken,
      the module completes successfully with C(changed=False).

      '
    - 'If I(dataset_state=absent) and I(dataset_name) exists, the existing I(dataset_name)
      is deleted, the module completes successfully with C(changed=True).

      '
    - 'If I(dataset_state=migrated), the existing I(dataset_name) is migrated, the module
      completes successfully with C(changed=True).

      '
    - 'If I(dataset_state=recalled), the migrated I(dataset_name) is recalled, the module
      completes successfully with C(changed=True).

      '
    required: true
    type: str

dataset_volser:
    default: null
    description:
    - The volume serial to identify the volume to be searched for an uncataloged 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.
    - 'When creating a sequential or partitioned data set, this variable specifies the
      name of the disk volume on which the data set resides. This value is not specified
      for an SMS-managed data set.

      '
    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

dataset_replace:
    default: false
    description:
    - Specifies whether the existing data set or member matching I(dataset_name) will
      be replaced when I(dataset_state=present).
    - If I(dataset_replace=true), the existing data set will be deleted, a new data set
      with the same name and desired attributes will be created.
    - If I(dataset_replace=true), all data in the original data set will be lost.
    - If I(dataset_replace=true), no data set will exist if creation of the new data set
      fails.
    - This variable only take effects when I(dataset_state=present).
    required: false
    type: bool

dataset_new_name:
    default: null
    description:
    - Specifies the new name of the data set or member.
    - This variable only take effects when I(dataset_state=present).
    required: false
    type: str

dataset_create_like:
    default: null
    description:
    - Specifies the model data set to be used to create a sequential or partitioned 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_state=present).
    - This variable only take effects when I(dataset_type=PS) or I(dataset_type=PDS) or
      I(dataset_type=PDSE).
    - If both I(dataset_create_attributes) and I(dataset_create_like) are supplied, I(dataset_create_like)
      is ignored.
    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_state=present).
    - If I(dataset_migrate_recall=wait), the migrated data set is recalled synchronously.
    - If I(dataset_migrate_recall=nowait), request the migrated data set to be recalled,
      but do not wait.
    - If I(dataset_migrate_recall=error), do not attempt to recall the migrated data set.
    - Specifies whether wait for the completion of the request when I(dataset_state=migrated)
      or I(dataset_state=recalled).
    - If I(dataset_migrate_recall=wait), wait for the completion of the request.
    - If I(dataset_migrate_recall=nowait), the request is queued.
    - I(dataset_migrate_recall=error) is invalid when I(dataset_state=migrated) or I(dataset_state=recalled).
    required: false
    type: str

dataset_create_attributes:
    default: null
    description:
    - Specifies the attributes to be used to create a sequential or partitioned data set.
    - This variable only take effects when I(dataset_state=present).
    - This variable only take effects when I(dataset_type=PS) or I(dataset_type=PDS) or
      I(dataset_type=PDSE).
    - If both I(dataset_create_attributes) and I(dataset_create_like) are supplied, I(dataset_create_like)
      is ignored.
    required: false
    suboptions:
      alcunit:
        choices:
        - TRK
        - BLK
        - CYL
        default: TRK
        description:
        - Specifies the unit (tracks, blocks or cylinders) in which primary and secondary
          space allocations are to be obtained.
        required: false
        type: str
      avgblk:
        default: null
        description:
        - Specifies the average block size.
        required: false
        type: int
      blksize:
        default: null
        description:
        - Specifies the maximum length of a block.
        required: false
        type: int
      dataclass:
        default: null
        description:
        - Specifies the data class for an SMS-managed data set.
        required: false
        type: str
      dirblk:
        default: null
        description:
        - Specifies the number of directory blocks.
        required: false
        type: int
      lrecl:
        default: 80
        description:
        - Specifies the length, in bytes, of each record in the data set.
        - If the records are of variable-length or undefined-length, the maximum record
          length must be specified.
        required: false
        type: int
      mgntclass:
        default: null
        description:
        - Specifies the management class for an SMS-managed data set.
        required: false
        type: str
      primary:
        description:
        - Specifies the primary space allocation for the data set.
        required: true
        type: int
      recfm:
        choices:
        - FB
        - VB
        - DB
        - F
        - V
        - D
        - U
        - VS
        - VBS
        - FS
        - FBS
        - DS
        - DBS
        default: FB
        description:
        - 'Specifies the characteristics of the records in the data set as fixed length
          (F), variable-length (V), ASCII variable-length (D), or undefined-length (U).
          Blocked records are specified as FB, VB, or DB. Spanned records are specified
          as VS, VBS, FS, FBS, DS, or DBS.

          '
        required: false
        type: str
      secondary:
        default: null
        description:
        - Specifies the secondary space allocation for the data set.
        - 'If this value is omitted, the secondary space will be specified as 0.5 times
          of the primary space when I(dataset_type=PS), or as 0.2 times of the primary
          space when I(dataset_type=PDS) or I(dataset_type=PDSE).

          '
        required: false
        type: int
      storclass:
        default: null
        description:
        - Specifies the storage class for an SMS-managed data set.
        required: false
        type: str
      unit:
        default: 3390
        description:
        - Specifies the storage unit device type.
        required: false
        type: str
    type: dict

Outputs

changed:
  description: Indicates if any change is made during the module operation.
  returned: always
  type: bool
dataset_properties:
  description: The properties of the present data set.
  returned: on success
  sample:
    blksz: '80'
    catnm: CATALOG.SVPLEX.MASTER
    cdate: 2021/01/21
    dev: '3390'
    dsname: ZOSMF.ANSIBLE.PS
    dsorg: PS
    edate: None
    extx: '1'
    lrecl: '80'
    migr: 'NO'
    mvol: N
    ovf: 'NO'
    rdate: 2021/01/25
    recfm: FB
    sizex: '4'
    spacu: TRACKS
    used: '0'
    vol: VOL001
    vols: VOL001
  type: dict
member_properties:
  description: The properties of the present member.
  returned: on success
  sample:
    c4date: 2021/01/21
    cnorc: 2
    inorc: 0
    m4date: 2021/01/21
    member: MEMBER
    mnorc: 0
    mod: 2
    msec: '42'
    mtime: 02:51
    sclm: N
    user: IBMUSER
    vers: 1
  type: dict
message:
  description: The output message generated by the module to indicate whether the
    data set or member is successfully created, deleted, or updated.
  returned: on success
  sample:
    sample1: The data set ZOSMF.ANSIBLE.PS is created successfully.
    sample2: The data set member ZOSMF.ANSIBLE.PDS(MEMBER) is deleted successfully.
    sample3: The data set ZOSMF.ANSIBLE.PS does not exist.
    sample4: The data set member ZOSMF.ANSIBLE.PDS(MEMBER) already exists.
    sample5: The data set ZOSMF.ANSIBLE.PS is successfully renamed to /ZOSMF.ANSIBLE.PS01.
    sample6: The data set ZOSMF.ANSIBLE.PS is migrated successfully.
    sample7: The data set ZOSMF.ANSIBLE.PS is recalled successfully.
  type: str