Skip to content

Automating "Apply Check" with HOLD resolution in zmf_swupdate_retrieve #31

@Monish00006

Description

@Monish00006

Currently, performing a comprehensive maintenance "Apply Check" via Ansible is difficult because the zmf_swupdate_retrieve role does not have a clearly documented or streamlined way to bypass SMP/E HOLDS (SYSTEM/USER). While the zmf_swupdate_retrieve role exists, there is no explicit role in my current collection version to handle the apply_check and apply through ibm_zosmf ansible collections. I want to resolve the hold(SYSTEM/USER) and do the apply check and then apply through ansible zosmf collections.

Below is my ansible script.

            ---
            - name: z/OSMF Maintenance Apply Check
              hosts: "{{ target_host | default('mainframe') }}"
              gather_facts: false
              collections:
                - ibm.ibm_zosmf
              vars:
                # z/OSMF Connection Details
                    # Software Instance Details
                    # The name of the CA1 instance as defined in z/OSMF
                    sw_instance_name: "sample_instance"
                    zmf_system_nickname: "ZO1"
                    target_zone_name: "TGT"
                    # Maintenance Type: 'corrective', 'recommended', or 'functional'
                    update_type: "recommended"
                    # Define your SOURCEID list here
                    my_sourceids:
                    - "RSU*"
                    - "SECINT"
                    - "HIPER"
                    - "CAR*"
                    - "RSL*"
                    - "PRP"
                  # Define which HOLDs to bypass automatically
                    my_bypass_holds:
                    - "SYSTEM"
                  
              tasks:
                - name: Cleanup any existing software update operations
                  include_role:
                    name: ibm.ibm_zosmf.zmf_swupdate_cancel
                  vars:
                    software_instance_name: "{{ sw_instance_name }}"
                    system_nickname: "{{ zmf_system_nickname }}"
                  # We use ignore_errors because if there is NO active task, 
                  # this role might return a 404/Error which we want to skip.
                  ignore_errors: true
            
                - name: Start the Software Update process
                  include_role:
                    name: ibm.ibm_zosmf.zmf_swupdate_start
                  vars:
                    software_instance_name: "{{ sw_instance_name }}"
                    system_nickname: "{{ zmf_system_nickname }}"
                    target_zone: "{{ target_zone_name }}"
                    sourceids: "{{ my_sourceids }}"
                    bypass_hold_list: "{{ my_bypass_holds }}"
                    update_type: "{{ update_type }}"
                  register: update_start_info
            
                - name: Retrieve the list of applicable updates
                  include_role:
                    name: ibm.ibm_zosmf.zmf_swupdate_retrieve
                  vars:
                    software_instance_name: "{{ sw_instance_name }}"
                    system_nickname: "{{ zmf_system_nickname }}"
                    # PASS THE SOURCEID LIST HERE
                    sourceids: "{{ my_sourceids }}" 
                    bypass_hold_list: "{{ my_bypass_holds }}"
                    swupdate_retrieve_response_file: "/home/a883438/Gitrepo/ai-tool_zosmf/outputs/retrieve_results.json"
                  register: update_list

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions