ibm / ibm.ibm_zos_core / 1.3.6 / module / zos_data_set Manage data sets | "added in version" 1.3.0 of ibm.ibm_zos_core" Authors: Blake Becker (@blakeinate)ibm.ibm_zos_core.zos_data_set (1.3.6) — module
Install with ansible-galaxy collection install ibm.ibm_zos_core:==1.3.6
collections: - name: ibm.ibm_zos_core version: 1.3.6
Create, delete and set attributes of data sets.
When forcing data set replacement, contents will not be preserved.
- name: Create a sequential data set if it does not exist zos_data_set: name: someds.name.here type: seq state: present
- name: Create a PDS data set if it does not exist zos_data_set: name: someds.name.here type: pds space_primary: 5 space_type: M record_format: fba record_length: 25
- name: Attempt to replace a data set if it exists zos_data_set: name: someds.name.here type: pds space_primary: 5 space_type: M record_format: u record_length: 25 replace: yes
- name: Attempt to replace a data set if it exists. If not found in the catalog, check if it is available on volume 222222, and catalog if found. zos_data_set: name: someds.name.here type: pds space_primary: 5 space_type: M record_format: u record_length: 25 volumes: "222222" replace: yes
- name: Create an ESDS data set if it does not exist zos_data_set: name: someds.name.here type: esds
- name: Create a KSDS data set if it does not exist zos_data_set: name: someds.name.here type: ksds key_length: 8 key_offset: 0
- name: Create an RRDS data set with storage class MYDATA if it does not exist zos_data_set: name: someds.name.here type: rrds sms_storage_class: mydata
- name: Delete a data set if it exists zos_data_set: name: someds.name.here state: absent
- name: Delete a data set if it exists. If data set not cataloged, check on volume 222222 for the data set, and then catalog and delete if found. zos_data_set: name: someds.name.here state: absent volumes: "222222"
- name: Write a member to an existing PDS; replace if member exists zos_data_set: name: someds.name.here(mydata) type: MEMBER replace: yes
- name: Write a member to an existing PDS; do not replace if member exists zos_data_set: name: someds.name.here(mydata) type: MEMBER
- name: Remove a member from an existing PDS zos_data_set: name: someds.name.here(mydata) state: absent type: MEMBER
- name: Create multiple partitioned data sets and add one or more members to each zos_data_set: batch: - name: someds.name.here1 type: PDS space_primary: 5 space_type: M record_format: fb replace: yes - name: someds.name.here1(member1) type: MEMBER - name: someds.name.here2(member1) type: MEMBER replace: yes - name: someds.name.here2(member2) type: MEMBER
- name: Catalog a data set present on volume 222222 if it is uncataloged. zos_data_set: name: someds.name.here state: cataloged volumes: "222222"
- name: Uncatalog a data set if it is cataloged. zos_data_set: name: someds.name.here state: uncataloged
- name: Create a data set on volumes 000000 and 222222 if it does not exist. zos_data_set: name: someds.name.here state: present volumes: - "000000" - "222222"
name: description: - The name of the data set being managed. (e.g C(USER.TEST)) - If I(name) is not provided, a randomized data set name will be generated with the HLQ matching the module-runners username. - Required if I(type=MEMBER) or I(state!=present) and not using I(batch). required: false type: str type: choices: - KSDS - ESDS - RRDS - LDS - SEQ - PDS - PDSE - LIBRARY - BASIC - LARGE - MEMBER - HFS - ZFS default: PDS description: - The data set type to be used when creating a data set. (e.g C(pdse)) - C(MEMBER) expects to be used with an existing partitioned data set. - Choices are case-insensitive. required: false type: str batch: description: - Batch can be used to perform operations on multiple data sets in a single module call. elements: dict 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: - The name of the data set being managed. (e.g C(USER.TEST)) - If I(name) is not provided, a randomized data set name will be generated with the HLQ matching the module-runners username. - Required if I(type=MEMBER) or I(state!=present) required: false type: str record_format: choices: - FB - VB - FBA - VBA - U default: FB description: - The format of the data set. (e.g C(FB)) - Choices are case-insensitive. required: false type: str record_length: description: - The length, in bytes, of each record in the data set. - 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 replace: default: false description: - When I(replace=True), and I(state=present), existing data set matching I(name) will be replaced. - 'Replacement is performed by deleting the existing data set and creating a new data set with the same name and desired attributes. Since the existing data set will be deleted prior to creating the new data set, no data set will exist if creation of the new data set fails. ' - If I(replace=True), all data in the original data set will be lost. required: false type: bool 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: default: 5 description: - The amount of primary space to allocate for the dataset. - The unit of space used is set using I(space_type). required: false type: int space_secondary: default: 3 description: - The amount of secondary space to allocate for the dataset. - The unit of space used is set using I(space_type). required: false type: int space_type: choices: - K - M - G - CYL - TRK default: M description: - 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 state: choices: - present - absent - cataloged - uncataloged default: present description: - The final state desired for specified data set. - 'If I(state=absent) and the data set does not exist on the managed node, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=absent) and the data set does exist on the managed node, remove the data set, module completes successfully with I(changed=True). ' - 'If I(state=absent) and I(volumes) is provided, and the data set is not found in the catalog, the module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog is successful, then the data set is removed. Module completes successfully with I(changed=True). ' - 'If I(state=absent) and I(volumes) is provided, and the data set is not found in the catalog, the module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog fails, then no action is taken. Module completes successfully with I(changed=False). ' - 'If I(state=present) and the data set does not exist on the managed node, create and catalog the data set, module completes successfully with I(changed=True). ' - 'If I(state=present) and I(replace=True) and the data set is present on the managed node the existing data set is deleted, and a new data set is created and cataloged with the desired attributes, module completes successfully with I(changed=True). ' - 'If I(state=present) and I(replace=False) and the data set is present on the managed node, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is already cataloged, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is not cataloged, module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog is successful, module completes successfully with I(changed=True). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is not cataloged, module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog fails, returns failure with I(changed=False). ' - 'If I(state=uncataloged) and the data set is not found, no action taken , module completes successfully with I(changed=False). ' - 'If I(state=uncataloged) and the data set is found, the data set is uncataloged, module completes successfully with I(changed=True). ' required: false type: str type: choices: - KSDS - ESDS - RRDS - LDS - SEQ - PDS - PDSE - LIBRARY - BASIC - LARGE - MEMBER - HFS - ZFS default: PDS description: - The data set type to be used when creating a data set. (e.g C(pdse)) - C(MEMBER) expects to be used with an existing partitioned data set. - Choices are case-insensitive. required: false type: str volumes: aliases: - volume description: - 'If cataloging a data set, I(volumes) specifies the name of the volume(s) where the data set is located. ' - 'If creating a data set, I(volumes) specifies the volume(s) where the data set should be created. ' - 'If I(volumes) is provided when I(state=present), and the data set is not found in the catalog, M(zos_data_set) will check the volume table of contents to see if the data set exists. If the data set does exist, it will be cataloged. ' - 'If I(volumes) is provided when I(state=absent) and the data set is not found in the catalog, M(zos_data_set) will check the volume table of contents to see if the data set exists. If the data set does exist, it will be cataloged and promptly removed from the system. ' - I(volumes) is required when I(state=cataloged). - Accepts a string when using a single volume and a list of strings when using multiple. required: false type: raw type: list state: choices: - present - absent - cataloged - uncataloged default: present description: - The final state desired for specified data set. - 'If I(state=absent) and the data set does not exist on the managed node, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=absent) and the data set does exist on the managed node, remove the data set, module completes successfully with I(changed=True). ' - 'If I(state=absent) and I(volumes) is provided, and the data set is not found in the catalog, the module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog is successful, then the data set is removed. Module completes successfully with I(changed=True). ' - 'If I(state=absent) and I(volumes) is provided, and the data set is not found in the catalog, the module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog fails, then no action is taken. Module completes successfully with I(changed=False). ' - 'If I(state=present) and the data set does not exist on the managed node, create and catalog the data set, module completes successfully with I(changed=True). ' - 'If I(state=present) and I(replace=True) and the data set is present on the managed node the existing data set is deleted, and a new data set is created and cataloged with the desired attributes, module completes successfully with I(changed=True). ' - 'If I(state=present) and I(replace=False) and the data set is present on the managed node, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is already cataloged, no action taken, module completes successfully with I(changed=False). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is not cataloged, module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog is successful, module completes successfully with I(changed=True). ' - 'If I(state=cataloged) and I(volumes) is provided and the data set is not cataloged, module attempts to perform catalog using supplied I(name) and I(volumes). If the attempt to catalog the data set catalog fails, returns failure with I(changed=False). ' - 'If I(state=uncataloged) and the data set is not found, no action taken , module completes successfully with I(changed=False). ' - 'If I(state=uncataloged) and the data set is found, the data set is uncataloged, module completes successfully with I(changed=True). ' required: false type: str replace: default: false description: - When I(replace=True), and I(state=present), existing data set matching I(name) will be replaced. - 'Replacement is performed by deleting the existing data set and creating a new data set with the same name and desired attributes. Since the existing data set will be deleted prior to creating the new data set, no data set will exist if creation of the new data set fails. ' - If I(replace=True), all data in the original data set will be lost. required: false type: bool volumes: aliases: - volume description: - 'If cataloging a data set, I(volumes) specifies the name of the volume(s) where the data set is located. ' - 'If creating a data set, I(volumes) specifies the volume(s) where the data set should be created. ' - 'If I(volumes) is provided when I(state=present), and the data set is not found in the catalog, M(zos_data_set) will check the volume table of contents to see if the data set exists. If the data set does exist, it will be cataloged. ' - 'If I(volumes) is provided when I(state=absent) and the data set is not found in the catalog, M(zos_data_set) will check the volume table of contents to see if the data set exists. If the data set does exist, it will be cataloged and promptly removed from the system. ' - I(volumes) is required when I(state=cataloged). - Accepts a string when using a single volume and a list of strings when using multiple. required: false type: raw block_size: description: - The block size to use for 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 space_type: choices: - K - M - G - CYL - TRK default: M description: - 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 record_format: choices: - FB - VB - FBA - VBA - U default: FB description: - The format of the data set. (e.g C(FB)) - Choices are case-insensitive. required: false type: str record_length: description: - The length, in bytes, of each record in the data set. - 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 space_primary: default: 5 description: - The amount of primary space to allocate for the dataset. - The unit of space used is set using I(space_type). 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 space_secondary: default: 3 description: - The amount of secondary space to allocate for the dataset. - The unit of space used is set using I(space_type). required: false type: int directory_blocks: description: - The number of directory blocks to allocate to the data set. required: false type: int 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 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
names: description: The data set names, including temporary generated data set names, in the order provided to the module. elements: str returned: always type: list