Skip to content

sap_ha_pacemaker_cluster: SLES16 support, new vars for ha_cluster for corosync and zypper patterns #1056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion roles/sap_ha_pacemaker_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Ansible Role `sap_ha_pacemaker_cluster` is used to install and configure Lin

<!-- BEGIN Dependencies -->
## Dependencies
- `fedora.linux_system_roles`
- `fedora.linux_system_roles`, commonly referenced as `LSR`.
- Roles:
- `ha_cluster`

Expand Down Expand Up @@ -1168,4 +1168,9 @@ Name of the NetWeaver SCS resource group.<br>

Name of the Virtual IP resource for NetWeaver Central Services (SCS).<br>

### sap_ha_pacemaker_cluster_zypper_patterns
- _Type:_ `list`<br>

(SUSE Specific) Additional zypper patterns to be installed.<br>

<!-- END Role Variables -->
7 changes: 7 additions & 0 deletions roles/sap_ha_pacemaker_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ sap_ha_pacemaker_cluster_cluster_properties:
# score is dynamic and automatically increased for groups
sap_ha_pacemaker_cluster_constraint_colo_base_score: 2000

### Corosync variables
sap_ha_pacemaker_cluster_corosync_totem: {}
sap_ha_pacemaker_cluster_corosync_transport: {}

################################################################################
# Inherit from 'ha_cluster' Linux System Role parameters when defined
################################################################################
Expand All @@ -87,6 +91,9 @@ sap_ha_pacemaker_cluster_extra_packages: []
# Optional: additional fence agent packages. This is combined with the above "minimal" list.
sap_ha_pacemaker_cluster_fence_agent_packages: []

# (SUSE Specific) Optional list of zypper patterns to install.
sap_ha_pacemaker_cluster_zypper_patterns: []

# Mandatory.
# Either inherit from the 'ha_cluster' LSR variable when defined, but do not set a default.
# This fails the argument validation when none of the 2 vars are defined.
Expand Down
36 changes: 36 additions & 0 deletions roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,37 @@ argument_specs:
stonith-timeout: 900
concurrent-fencing: true

sap_ha_pacemaker_cluster_corosync_totem:
type: dict
default: Specified in Operating System and Platform variables.
description:
- Define dictionary of options for corosync totem configuration.

example:
sap_ha_pacemaker_cluster_corosync_totem:
options:
token: 5000
token_retransmits_before_loss_const: 10
join: 60
consensus: 6000
max_messages: 20

sap_ha_pacemaker_cluster_corosync_transport:
type: dict
default: Specified in Operating System variables.
description:
- Define dictionary of options for corosync transport configuration.
- Available options are defined in (LSR `ha_cluster` documentation)[https://github.com/linux-system-roles/ha_cluster/blob/main/README.md].

example:
sap_ha_pacemaker_cluster_corosync_transport:
type: knet
crypto:
- name: crypto_hash
value: sha256
- name: crypto_cipher
value: aes256


##########################################################################
# Parameters that are optionally imported from 'ha_cluster' LSR parameters
Expand Down Expand Up @@ -354,6 +385,11 @@ argument_specs:
- "`__sap_ha_pacemaker_cluster_fence_agent_packages_minimal`"
- "`__sap_ha_pacemaker_cluster_fence_agent_packages_platform`"

sap_ha_pacemaker_cluster_zypper_patterns:
type: list
description:
- (SUSE Specific) Additional zypper patterns to be installed.

sap_ha_pacemaker_cluster_hacluster_user_password:
description:
- The password of the `hacluster` user which is created during pacemaker installation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
else __sap_ha_pacemaker_cluster_hanacontroller_resource_name }}
changed_when: true

- name: "SAP HA Install Pacemaker - SAPHana clone crm resource refresh"
ansible.builtin.command:
cmd: crm resource refresh {{ __sap_ha_pacemaker_cluster_hana_resource_clone_name
if not __sap_ha_pacemaker_cluster_saphanasr_angi_available
else __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}
changed_when: true
# - name: "SAP HA Install Pacemaker - SAPHana clone crm resource refresh"
# ansible.builtin.command:
# cmd: crm resource refresh {{ __sap_ha_pacemaker_cluster_hana_resource_clone_name
# if not __sap_ha_pacemaker_cluster_saphanasr_angi_available
# else __sap_ha_pacemaker_cluster_hanacontroller_resource_clone_name }}
# changed_when: true

- name: "SAP HA Install Pacemaker - Wait for SAP HANA to become idle"
ansible.builtin.command:
Expand Down
9 changes: 5 additions & 4 deletions roles/sap_ha_pacemaker_cluster/tasks/Suse/pre_steps_hana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
# This is destructive step if executed on running cluster
# without proper migration from SAPHanaSR to SAPHanaSR-angi!

# SLES_SAP 16 includes only SAPHanaSR-angi and SAPHanaSR tasks are skipped.


- name: "SAP HA Prepare Pacemaker - Block for preparation of SAPHanaSR-angi HANA cluster"
when: (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool)
when:
- sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool
- ansible_distribution_major_version | int < 16
block:
- name: Query package SAPHanaSR # noqa command-instead-of-module
ansible.builtin.command:
Expand Down Expand Up @@ -38,8 +42,6 @@
- __sap_ha_pacemaker_cluster_zypper_angi_check is defined
- __sap_ha_pacemaker_cluster_zypper_angi_check.rc == 0
- __sap_ha_pacemaker_cluster_rpm_query_saphanasr.rc == 0
# SAPHanaSR (Classic) is not available on SLES 16
- ansible_distribution_major_version | int < 16

- name: "SAP HA Prepare Pacemaker - Set fact angi_available"
ansible.builtin.set_fact:
Expand All @@ -52,7 +54,6 @@
- name: "SAP HA Prepare Pacemaker - Block for preparation of Classic HANA cluster"
when:
- not (sap_ha_pacemaker_cluster_saphanasr_angi_detection | bool)
# SAPHanaSR (Classic) is not available on SLES 16
- ansible_distribution_major_version | int < 16
block:
- name: Query package SAPHanaSR-angi # noqa command-instead-of-module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
ansible.builtin.set_fact:
ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_zypper_patterns'"
when: __sap_ha_pacemaker_cluster_zypper_patterns is defined and ansible_os_family == 'Suse'
ansible.builtin.set_fact:
ha_cluster_zypper_patterns: "{{ __sap_ha_pacemaker_cluster_zypper_patterns }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_fence_agent_packages'"
when: __sap_ha_pacemaker_cluster_fence_agent_packages is defined
ansible.builtin.set_fact:
Expand Down Expand Up @@ -123,6 +128,11 @@
ansible.builtin.set_fact:
ha_cluster_totem: "{{ __sap_ha_pacemaker_cluster_corosync_totem }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_transport'"
when: __sap_ha_pacemaker_cluster_corosync_transport is defined
ansible.builtin.set_fact:
ha_cluster_transport: "{{ __sap_ha_pacemaker_cluster_corosync_transport }}"

- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_sbd_options'"
when: __sap_ha_pacemaker_cluster_sbd_options is defined
ansible.builtin.set_fact:
Expand Down
19 changes: 19 additions & 0 deletions roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
| unique | select() }}"
# remove duplicates and empty elements

- name: "SAP HA Prepare Pacemaker - Combine zypper patterns"
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_zypper_patterns: "{{
(sap_ha_pacemaker_cluster_zypper_patterns
+ __sap_ha_pacemaker_cluster_sap_zypper_patterns)
| unique | select() }}"
when: ansible_os_family == 'Suse'

# Combine following fence packages together:
# __sap_ha_pacemaker_cluster_fence_agent_packages_minimal -> os default
Expand Down Expand Up @@ -121,4 +128,16 @@
{%- endfor %}
{{ new_opts }}


# Prepare corosync transport variable with either:
# - User provided sap_ha_pacemaker_cluster_corosync_transport if present
# - Default __sap_ha_pacemaker_cluster_corosync_transport_default from OS variables
- name: "SAP HA Prepare Pacemaker - Prepare corosync transport settings"
ansible.builtin.set_fact:
__sap_ha_pacemaker_cluster_corosync_transport:
"{{ sap_ha_pacemaker_cluster_corosync_transport
if sap_ha_pacemaker_cluster_corosync_transport is defined and sap_ha_pacemaker_cluster_corosync_transport | length > 0
else __sap_ha_pacemaker_cluster_corosync_transport_default | d({}) }}"


# TODO: Add support for ha_cluster_quorum
10 changes: 8 additions & 2 deletions roles/sap_ha_pacemaker_cluster/vars/SLES_15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

__sap_ha_pacemaker_cluster_sap_extra_packages_dict:
minimal:
# Pattern contains all required cluster packages
- patterns-ha-ha_sles
- ClusterTools2
hana_scaleout:
- SAPHanaSR-ScaleOut
Expand All @@ -18,3 +16,11 @@ __sap_ha_pacemaker_cluster_sap_extra_packages_dict:
nwas:
- sap-suse-cluster-connector
- sapstartsrv-resource-agents

# Dictionary with zypper patterns for specific scenarios
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict:
minimal:
- ha_sles
hana_scaleout: []
hana_scaleup: []
nwas: []
28 changes: 23 additions & 5 deletions roles/sap_ha_pacemaker_cluster/vars/SLES_16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@
# - SUSE Linux Enterprise Server 16

# Dictionary with additional cluster packages for specific scenarios
# All packages are included in patterns
__sap_ha_pacemaker_cluster_sap_extra_packages_dict:
minimal: [] # All minimal packages are part of patterns
minimal: []
hana_scaleout: []
hana_scaleup: []
hana_angi: []
nwas: []

# Dictionary with zypper patterns for specific scenarios
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict:
minimal:
- ha_sles
hana_scaleout:
- patterns-sap-HADB
- sles_sap_HADB
hana_scaleup:
- patterns-sap-HADB
hana_angi: [] # SAPHanaSR-angi package is part of patterns-sap-HADB
- sles_sap_HADB
nwas:
- patterns-sap-HAAPP
- sles_sap_HAAPP

# Package list was simplified because of new patterns below:

Expand All @@ -33,3 +42,12 @@ __sap_ha_pacemaker_cluster_sap_extra_packages_dict:
# - ClusterTools2
# - supportutils-plugin-ha-sap
# - socat

# Default corosync transport options
__sap_ha_pacemaker_cluster_corosync_transport_default:
type: knet
crypto:
- name: crypto_hash
value: sha256
- name: crypto_cipher
value: aes256
11 changes: 9 additions & 2 deletions roles/sap_ha_pacemaker_cluster/vars/Suse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ __sap_ha_pacemaker_cluster_corosync_totem_default:
consensus: 6000
max_messages: 20

# Default corosync transport options
__sap_ha_pacemaker_cluster_corosync_transport_default:
type: udpu

# Make sure that there is always the minimal default fed into the included role.
# This is combined with the custom list 'sap_ha_pacemaker_cluster_fence_agent_packages'.
__sap_ha_pacemaker_cluster_fence_agent_packages_minimal:
Expand All @@ -51,8 +55,11 @@ __sap_ha_pacemaker_cluster_platform_extra_packages_dict:

# Dictionary with additional cluster packages for specific scenarios
# All packages are defined in SLES_15 and SLES_16 var files.
__sap_ha_pacemaker_cluster_sap_extra_packages_dict:
{}
__sap_ha_pacemaker_cluster_sap_extra_packages_dict: {}

# Dictionary with zypper patterns for specific scenarios
# All zypper patterns are defined in SLES_15 and SLES_16 var files.
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict: {}

# Dictionary with preferred platform specific VIP method that differs from default
__sap_ha_pacemaker_cluster_vip_method_dict:
Expand Down
5 changes: 5 additions & 0 deletions roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@ __sap_ha_pacemaker_cluster_sap_extra_packages: "{{
if __sap_ha_pacemaker_cluster_saphanasr_angi_available
else __sap_ha_pacemaker_cluster_sap_extra_packages_dict.hana_scaleout) }}"

# SUSE Specific: Combine list of zypper patterns
__sap_ha_pacemaker_cluster_sap_zypper_patterns: "{{
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.minimal | d([])
+ __sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.hana_scaleout | d([]) }}"

sap_ha_pacemaker_cluster_hadr_provider_name: SAPHanaSR
5 changes: 5 additions & 0 deletions roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ __sap_ha_pacemaker_cluster_sap_extra_packages: "{{
if __sap_ha_pacemaker_cluster_saphanasr_angi_available
else __sap_ha_pacemaker_cluster_sap_extra_packages_dict.hana_scaleup) }}"

# SUSE Specific: Combine list of zypper patterns
__sap_ha_pacemaker_cluster_sap_zypper_patterns: "{{
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.minimal | d([])
+ __sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.hana_scaleup | d([]) }}"

# Set variable with dictionary name based on angi availability
__sap_ha_pacemaker_cluster_hana_hook_dictionary:
"{{ '__sap_ha_pacemaker_cluster_hook_'
Expand Down
1 change: 1 addition & 0 deletions roles/sap_ha_pacemaker_cluster/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ __sap_ha_pacemaker_cluster_pcmk_host_map: ''
__sap_ha_pacemaker_cluster_sap_extra_packages: []
__sap_ha_pacemaker_cluster_platform_extra_packages: []
__sap_ha_pacemaker_cluster_fence_agent_packages_platform: []
__sap_ha_pacemaker_cluster_sap_zypper_patterns: []

__sap_ha_pacemaker_cluster_cluster_properties: []
__sap_ha_pacemaker_cluster_resource_defaults:
Expand Down
5 changes: 5 additions & 0 deletions roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@
__sap_ha_pacemaker_cluster_sap_extra_packages: "{{
__sap_ha_pacemaker_cluster_sap_extra_packages_dict.minimal | d([])
+ __sap_ha_pacemaker_cluster_sap_extra_packages_dict.nwas | unique }}"

# SUSE Specific: Combine list of zypper patterns
__sap_ha_pacemaker_cluster_sap_zypper_patterns: "{{
__sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.minimal | d([])
+ __sap_ha_pacemaker_cluster_sap_zypper_patterns_dict.nwas | d([]) }}"