Skip to content

Commit

Permalink
Merge pull request #473 from ja9fuchs/ha_for_nw
Browse files Browse the repository at this point in the history
sap_ha_pacemaker_cluster: enh: SAP HA Interface configuration
  • Loading branch information
ja9fuchs authored Sep 27, 2023
2 parents c5fee3d + 000f7e3 commit ec169e1
Show file tree
Hide file tree
Showing 14 changed files with 366 additions and 164 deletions.
5 changes: 2 additions & 3 deletions playbooks/sample-sap-ha-deployment-hana-2-node-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@
node_role: secondary
hana_site: DC02

sap_hana_vip:
primary: 192.168.1.100
sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: 192.168.1.100

ha_cluster_fence_agent_packages:
sap_ha_pacemaker_cluster_fence_agent_packages:
- fence-agents-rhevm

sap_ha_pacemaker_cluster_stonith_custom:
Expand Down
82 changes: 82 additions & 0 deletions playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# This playbook will
# - install and configure a basic pacemaker cluster
# - configure the SAP NetWeaver ASCS/ERS resource groups with each
# - an instance filesystem
# - the instance resource
# - an instance service VIP

# To use this playbook in your test environment
# please update the "vars" parameters with values
# corresponding to your individual naming standards
# and infrastructure (e.g. IP definitions matching your network).
#
# NOTE:
# For simplicity the sample password values are plain text. Please make sure to
# apply security measures to any credentials, for instance using ansible-vault
# encryption.

- name: "Install and Configure a Pacemaker Cluster on 2 NetWeaver ASCS/ERS nodes"
hosts: ascs-node, ers-node
become: true
# any_error_fatal: true

vars:
############################################################################
### MANDATORY parameter definitions for a NetWeaver ASCS/ERS cluster setup.
############################################################################

### General minimum pacemaker cluster definitions.

# Cluster name is optional, the default of the 'ha_cluster' Linux System Role
# would be applied when missing.
# However, for convenience it is defined along with the rest of the mandatory
# parameters in this example.
sap_ha_pacemaker_cluster_cluster_name: ascs-ers-cluster
sap_ha_pacemaker_cluster_hacluster_password: my-hacluster-vault-password

### NetWeaver specific definitions
sap_ha_pacemaker_cluster_storage_nfs_server: "nfs-server1.example.com:/"

# Underlying filesystems are derived from the parent "/usr/sap" definition.
sap_ha_pacemaker_cluster_storage_definition:
- name: usr_sap
mountpoint: /usr/sap
nfs_path: /usr/sap
nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}"

- name: usr_sap_trans
mountpoint: /usr/sap/trans
nfs_path: /usr/sap/trans
nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}"

- name: sapmnt
mountpoint: /sapmnt
nfs_path: /sapmnt
nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}"

# SID and Instance Numbers for ASCS and ERS.
sap_ha_pacemaker_cluster_netweaver_sid: ABC
sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "02"
sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "12"

# Profile name created by the installer, for example: <SID>_ASCS<Instance-Number>_<ASCS-virtual-node-name>
sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: ABC_ASCS02_ascs-node-ha
sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ASCS02_ascs-node-ha

sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: ABC_ERS12_ers-node-ha
sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ERS12_ers-node-ha

# Required to go through the configuration flow for a NetWeaver ASCS/ERS cluster.
sap_ha_pacemaker_cluster_host_type:
- nwas_abap_ascs_ers

# Virtual IP addresses, one per instance.
# These IPs will switch between the nodes together with the instance.
sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: 192.168.10.102
sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: 192.168.10.112


roles:

- name: sap_ha_pacemaker_cluster
31 changes: 14 additions & 17 deletions roles/sap_ha_pacemaker_cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ This allows using the output file later as input file for additional custom step
When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes.<br>
WARNING! This report may include sensitive details like secrets required for certain cluster resources!<br>

### sap_ha_pacemaker_cluster_enable_cluster_connector

- _Type:_ `bool`
- _Default:_ `True`

Enables/Disables the SAP HA Interface for SAP ABAP application server instances, also known as `sap_cluster_connector`.<br>
Set this parameter to 'false' if the SAP HA interface should not be installed and configured.<br>

### sap_ha_pacemaker_cluster_extra_packages

- _Type:_ `list`
Expand Down Expand Up @@ -684,23 +692,12 @@ sap_ha_pacemaker_cluster_stonith_custom:
- _Type:_ `list`

List of filesystem definitions used for filesystem cluster resources.<br>
Uses `sap_storage_setup_definition` when defined.<br>

- **mountpoint**<br>
Path under which the filesystem will be mounted.<br>Mandatory for all filesystems that have a mountpoint.<br>Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap/<SID>/<instance_type><instance_number>" and "/usr/sap/<SID>/SYS".
- **name**<br>
Unique name of the filesystem definition entry.
- **nfs_filesystem_type**<br>
_Default:_ `<sap_ha_pacemaker_cluster_storage_nfs_filesytem_type>`<br>
NFS filesystem type used to mount this filesystem.
- **nfs_mount_options**<br>
_Default:_ `<sap_ha_pacemaker_cluster_storage_nfs_mount_options>`<br>
Mount options to be used for this specific filesystem.
- **nfs_path**<br>
Path to the filesystem source directory on the NFS server.
- **nfs_server**<br>
_Default:_ `<sap_ha_pacemaker_cluster_storage_nfs_server>`<br>
Name of the NFS server for this particular filesystem.
Options relevant, see example.<br>
Mandatory for SAP NetWeaver HA cluster configurations.<br>
Reuse `sap_storage_setup_definition` if defined.<br>
Reuse `sap_storage_setup_definition` will extract values 'mountpoint', 'nfs_filesystem_type', 'nfs_mount_options', 'nfs_path', 'nfs_server'.<br>
Reuse `sap_storage_setup_definition` all options are documented under Ansible Role `sap_storage_setup`.<br>
Note! For this variable, the argument specification does not list options, to avoid errors during reuse of `sap_storage_setup_definition` if defined.<br>

Example:

Expand Down
6 changes: 5 additions & 1 deletion roles/sap_ha_pacemaker_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sap_ha_pacemaker_cluster_system_roles_collection: 'fedora.linux_system_roles'
# config file.
# Useful for parameter review or re-use with the 'ha_cluster' LSR.
sap_ha_pacemaker_cluster_create_config_varfile: false
sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml"
sap_ha_pacemaker_cluster_create_config_dest: "review_resource_config.yml"

# Inherit SAP common (global synonyms) parameters when defined.

Expand Down Expand Up @@ -149,6 +149,10 @@ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacema
# set this parameter to 'true'.
sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false

# Enable/Disable sap_cluster_connector.
# Ref.: https://access.redhat.com/solutions/3606101
sap_ha_pacemaker_cluster_enable_cluster_connector: true

# Inherit common synonym NetWeaver parameters when defined.
sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}"
sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}"
Expand Down
45 changes: 13 additions & 32 deletions roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,13 @@ argument_specs:
- The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2.
- Set this parameter to 'true' to configure it as ENSA1.

sap_ha_pacemaker_cluster_enable_cluster_connector:
type: bool
default: true
description:
- Enables/Disables the SAP HA Interface for SAP ABAP application server instances, also known as `sap_cluster_connector`.
- Set this parameter to 'false' if the SAP HA interface should not be installed and configured.

sap_ha_pacemaker_cluster_netweaver_sid:
description:
- SID of the NetWeaver instances.
Expand Down Expand Up @@ -381,39 +388,13 @@ argument_specs:
type: list
description:
- List of filesystem definitions used for filesystem cluster resources.
- Uses `sap_storage_setup_definition` when defined.
- Options relevant, see example.
- Mandatory for SAP NetWeaver HA cluster configurations.
- Reuse `sap_storage_setup_definition` if defined.
- Reuse `sap_storage_setup_definition` will extract values 'mountpoint', 'nfs_filesystem_type', 'nfs_mount_options', 'nfs_path', 'nfs_server'.
- Reuse `sap_storage_setup_definition` all options are documented under Ansible Role `sap_storage_setup`.
- Note! For this variable, the argument specification does not list options, to avoid errors during reuse of `sap_storage_setup_definition` if defined.
elements: dict
options:
name:
description:
- Unique name of the filesystem definition entry.
required: true

mountpoint:
description:
- Path under which the filesystem will be mounted.
- Mandatory for all filesystems that have a mountpoint.
- Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap/<SID>/<instance_type><instance_number>" and "/usr/sap/<SID>/SYS".
required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input)

nfs_filesystem_type:
default: <sap_ha_pacemaker_cluster_storage_nfs_filesytem_type>
description:
- NFS filesystem type used to mount this filesystem.

nfs_mount_options:
default: <sap_ha_pacemaker_cluster_storage_nfs_mount_options>
description:
- Mount options to be used for this specific filesystem.

nfs_path:
description:
- Path to the filesystem source directory on the NFS server.

nfs_server:
default: <sap_ha_pacemaker_cluster_storage_nfs_server>
description:
- Name of the NFS server for this particular filesystem.

example:
sap_ha_pacemaker_cluster_storage_definition:
Expand Down
16 changes: 8 additions & 8 deletions roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# 2 nodes are also valid for other scenarios.
# TODO: collect possible rules for target landscapes

- name: SAP HA Prepare Pacemaker - Fail if there is only 1 target host
- name: "SAP HA Prepare Pacemaker - Fail if there is only 1 target host"
ansible.builtin.assert:
that:
- ansible_play_hosts | length > 1

- name: SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list
- name: "SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list"
ansible.builtin.set_fact:
sap_ha_pacemaker_cluster_host_type: |
{% if sap_ha_pacemaker_cluster_host_type | type_debug != 'list' -%}
Expand All @@ -24,21 +24,21 @@
{{ sap_ha_pacemaker_cluster_host_type }}
{%- endif %}
- name: SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used
- name: "SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used"
ansible.builtin.assert:
that:
- ansible_play_hosts | length == 2
when:
- "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]"
- sap_ha_pacemaker_cluster_host_type | select('search', 'hana_scaleup') | length > 0

- name: SAP HA Prepare Pacemaker - Include HANA specific variables
- name: "SAP HA Prepare Pacemaker - Include HANA specific variables"
ansible.builtin.include_tasks:
file: include_vars_hana.yml
when:
- "'hana' in sap_ha_pacemaker_cluster_host_type[0]"
- sap_ha_pacemaker_cluster_host_type | select('search', 'hana_scaleup') | length > 0

- name: SAP HA Prepare Pacemaker - Include NETWEAVER specific variables
- name: "SAP HA Prepare Pacemaker - Include NETWEAVER specific variables"
ansible.builtin.include_tasks:
file: include_vars_netweaver.yml
when:
- "'nwas' in sap_ha_pacemaker_cluster_host_type[0]"
- sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0
Loading

0 comments on commit ec169e1

Please sign in to comment.