Skip to content

Commit

Permalink
Fix: Update Parameters and Reset Resources (#674)
Browse files Browse the repository at this point in the history
* ### Fix:
- Update `keepalive` parameter to uppercase.
- Set the priority to primary `IPaddr2` and `azure-lb` resource if `priority-fencing-delay` is configured.
- Perform `crm resource clear` to reset failcounts on resources.
- Clean up unused validation tasks.

* Refactor: Improve task definitions and add resource cleanup steps for 1.17 Generic Pacemaker

* Enhance BOM processing: Gather dependencies before processing and improve loop variable handling

* Update Ansible configuration: Switch stdout callback from JSON to YAML
  • Loading branch information
hdamecharla authored Dec 9, 2024
1 parent 57804fe commit d174d5c
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 151 deletions.
41 changes: 0 additions & 41 deletions deploy/ansible/playbook_00_validate_parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -610,47 +610,6 @@
- always
- 0.0-internet

# - name: "0.0 Validations - Get repository listing (SUSE)"
# ansible.builtin.command: zypper lr
# register: zypper_results
# changed_when: false
# when:
# - (ansible_distribution | lower ~ ansible_distribution_major_version) in ['suse15', 'sles_sap15' ]
# tags:
# - 0.0-zypper

# - name: "0.0 Validations - Show repositories"
# ansible.builtin.debug:
# var: zypper_results.stdout_lines
# verbosity: 0
# when:
# - (ansible_distribution | lower ~ ansible_distribution_major_version) in ['suse15', 'sles_sap15' ]
# - zypper_results is defined

# - name: "0.0 Validations - Get repository listing (RHEL)"
# ansible.builtin.command: yum repolist
# register: yum_results
# changed_when: false
# when:
# - (ansible_distribution | lower ~ ansible_distribution_major_version) in ['redhat7', 'redhat8']
# tags:
# - 0.0-yum

# - name: "0.0 Validations - Show repositories"
# ansible.builtin.debug:
# var: yum_results.stdout_lines
# when:
# - (ansible_distribution | lower ~ ansible_distribution_major_version) in ['redhat7', 'redhat8']
# - yum_results is defined

# - name: "0.0 Validations - Show Mounts"
# ansible.builtin.command: df -h
# register: mounts
# failed_when: false
# tags:
# - 0.0-mounts
# when:
# - ansible_os_family != "Windows"
- name: "0.0 Validations - Show Mounts"
ansible.builtin.debug:
msg:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
path: "{{ shared_disk_drive_letter }}:\\usr\\sap\\{{ sap_sid | upper }}\\SYS\\profile\\{{ sap_sid | upper }}_ASCS{{ scs_instance_number }}_{{ scs_cluster_hostname }}"
regex: "^enque/encni/set_so_keepalive"
insertbefore: "^rdisp/enqname"
line: "enque/encni/set_so_keepalive = true"
line: "enque/encni/set_so_keepalive = TRUE"
state: present
when:
- ansible_hostname == primary_node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,25 @@
# Description: Process BOM dependencies.
# Call BOM processor, passing dependent BOM names.
#
- name: "3.3 BoM Processing: - Process dependent BOMs"
# bom_processor.yaml
# Gather Dependencies
- name: "3.3 BoM Processing: - Gather all dependencies"
ansible.builtin.set_fact:
current_dependencies: "{{ bom.materials.dependencies | default([]) }}"

# Process Dependencies
- name: "3.3 BoM Processing: - Process each dependency"
ansible.builtin.include_tasks: "bom_processor.yaml"
vars:
bom_name: "{{ bom_dependency.name }}"
loop: "{{ bom.materials.dependencies | flatten(levels=1) }}"
bom_name: "{{ current_dep.name }}"
dependencies_processed: true
loop: "{{ current_dependencies | flatten(levels=1) }}"
loop_control:
loop_var: bom_dependency
loop_var: current_dep
when:
- bom.materials.dependencies is defined
- bom.materials.dependencies | length>0
- current_dependencies | length > 0
- dependencies_processed is not defined

# -------------------------------------+---------------------------------------8


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# +------------------------------------4--------------------------------------*/

- name: "5.5.4.1 HANA Cluster configuration - Optimise the Pacemaker cluster for SAP HANA"
when: ansible_hostname == primary_instance_name
when: ansible_hostname == primary_instance_name
block:
- name: "5.5.4.1 HANA Cluster configuration - Get the cluster maintenance mode status"
ansible.builtin.shell: pcs property show maintenance-mode
Expand Down Expand Up @@ -237,6 +237,24 @@
register: sec_constraint
failed_when: sec_constraint.rc > 1

# https://learn.microsoft.com/en-us/azure/sap/workloads/sap-hana-high-availability-rhel?tabs=lb-portal#add-a-secondary-virtual-ip-address-resource-for-an-activeread-enabled-setup
# Set the priority to primary IPaddr2 and azure-lb resource if priority-fencing-delay is configured
- name: "5.5.4.1 HANA Cluster configuration - Set priority for the Virtual IP and azure-lb resources"
when:
- database_active_active | default(false)
- not db_scale_out
- is_pcmk_ver_gt_204
block:
- name: "5.5.4.1 HANA Cluster configuration - Set priority for the Virtual IP resource"
ansible.builtin.shell: pcs resource update vip_{{ db_sid | upper }}_{{ db_instance_number }} meta priority=5
register: update_priority_vip
failed_when: update_priority_vip.rc > 1

- name: "5.5.4.1 HANA Cluster configuration - Set priority for the azure-lb resource"
ansible.builtin.shell: pcs resource update nc_{{ db_sid | upper }}_{{ db_instance_number }} meta priority=5
register: update_priority_nc
failed_when: update_priority_nc.rc > 1

- name: "5.5.4.1 HANA Cluster configuration - Disable Maintenance mode for the cluster"
ansible.builtin.shell: pcs property set maintenance-mode=false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@
- name: "5.5.4.1 HANA Pacemaker configuration - Ensure any required cluster resources are cleaned up"
ansible.builtin.command: "crm resource cleanup rsc_SAPHana_{{ db_sid | upper }}_HDB{{ db_instance_number }}"

- name: "5.5.4.1 HANA Pacemaker configuration - cleanup cluster resources"
ansible.builtin.command: "crm resource cleanup"

- name: "5.5.4.1 HANA Pacemaker configuration - Set the priority fencing delay"
ansible.builtin.shell: crm configure property priority-fencing-delay=30

Expand Down Expand Up @@ -199,6 +196,9 @@
register: sec_colocation
failed_when: sec_colocation.rc > 1

- name: "5.5.4.1 HANA Pacemaker configuration - cleanup cluster resources"
ansible.builtin.command: "crm resource clear"

- name: "5.5.4.1 HANA Pacemaker configuration - Ensure maintenance mode is disabled"
ansible.builtin.command: crm configure property maintenance-mode=false

Expand Down Expand Up @@ -422,6 +422,9 @@
ansible.builtin.command: >
crm configure property priority-fencing-delay=30
- name: "5.5.4.1 HANA Pacemaker configuration - cleanup cluster resources"
ansible.builtin.command: "crm resource clear"

- name: "5.5.4.1 HANA Pacemaker configuration - Disable maintenance mode [SAPHanaSR-angi]"
ansible.builtin.command: >
crm configure property maintenance-mode=false
Expand All @@ -434,17 +437,17 @@
- name: "5.5.4.1 HANA Cluster configuration - Configure HANA active/read-enabled system replication"
when: database_active_active | default(false)
block:
- name: "Get the cluster maintenance mode status"
ansible.builtin.shell: crm configure get_property maintenance-mode
register: get_status_maintenance_mode
changed_when: false
ignore_errors: true

- name: "Set the cluster maintenance mode if not already in maintenance mode"
ansible.builtin.shell: crm configure property maintenance-mode=true
- name: "5.5.4.1 HANA Cluster configuration - Get the cluster maintenance mode status"
ansible.builtin.shell: crm configure get_property maintenance-mode
register: get_status_maintenance_mode
changed_when: false
ignore_errors: true

- name: "5.5.4.1 HANA Cluster configuration - Set the cluster maintenance mode if not already in maintenance mode"
ansible.builtin.shell: crm configure property maintenance-mode=true
when: >-
get_status_maintenance_mode.stdout is not search('true') or
get_status_maintenance_mode.stdout is search('false')
get_status_maintenance_mode.stdout is not search('true') or
get_status_maintenance_mode.stdout is search('false')
- name: "5.5.4.1 HANA Cluster configuration - Configure the Active/Active Virtual IP resource"
ansible.builtin.shell: |
Expand Down Expand Up @@ -478,6 +481,9 @@
register: sec_colocation
failed_when: sec_colocation.rc > 1

- name: "5.5.4.1 HANA Pacemaker configuration - cleanup cluster resources"
ansible.builtin.command: "crm resource clear"

- name: "5.5.4.1 HANA Cluster configuration - Disable maintenance mode"
ansible.builtin.command: crm configure property maintenance-mode=false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
- name: "5.6 SCSERS - Add the keep alive parameter, if using ENSA1"
ansible.builtin.lineinfile:
path: '{{ scs_instance_profile_path }}'
line: enque/encni/set_so_keepalive = true
line: enque/encni/set_so_keepalive = TRUE
tags:
- keepalive
when:
Expand Down Expand Up @@ -235,7 +235,7 @@
- name: "5.6 SCSERS - Add the keep alive parameter, if using ENSA1"
ansible.builtin.lineinfile:
path: '{{ scs_instance_profile_path }}'
line: enque/encni/set_so_keepalive = true
line: enque/encni/set_so_keepalive = TRUE
tags:
- keepalive
when:
Expand Down

0 comments on commit d174d5c

Please sign in to comment.