Skip to content

Commit

Permalink
Make AWS/GCP HANA cluster playbook follow best practices
Browse files Browse the repository at this point in the history
In some scenarios, playbooks to configure HANA resources in a cluster
are failing to deploy a healthy HanaSR cluster in AWS. This could be
either due to a race condition, or to not configuring the clone resource
into the cluster in maintenance mode as specified in the best practices.
This commits adds into the `cluster-hana.yaml` task calls to
`cs_wait_for_idle` after commands which modify the cluster
configuration, as well as modifying the cluster configuration so the
SAPHana resource clone is added in maintenance mode. Also calls were
added to remove the maintenance flag from this resource later in the
playbook.
  • Loading branch information
alvarocarvajald committed Feb 28, 2025
1 parent 8ea7844 commit 615a096
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions ansible/playbooks/tasks/cluster-hana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
clone-node-max="1"
target-role="Started"
interleave="true"
maintenance="true"
{% if clone_command == 'clone' %}promotable="true"{% endif %}
when:
- is_primary
Expand Down Expand Up @@ -179,6 +180,10 @@
- use_hana_sr_angi | bool
- hana_filesystem_clone | length == 0

- name: Wait for cluster to settle
ansible.builtin.command:
cmd: cs_wait_for_idle -s 5

- name: Configure colocation [aws]
ansible.builtin.command:
cmd: >-
Expand All @@ -205,6 +210,10 @@
- ip_colo | length == 0
- cloud_platform_is_gcp

- name: Wait for cluster to settle
ansible.builtin.command:
cmd: cs_wait_for_idle -s 5

# Order configured as documentation for both AWS and GCP dictates
# AWS: https://documentation.suse.com/sbp/sap-15/html/SLES4SAP-hana-sr-guide-perfopt-15-aws/index.html#id-constraints
# GCP: https://cloud.google.com/solutions/sap/docs/sap-hana-ha-config-sles#create_the_saphana_primitive_resource
Expand All @@ -220,6 +229,10 @@
- is_primary
- cluster_order | length == 0

- name: Wait for cluster to settle
ansible.builtin.command:
cmd: cs_wait_for_idle -s 5

# Get current maintenance state
- name: Refresh cluster status
ansible.builtin.command:
Expand All @@ -232,6 +245,22 @@
refreshed_crm_maintenance_mode: "{{ (refreshed_crm_conf_show.stdout | regex_search('maintenance-mode=([a-z]*)', '\\1'))[0] | default('unknown') }}"
changed_when: false

- name: Refresh SAPHana resource clone
ansible.builtin.command:
cmd: "crm resource refresh {{ ms_saphanactl }}"

- name: Wait for cluster to settle
ansible.builtin.command:
cmd: cs_wait_for_idle -s 5

- name: Remove maintenance mode from resource clone
ansible.builtin.command:
cmd: "crm resource maintenance {{ ms_saphanactl }} off"

- name: Wait for cluster to settle
ansible.builtin.command:
cmd: cs_wait_for_idle -s 5

- name: Ensure maintenance mode is disabled
ansible.builtin.command:
cmd: crm maintenance off
Expand Down

0 comments on commit 615a096

Please sign in to comment.