ibm.ibm_zos_core.zos_apf (1.9.0) — module

Add or remove libraries to Authorized Program Facility (APF)

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

Authors: Behnam (@balkajbaf)

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

Adds or removes libraries to Authorized Program Facility (APF).

Manages APF statement persistent entries to a data set or data set member.

Changes APF list format to "DYNAMIC" or "STATIC".

Gets the current APF list entries.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a library to the APF list
  zos_apf:
    library: SOME.SEQUENTIAL.DATASET
    volume: T12345
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a library (cataloged) to the APF list and persistence
  zos_apf:
    library: SOME.SEQUENTIAL.DATASET
    force_dynamic: True
    persistent:
      data_set_name: SOME.PARTITIONED.DATASET(MEM)
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a library from the APF list and persistence
  zos_apf:
    state: absent
    library: SOME.SEQUENTIAL.DATASET
    volume: T12345
    persistent:
      data_set_name: SOME.PARTITIONED.DATASET(MEM)
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Batch libraries with custom marker, persistence for the APF list
  zos_apf:
    persistent:
      data_set_name: "SOME.PARTITIONED.DATASET(MEM)"
      marker: "/* {mark} PROG001 USR0010 */"
    batch:
      - library: SOME.SEQ.DS1
      - library: SOME.SEQ.DS2
        sms: True
      - library: SOME.SEQ.DS3
        volume: T12345
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Print the APF list matching library pattern or volume serial number
  zos_apf:
    operation: list
    library: SOME.SEQ.*
    volume: T12345
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set the APF list format to STATIC
  zos_apf:
    operation: set_static

Inputs

    
sms:
    default: false
    description:
    - Indicates that the library specified in the C(library) parameter is managed by the
      storage management subsystem (SMS), and therefore no volume is associated with the
      library.
    - If C(sms=True), C(volume) value will be ignored.
    required: false
    type: bool

batch:
    description:
    - A list of dictionaries for adding or removing libraries.
    - This is mutually exclusive with C(library), C(volume), C(sms)
    - Can be used with C(persistent)
    elements: dict
    required: false
    suboptions:
      library:
        aliases:
        - name
        - lib
        description:
        - The library name to be added or removed from the APF list.
        required: true
        type: str
      sms:
        default: false
        description:
        - Indicates that the library specified in the C(library) parameter is managed
          by the storage management subsystem (SMS), and therefore no volume is associated
          with the library.
        - If true C(volume) will be ignored.
        required: false
        type: bool
      volume:
        description:
        - The identifier for the volume containing the library specified on the C(library)
          parameter. The values must be one of the following.
        - 1. The volume serial number
        - 2. Six asterisks (******), indicating that the system must use the volume serial
          number of the current system residence (SYSRES) volume.
        - 3. *MCAT*, indicating that the system must use the volume serial number of the
          volume containing the master catalog.
        - If C(volume) is not specified, C(library) has to be cataloged.
        required: false
        type: str
    type: list

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Ensure that the library is added C(state=present) or removed C(state=absent).
    - The APF list format has to be "DYNAMIC".
    required: false
    type: str

volume:
    description:
    - The identifier for the volume containing the library specified in the C(library)
      parameter. The values must be one the following.
    - 1. The volume serial number.
    - 2. Six asterisks (******), indicating that the system must use the volume serial
      number of the current system residence (SYSRES) volume.
    - 3. *MCAT*, indicating that the system must use the volume serial number of the volume
      containing the master catalog.
    - If C(volume) is not specified, C(library) has to be cataloged.
    required: false
    type: str

library:
    aliases:
    - name
    - lib
    description:
    - The library name to be added or removed from the APF list.
    required: false
    type: str

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

operation:
    choices:
    - set_dynamic
    - set_static
    - check_format
    - list
    description:
    - Change APF list format to "DYNAMIC" C(operation=set_dynamic) or "STATIC" C(operation=set_static)
    - Display APF list current format C(operation=check_format)
    - Display APF list entries when C(operation=list) C(library), C(volume) and C(sms)
      will be used as filters.
    - If C(operation) is not set, add or remove operation will be ignored.
    required: false
    type: str

persistent:
    description:
    - Add/remove persistent entries to or from I(data_set_name)
    - C(library) will not be persisted or removed if C(persistent=None)
    required: false
    suboptions:
      backup:
        default: false
        description:
        - Creates a backup file or backup data set for I(data_set_name), including the
          timestamp information to ensure that you retrieve the original APF list defined
          in I(data_set_name)".
        - I(backup_name) can be used to specify a backup file name if I(backup=true).
        - The backup file name will be return on either success or failure of module execution
          such that data can be retrieved.
        required: false
        type: bool
      backup_name:
        description:
        - Specify the USS file name or data set name for the destination backup.
        - If the source I(data_set_name) is a USS file or path, the backup_name name must
          be a file or path name, and the USS file or path must be an absolute path name.
        - If the source is an MVS data set, the backup_name must be an MVS data set name.
        - If the backup_name is not provided, the default backup_name will be used. If
          the source is a USS file or path, the name of the backup file will be the source
          file or path name appended with a timestamp. For example, C(/path/file_name.2020-04-23-08-32-29-bak.tar).
        - If the source is an MVS data set, it will be a data set with a random name generated
          by calling the ZOAU API. The MVS backup data set recovery can be done by renaming
          it.
        required: false
        type: str
      data_set_name:
        description:
        - The data set name used for persisting or removing a C(library) from the APF
          list.
        required: true
        type: str
      marker:
        default: /* {mark} ANSIBLE MANAGED BLOCK <timestamp> */
        description:
        - The marker line template.
        - C({mark}) will be replaced with "BEGIN" and "END".
        - Using a custom marker without the C({mark}) variable may result in the block
          being repeatedly inserted on subsequent playbook runs.
        - C({mark}) length may not exceed 72 characters.
        - The timestamp (<timestamp>) used in the default marker follows the '+%Y%m%d-%H%M%S'
          date format
        required: false
        type: str
    type: dict

force_dynamic:
    default: false
    description:
    - Will force the APF list format to "DYNAMIC" before adding or removing libraries.
    - If the format is "STATIC", the format will be changed to "DYNAMIC".
    required: false
    type: bool

Outputs

backup_name:
  description: Name of the backup file or data set that was created.
  returned: if backup=true, always
  type: str
msg:
  description: The module messages
  returned: failure
  sample: Parameter verification failed
  type: str
rc:
  description: The return code from ZOAU command apfadm
  returned: always
  type: int
stderr:
  description: The error messages from ZOAU command apfadm
  returned: always
  sample: 'BGYSC1310E ADD Error: Dataset COMMON.LINKLIB volume COMN01 is already present
    in APF list.'
  type: str
stdout:
  description:
  - The stdout from ZOAU command apfadm. Output varies based on the type of operation.
  - state> stdout of the executed operator command (opercmd), "SETPROG" from ZOAU
    command apfadm
  - 'operation> stdout of operation options list> Returns a list of dictionaries of
    APF list entries [{''vol'': ''PP0L6P'', ''ds'': ''DFH.V5R3M0.CICS.SDFHAUTH''},
    {''vol'': ''PP0L6P'', ''ds'': ''DFH.V5R3M0.CICS.SDFJAUTH''}, ...] set_dynamic>  Set
    to DYNAMIC set_static>   Set to STATIC check_format> DYNAMIC or STATIC'
  returned: always
  type: str