From 8834b612e216685959e9ae13293685af5d8102ff Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 20 Sep 2023 16:33:52 +0200 Subject: [PATCH 1/8] sap_ha_pacemaker_cluster: fix: typo in README --- roles/sap_ha_pacemaker_cluster/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index eb5a60660..a844702f0 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -73,7 +73,7 @@ The Ansible Control System (where Ansible is executed from) must have: - Ansible Collection [`redhat.sap_install` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/sap_install) version `1.3.0` or later - Ansible Collection [`redhat.rhel_system_roles` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles) version `1.20.0` or later - **Supported (Downstream)** via RHEL4SAP license: - - RHEL System Roles for SAP RPM Package `rhel-system-roles-3.6.0` or later + - RHEL System Roles for SAP RPM Package `rhel-system-roles-sap-3.6.0` or later - RHEL System Roles RPM Package `rhel-system-roles-1.20.0` or later ## Prerequisites From 8e69838663dad852d3132baac6c8cd35e0987aa2 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 21 Sep 2023 20:15:49 +0200 Subject: [PATCH 2/8] sap_ha_pacemaker_cluster: parameter re-organization - sorted and updated defaults - sorted and updated argument specifications in sync with the defaults - adjusted 'ha_cluster' LSR parameter import and construction flow - new: all parameters are transformed into 'ha_cluster' native variables at play level - new: the 'ha_cluster' role include now relies on the new native variables, no more static list of vars --- roles/sap_ha_pacemaker_cluster/README.md | 470 +++++++--- .../defaults/main.yml | 238 ++--- .../meta/argument_specs.yml | 818 +++++++++++++----- .../ascertain_ha_cluster_in_inventory.yml | 54 -- .../tasks/construct_final_hacluster_vars.yml | 95 ++ .../tasks/construct_vars_common.yml | 42 +- .../tasks/construct_vars_stonith.yml | 16 +- .../construct_vars_vip_resources_default.yml | 3 +- .../import_hacluster_vars_from_inventory.yml | 94 ++ roles/sap_ha_pacemaker_cluster/tasks/main.yml | 71 +- roles/sap_ha_pacemaker_cluster/vars/main.yml | 31 +- 11 files changed, 1389 insertions(+), 543 deletions(-) delete mode 100644 roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index a844702f0..7caef631d 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -134,68 +134,84 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions Minimum required parameters: - [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) +- [sap_ha_pacemaker_cluster_hana_instance_number](#sap_ha_pacemaker_cluster_hana_instance_number) +- [sap_ha_pacemaker_cluster_hana_sid](#sap_ha_pacemaker_cluster_hana_sid) -### ha_cluster - -- _Type:_ `dict` - -Optional _**host_vars**_ parameter - if defined it must be set for each node.
-Dictionary that can contain various node options for the pacemaker cluster configuration.
-Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].
- -Example: - -```yaml -ha_cluster: - corosync_addresses: - - 192.168.1.10 - - 192.168.2.10 - node_name: nodeA -``` - ### sap_ha_pacemaker_cluster_aws_access_key_id - _Type:_ `str` AWS access key to allow control of instances (for example for fencing operations).
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for the cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_region - _Type:_ `str` The AWS region in which the instances to be used for the cluster setup are located.
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_secret_access_key - _Type:_ `str` AWS secret key, paired with the access key for instance control.
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for the cluster setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_vip_update_rt - _Type:_ `list` List one more routing table IDs for managing Virtual IP failover through routing table changes.
-Required for VIP configuration in AWS EC2 environments.
+Mandatory for the VIP resource configuration in AWS EC2 environments.
### sap_ha_pacemaker_cluster_cluster_name - _Type:_ `str` -- _Default:_ `my-cluster` The name of the pacemaker cluster.
Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined.
+If not defined, the `ha_cluster` Linux System Role default will be used.
+ +### sap_ha_pacemaker_cluster_cluster_nodes + +- _Type:_ `list` + +List of cluster nodes and associated attributes to describe the target SAP HA environment.
+This is required for the HANA System Replication configuration.
+Synonym for this parameter is `sap_hana_cluster_nodes`.
+ +- **hana_site**
+ Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. +- **node_ip**
+ IP address of the node used for HANA System Replication. +- **node_name**
+ Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. +- **node_role**
+ Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. + +Example: + +```yaml +sap_ha_pacemaker_cluster_cluster_nodes: +- hana_site: DC01 + node_ip: 192.168.5.1 + node_name: nodeA + node_role: primary +- hana_site: DC02 + node_ip: 192.168.5.2 + node_name: nodeB + node_role: secondary +``` ### sap_ha_pacemaker_cluster_cluster_properties - _Type:_ `dict` -- _Default:_ `See example` +- _Default:_ `{'concurrent-fencing': True, 'stonith-enabled': True, 'stonith-timeout': 900}` Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing.
+When no STONITH resource is defined, STONITH will be disabled and a warning displayed.
Example: @@ -226,9 +242,31 @@ 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.
WARNING! This report may include sensitive details like secrets required for certain cluster resources!
+### sap_ha_pacemaker_cluster_extra_packages + +- _Type:_ `list` + +Additional extra packages to be installed, for instance specific resource packages.
+For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included.
+ +### sap_ha_pacemaker_cluster_fence_agent_minimal_packages + +- _Type:_ `list` +- _Default:_ `['fence-agents-all']` + +The minimal set of fence agent packages that will be installed.
+ +### sap_ha_pacemaker_cluster_fence_agent_packages + +- _Type:_ `list` + +Additional fence agent packages to be installed.
+This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`.
+ ### sap_ha_pacemaker_cluster_fence_options - _Type:_ `dict` +- _Default:_ `{'pcmk_reboot_retries': 4, 'pcmk_reboot_timeout': 400, 'power_timeout': 240}` STONITH resource common parameters that apply to most fencing agents.
These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS).
@@ -244,11 +282,46 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ``` +### sap_ha_pacemaker_cluster_gcp_project + +- _Type:_ `str` + +Google Cloud project name in which the target instances are installed.
+Mandatory for the cluster setup on GCP instances.
+ +### sap_ha_pacemaker_cluster_gcp_region_zone + +- _Type:_ `str` + +Goocle Cloud Platform region zone ID.
+Mandatory for the cluster setup on GCP instances.
+ +### sap_ha_pacemaker_cluster_ha_cluster + +- _Type:_ `dict` + +The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym.
+Optional _**host_vars**_ parameter - if defined it must be set for each node.
+Dictionary that can contain various node options for the pacemaker cluster configuration.
+Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].
+If not defined, the `ha_cluster` Linux System Role default will be used.
+ +Example: + +```yaml +sap_ha_pacemaker_cluster_ha_cluster: + corosync_addresses: + - 192.168.1.10 + - 192.168.2.10 + node_name: nodeA +``` + ### sap_ha_pacemaker_cluster_hacluster_password required - _Type:_ `str` The password of the `hacluster` user which is created during pacemaker installation.
+Inherits the value of `ha_cluster_hacluster_password`, when defined.
### sap_ha_pacemaker_cluster_hana_automated_register @@ -268,6 +341,13 @@ Time difference needed between to primary time stamps, if a dual-primary situati If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status.
This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed.
+### sap_ha_pacemaker_cluster_hana_instance_number required + +- _Type:_ `str` + +The instance number of the SAP HANA database which this role will configure in the cluster.
+Inherits the value of `sap_hana_instance_number`, when defined.
+ ### sap_ha_pacemaker_cluster_hana_prefer_site_takeover - _Type:_ `bool` @@ -277,6 +357,13 @@ Parameter for the 'SAPHana' cluster resource.
Set to "false" if the cluster should first attempt to restart the instance on the same node.
When set to "true" (default) a failover to secondary will be initiated on resource failure.
+### sap_ha_pacemaker_cluster_hana_resource_clone_name + +- _Type:_ `str` +- _Default:_ `SAPHana__-clone` + +Customize the cluster resource name of the SAP HANA DB resource clone.
+ ### sap_ha_pacemaker_cluster_hana_resource_name - _Type:_ `str` @@ -284,6 +371,21 @@ When set to "true" (default) a failover to secondary will be initiated on resour Customize the cluster resource name of the SAP HANA DB resource.
+### sap_ha_pacemaker_cluster_hana_sid required + +- _Type:_ `str` + +The SAP HANA SID of the instance that will be configured in the cluster.
+The SID must follow SAP specifications - see SAP Note 1979280.
+Inherits the value of `sap_hana_sid`, when defined.
+ +### sap_ha_pacemaker_cluster_hana_topology_resource_clone_name + +- _Type:_ `str` +- _Default:_ `SAPHanaTopology__-clone` + +Customize the cluster resource name of the SAP HANA Topology resource clone.
+ ### sap_ha_pacemaker_cluster_hana_topology_resource_name - _Type:_ `str` @@ -291,23 +393,60 @@ Customize the cluster resource name of the SAP HANA DB resource.
Customize the cluster resource name of the SAP HANA Topology resource.
+### sap_ha_pacemaker_cluster_host_type + +- _Type:_ `str` +- _Default:_ `hana_scaleup_perf` + +The SAP landscape to for which the cluster is to be configured.
+The default is a 2-node SAP HANA scale-up cluster.
+ ### sap_ha_pacemaker_cluster_ibmcloud_api_key - _Type:_ `str` -The API key is required to allow control of instances (for example for fencing operations).
-Required for cluster nodes setup in IBM Cloud.
+The API key which is required to allow the control of instances (for example for fencing operations).
+Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances.
### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `str` -The cloud region key in which the instances are running.
-Required for cluster nodes setup in IBM Cloud.
+The IBM Cloud VS region name in which the instances are running.
+Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances.
+ +### sap_ha_pacemaker_cluster_msazure_resource_group + +- _Type:_ `str` + +Resource group name/ID in which the target instances are defined.
+Mandatory for the cluster setup on MS Azure instances.
+ +### sap_ha_pacemaker_cluster_msazure_subscription_id + +- _Type:_ `str` + +Subscription ID of the MS Azure environment containing the target instances.
+Mandatory for the cluster setup on MS Azure instances.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP AAS instance.
+Mandatory for NetWeaver AAS cluster configuration.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems + +- _Type:_ `list` +- _Default:_ `['/ASCS', '/ERS']` + +Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name - _Type:_ `str` +- _Default:_ `Filesystem_NWAS_ABAP_ASCS__` Name of the filesystem resource for the ASCS instance.
@@ -318,6 +457,13 @@ Name of the filesystem resource for the ASCS instance.
NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
+### sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP ASCS instance.
+Mandatory for NetWeaver ASCS/ERS cluster configuration.
+ ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool - _Type:_ `bool` @@ -331,7 +477,7 @@ NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
- _Default:_ `60` NetWeaver ASCS instance failure-timeout attribute.
-Only used for ENSA1 setups. Default is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold @@ -339,18 +485,19 @@ Only used for ENSA1 setups. Default is ENSA2.
- _Default:_ `1` NetWeaver ASCS instance migration-threshold setting attribute.
-Only used for ENSA1 setups. Default is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name - _Type:_ `str` The name of the ASCS instance, typically the profile name.
-Required for the NetWeaver ASCS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name - _Type:_ `str` +- _Default:_ `SAPInstance_NWAS_ABAP_ASCS__` Name of the ASCS instance resource.
@@ -366,14 +513,22 @@ NetWeaver ASCS instance resource stickiness attribute.
- _Type:_ `str` The full path and name of the ASCS instance profile.
-Required for the NetWeaver ASCS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name - _Type:_ `str` +- _Default:_ `Filesystem_NWAS_ABAP_ERS__` Name of the filesystem resource for the ERS instance.
+### sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP ERS instance.
+Mandatory for NetWeaver ASCS/ERS cluster configuration.
+ ### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool - _Type:_ `bool` @@ -386,11 +541,12 @@ NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
- _Type:_ `str` The name of the ERS instance, typically the profile name.
-Required for the NetWeaver ERS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name - _Type:_ `str` +- _Default:_ `SAPInstance_NWAS_ABAP_ERS__` Name of the ERS instance resource.
@@ -399,7 +555,64 @@ Name of the ERS instance resource.
- _Type:_ `str` The full path and name of the ERS instance profile.
-Required for the NetWeaver ERS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP PAS instance.
+Mandatory for NetWeaver PAS cluster configuration.
+ +### sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + +- _Type:_ `bool` +- _Default:_ `False` + +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_netweaver_sapmnt_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_SAPMNT_` + +Filesystem resource name for the shared filesystem /sapmnt.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+ +### sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + +- _Type:_ `bool` +- _Default:_ `False` + +Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources.
+ +### sap_ha_pacemaker_cluster_netweaver_sid + +- _Type:_ `str` + +SID of the NetWeaver instances.
+Mandatory for NetWeaver cluster configuration.
+Uses `sap_swpm_sid` if defined.
+ +### sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_SYS_` + +Filesystem resource name for the transports filesystem /usr/sap//SYS.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+ +### sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_TRANS_` + +Filesystem resource name for the transports filesystem /usr/sap/trans.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
### sap_ha_pacemaker_cluster_replication_type @@ -412,7 +625,7 @@ _Not yet supported_
### sap_ha_pacemaker_cluster_resource_defaults - _Type:_ `dict` -- _Default:_ `See example` +- _Default:_ `{'migration-threshold': 5000, 'resource-stickiness': 3000}` Set default parameters that will be valid for all pacemaker resources.
@@ -424,6 +637,106 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` +### sap_ha_pacemaker_cluster_stonith_custom + +- _Type:_ `list` + +Custom list of STONITH resource(s) to be configured in the cluster.
+This definition override any defaults the role would apply otherwise.
+ +- **agent**
+ Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. +- **name**
+ Name that will be used as the resource ID (name). +- **options**
+ The resource options listed in dictionary format, one option per line.
Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. + +Example: + +```yaml +sap_ha_pacemaker_cluster_stonith_custom: +- agent: stonith:fence_rhevm + name: my-fence-resource + options: + ip: rhevm-server + password: login-user-password + pcmk_host_list: node1,node2 + power_wait: 3 + username: login-user +``` + +### sap_ha_pacemaker_cluster_storage_definition + +- _Type:_ `list` + +List of filesystem definitions used for filesystem cluster resources.
+Uses `sap_storage_setup_definition` when defined.
+ +- **mountpoint**
+ 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//" and "/usr/sap//SYS". +- **name**
+ Unique name of the filesystem definition entry. +- **nfs_filesystem_type**
+ _Default:_ ``
+ NFS filesystem type used to mount this filesystem. +- **nfs_mount_options**
+ _Default:_ ``
+ Mount options to be used for this specific filesystem. +- **nfs_path**
+ Path to the filesystem source directory on the NFS server. +- **nfs_server**
+ _Default:_ ``
+ Name of the NFS server for this particular filesystem. + +Example: + +```yaml +sap_ha_pacemaker_cluster_storage_definition: +- mountpoint: /usr/sap + name: usr_sap + nfs_path: /usr/sap + nfs_server: nfs-server.example.com:/ +- mountpoint: /usr/sap/trans + name: usr_sap_trans + nfs_path: /usr/sap/trans + nfs_server: nfs-server.example.com:/ +- mountpoint: /sapmnt + name: sapmnt + nfs_filesystem_type: nfs + nfs_mount_options: defaults + nfs_path: /sapmnt + nfs_server: nfs-server.example.com:/ +``` + +### sap_ha_pacemaker_cluster_storage_nfs_filesytem_type + +- _Type:_ `str` +- _Default:_ `nfs` + +Filesystem type of the NFS filesystems that are part of the cluster configuration.
+ +### sap_ha_pacemaker_cluster_storage_nfs_mount_options + +- _Type:_ `str` +- _Default:_ `defaults` + +Mount options of the NFS filesystems that are part of the cluster configuration.
+ +### sap_ha_pacemaker_cluster_storage_nfs_server + +- _Type:_ `str` + +Default address of the NFS server, if not defined individually by filesystem.
+ +### sap_ha_pacemaker_cluster_system_roles_collection + +- _Type:_ `str` +- _Default:_ `fedora.linux_system_roles` + +Reference to the Ansible Collection used for the Linux System Roles.
+For community/upstream, use 'fedora.linux_system_roles'.
+For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'.
+ ### sap_ha_pacemaker_cluster_vip_client_interface - _Type:_ `str` @@ -436,6 +749,7 @@ When there is only one interface on the system, its name will be used by default - _Type:_ `str` The virtual IP of the primary HANA instance.
+Mandatory parameter for HANA clusters.
### sap_ha_pacemaker_cluster_vip_hana_primary_resource_name @@ -449,58 +763,63 @@ Customize the name of the resource managing the Virtual IP of the primary HANA i - _Type:_ `str` The virtual IP for read-only access to the secondary HANA instance.
+Optional parameter in HANA clusters.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver AAS instance.
+Virtual IP of the NetWeaver AAS instance.
+Mandatory for NetWeaver AAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___aas` -Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance.
+Name of the SAPInstance resource for NetWeaver AAS.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver ASCS instance.
+Virtual IP of the NetWeaver ASCS instance.
+Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___ascs` -Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance.
+Name of the SAPInstance resource for NetWeaver ASCS.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver ERS instance.
+Virtual IP of the NetWeaver ERS instance.
+Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___ers` -Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance.
+Name of the SAPInstance resource for NetWeaver ERS.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver PAS instance.
+Virtual IP of the NetWeaver PAS instance.
+Mandatory for NetWeaver PAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___pas` -Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance.
+Name of the SAPInstance resource for NetWeaver PAS.
### sap_ha_pacemaker_cluster_vip_secondary_resource_name @@ -509,61 +828,4 @@ Customize the name of the resource managing the Virtual IP of the NetWeaver PAS Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance.
-### sap_hana_cluster_nodes - -- _Type:_ `list` - -List of cluster nodes and associated attributes to describe the target SAP HA environment.
-This is required for the HANA System Replication configuration.
- -- **hana_site**
- Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. -- **node_ip**
- IP address of the node used for HANA System Replication. -- **node_name**
- Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. -- **node_role**
- Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. - -Example: - -```yaml -sap_hana_cluster_nodes: -- hana_site: DC01 - node_ip: 192.168.5.1 - node_name: nodeA - node_role: primary -- hana_site: DC02 - node_ip: 192.168.5.2 - node_name: nodeB - node_role: secondary -``` - -### sap_hana_instance_number - -- _Type:_ `str` - -The instance number of the SAP HANA database which this role will configure in the cluster.
- -### sap_hana_sid - -- _Type:_ `str` - -The SAP HANA SID of the instance that will be configured in the cluster.
-The SID must follow SAP specifications - see SAP Note 1979280.
- -### sap_hana_vip - -- _Type:_ `dict` - -One floating IP is required for SAP HANA DB connection by clients.
-This main VIP will always run on the promoted HANA node and be moved with it during a failover.
- -Example: - -```yaml -sap_hana_vip: - primary: 192.168.10.100 -``` - diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 7726ec60c..d2d8b1752 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -1,4 +1,11 @@ --- +################################################################################ +# Role generic parameters +################################################################################ + +# Do NOT USE ANSIBLE FACTS for defaults to be compatible with +# playbooks that disable generic fact gathering! + # Set which Ansible Collection to use for the Linux System Roles. # For community/upstream, use 'fedora.linux_system_roles' # For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' @@ -6,92 +13,46 @@ sap_ha_pacemaker_cluster_system_roles_collection: 'fedora.linux_system_roles' # Variables for the cluster setup must be constructed by dedicated tasks! # The included 'ha_cluster' role will not work with the role variables set -# in this role. +# in this role. This SAP HA role takes care of the parameter construction +# based on the target cluster to be configured, before feeding it into 'ha_cluster'. -# Do NOT USE ANSIBLE FACTS for defaults to be compatible with -# playbooks that disable generic fact gathering! - -# Inherit from ha_cluster Linux System Role -sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" -sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" -# Optional: write all cluster configuration (including credentials!) into a yaml -# config file for review or re-use. +# Optional: write all cluster configuration (including unencrypted credentials!) into a yaml +# 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" -# Inherit SAP common (global synonyms) parameters -sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_ha_cluster_nodes | default(sap_hana_cluster_nodes) }}" -sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" -sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" - -# TODO: document filesystem definitions -sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" -sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs -sap_ha_pacemaker_cluster_storage_nfs_mount_options: 'defaults' -sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" +# Inherit SAP common (global synonyms) parameters when defined. +sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes | default([]) }}" -################################################################################ -# NetWeaver generic definitions -################################################################################ - -# TODO: document the nw parameters - -# Default will be ENSA2. To configure HA resources for ENSA1, enable this parameter: -sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false - -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('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" - -#sap_ha_pacemaker_cluster_netweaver_common_filesystems: -# - /sapmnt -# - /usr/sap/trans -# - "/usr/sap/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS" - -# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage -# definition. -# Therefore, the /usr/sap prefix must be left out of the listed path items. -sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" - -# Make sure that there is always the default fed into the included role -sap_ha_pacemaker_cluster_fence_agent_packages: +# 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_minimal_packages: - fence-agents-all -sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" - -## Resource defaults are defined differently by cluster type, if not custom defined. +# Resource defaults are defined differently by cluster type in different tasks, if not custom defined. +# TODO: migrate to 'ha_cluster' native parameter combination when moving the function to be included in the role +# (newer feature in the LSR) sap_ha_pacemaker_cluster_resource_defaults: {} # The type of SAP landscape and multi-node replication # TODO: Type definitions and feature support # TODO: Implement all types # hana_scaleup_costopt (not yet) -# hana_scaleup_perf (default) +# hana_scaleup_perf (available, default) # hana_scaleup_per_dr (not yet) # hana_scaleout (not yet) -# nwas_abap_ascs_ers -# nwas_abap_pas_aas +# nwas_abap_ascs_ers (available) +# nwas_abap_pas_aas (not yet) # nwas_java_scs_ers (maybe) -# + # 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in # 'tasks/ascertain_sap_landscape.yml'. sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" -sap_ha_pacemaker_cluster_replication_type: none -# Optional parameters to customize HANA resources -# AUTOMATED_REGISTER -sap_ha_pacemaker_cluster_hana_automated_register: true -# DUPLICATE_PRIMARY_TIMEOUT -sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: 900 -# PREFER_SITE_TAKEOVER -sap_ha_pacemaker_cluster_hana_prefer_site_takeover: true +# Currently unused parameter. Keeping for future functionality. +#sap_ha_pacemaker_cluster_replication_type: none ### stonith resource parameter defaults sap_ha_pacemaker_cluster_fence_options: @@ -100,15 +61,116 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ### VIP resource default patterns +# Currently there is no task for a different default VIP resource agent. +# Leaving out of meta/argument_specs.yml. +# Platform specific defaults are defined separately. sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' +## A custom stonith definition that takes precedence over platform defaults. +# sap_ha_pacemaker_cluster_stonith_custom: +# - name: "" +# agent: "stonith:" +# options: +# pcmk_host_list: "" + +#sap_ha_pacemaker_cluster_stonith_custom: [] + + +################################################################################ +# Inherit from 'ha_cluster' Linux System Role parameters when defined +################################################################################ + +sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" +sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" + +sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" + +# Optional: additional fence agent packages. This is combined with the above "minimal" list. +sap_ha_pacemaker_cluster_fence_agent_packages: [] + +# Mandatory. Inherit 'ha_cluster' LSR variable when defined, but do not set a default otherwise. +sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" + +# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native +# 'ha_cluster_cluster_properties' parameter. +sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + +################################################################################ +# HANA +################################################################################ + +sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" +sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" + +# Optional parameters to customize SAPHana resources +# AUTOMATED_REGISTER +sap_ha_pacemaker_cluster_hana_automated_register: true +# DUPLICATE_PRIMARY_TIMEOUT +sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: 900 +# PREFER_SITE_TAKEOVER +sap_ha_pacemaker_cluster_hana_prefer_site_takeover: true + + +# SAP HANA - Resource IDs (names) as convenience parameters. +sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" +sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" + + # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml +# +# Mandatory: primary VIP address definition in HANA scale-up clusters sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" + + +################################################################################ +# NetWeaver generic definitions +################################################################################ + +# Default will be ENSA2. To configure HA resources for ENSA1, +# set this parameter to 'true'. +sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false + +# 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('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" +# Prepare in case JAVA SCS/ERS will be included later. +#sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" + +# Definitions for filesystems resources. Currently limited to NFS filesystems. +sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_setup_definition | default([]) }}" +sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs +sap_ha_pacemaker_cluster_storage_nfs_mount_options: 'defaults' +sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" + +# NFS filesystem resource requirement +# Not adding to argument_specs because this should not be changed anyway. +# TODO: review later and move to internal vars in vars/main.yml? +sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe + +# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage +# definition. +# Therefore, the /usr/sap prefix must be left out of the listed path items. +sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + + +# Multiple VIP parameters can be defined and will be combined. +# See tasks/include_construct_vip_resources.yml sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: '' @@ -118,17 +180,9 @@ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemak sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" -# SAP HANA - Resource IDs (names) as convenience parameters. -sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" -sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" -sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" -sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" - -# NFS filesystem resource requirement -sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe - -# SAP NetWeaver common - Resource IDs (names) as convenience parameters. +# SAP NetWeaver common - Resource IDs (names) as convenience parameters +# for the following filesystems: # - /sapmnt # - /usr/sap/trans # - /usr/sap/<>/SYS @@ -136,10 +190,11 @@ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" -# Enable to manage the SYS, transport and sapmnt filesystems in the cluster +# The shared filesystems are not required to be configured in the cluster. +# By default it is assumed that they are mounted by the system and available on all cluster nodes. +# Set this parameter to "true" to configure the 3 shared filesystems as part of the cluster. sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false -# TODO: document parameters ################################################################################ # ASCS resource defaults @@ -209,37 +264,22 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: # Platform specific ################################################################################ -## A custom stonith definition that takes precedence over platform defaults. -# sap_ha_pacemaker_cluster_stonith_custom: -# - name: "" -# agent: "stonith:" -# options: -# pcmk_host_list: "" - -# Simpler format translated into 'ha_cluster_cluster_properties' format of -# 'ha_cluster' LSR. -sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - ## Infrastructure Platform variables, shown here for visibility only and should not be given default values -## + ## AWS platform, EC2 Virtual Servers -sap_ha_pacemaker_cluster_aws_vip_update_rt: [] +# sap_ha_pacemaker_cluster_aws_vip_update_rt: [] # sap_ha_pacemaker_cluster_aws_access_key_id # sap_ha_pacemaker_cluster_aws_secret_access_key # sap_ha_pacemaker_cluster_aws_region -## + ## Google Cloud platform, Compute Engine Virtual Machines # sap_ha_pacemaker_cluster_gcp_project # sap_ha_pacemaker_cluster_gcp_region_zone -## + ## IBM Cloud platform, Virtual Servers (x86_64) # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region -## + ## IBM Cloud platform, IBM Power Virtual Servers (ppc64le) # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region @@ -247,14 +287,14 @@ sap_ha_pacemaker_cluster_aws_vip_update_rt: [] # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url -## + ## IBM PowerVM hypervisor, Virtual Machines (LPAR, ppc64le) # sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host # sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_port # default, SSH Port 22 # sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login # sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login_password # sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_version -## + ## MS Azure platform, Virtual Machines # sap_ha_pacemaker_cluster_msazure_subscription_id # sap_ha_pacemaker_cluster_msazure_resource_group diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 5a394c0ae..d5c82623c 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -27,13 +27,209 @@ argument_specs: # description: # ... - ha_cluster: + ######################################################################### + # SAP HA role generic parameters + ######################################################################### + sap_ha_pacemaker_cluster_system_roles_collection: + default: fedora.linux_system_roles description: + - Reference to the Ansible Collection used for the Linux System Roles. + - For community/upstream, use 'fedora.linux_system_roles'. + - For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'. + required: false + type: str + + sap_ha_pacemaker_cluster_create_config_dest: + default: _resource_config.yml + description: + - The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory. + - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. + - Specify a path/filename to save the file in a custom location. + - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. + required: false + type: str + + sap_ha_pacemaker_cluster_create_config_varfile: + default: false + description: + - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. + - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. + - 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. + - WARNING! This report may include sensitive details like secrets required for certain cluster resources! + required: false + type: bool + + + sap_ha_pacemaker_cluster_cluster_nodes: + description: + - List of cluster nodes and associated attributes to describe the target SAP HA environment. + - This is required for the HANA System Replication configuration. + - Synonym for this parameter is `sap_hana_cluster_nodes`. + + example: + sap_ha_pacemaker_cluster_cluster_nodes: + - node_name: nodeA + node_role: primary + hana_site: DC01 + node_ip: 192.168.5.1 + - node_name: nodeB + node_role: secondary + hana_site: DC02 + node_ip: 192.168.5.2 + + required: false + type: list + elements: dict + options: + node_ip: + description: + - IP address of the node used for HANA System Replication. + required: true + node_name: + description: + - Name of the cluster node, should match the remote systems' hostnames. + - This is needed by the cluster members to know all their partner nodes. + required: true + node_role: + choices: + - primary + - secondary + description: + - Role of this node in the SAP cluster setup. + - There must be only **one** primary, but there can be multiple secondary nodes. + required: true + hana_site: + description: + - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). + - This is required for HANA System Replication configuration. + required: true + + sap_ha_pacemaker_cluster_fence_agent_minimal_packages: + default: ['fence-agents-all'] + description: + - The minimal set of fence agent packages that will be installed. + required: false + type: list + + sap_ha_pacemaker_cluster_resource_defaults: + default: + resource-stickiness: 3000 + migration-threshold: 5000 + description: + - Set default parameters that will be valid for all pacemaker resources. + example: + sap_ha_pacemaker_cluster_resource_defaults: + resource-stickiness: 1000 + migration-threshold: 5000 + + required: false + type: dict + + sap_ha_pacemaker_cluster_host_type: + choices: +# - hana_scaleup_costopt + - hana_scaleup_perf +# - hana_scaleup_perf_dr +# - hana_scaleout + - nwas_abap_ascs_ers +# - nwas_abap_pas_aas +# - nwas_java_scs_ers + default: hana_scaleup_perf + description: + - The SAP landscape to for which the cluster is to be configured. + - The default is a 2-node SAP HANA scale-up cluster. + required: false + type: str + + sap_ha_pacemaker_cluster_replication_type: + choices: + - mtr + - none + default: none + description: + - The type of SAP HANA site replication across multiple hosts. + - _Not yet supported_ + required: false + type: str + + sap_ha_pacemaker_cluster_fence_options: + default: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 400 + power_timeout: 240 + + description: + - STONITH resource common parameters that apply to most fencing agents. + - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). + - The listed options are set by default. + - Additional options can be added by defining this parameter in dictionary format and adding the defaults plus any valid stonith resource key-value pair. + + example: + sap_ha_pacemaker_cluster_fence_options: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 400 + power_timeout: 240 + + required: false + type: dict + + sap_ha_pacemaker_cluster_vip_client_interface: + description: + - OS device name of the network interface to use for the Virtual IP configuration. + - When there is only one interface on the system, its name will be used by default. + required: false + type: str + + sap_ha_pacemaker_cluster_stonith_custom: + description: + - Custom list of STONITH resource(s) to be configured in the cluster. + - This definition override any defaults the role would apply otherwise. + required: false + type: list + elements: dict + options: + name: + description: + - Name that will be used as the resource ID (name). + required: true + type: str + agent: + description: + - Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. + required: true + type: str + options: + description: + - The resource options listed in dictionary format, one option per line. + - Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. + required: true + type: str + + example: + sap_ha_pacemaker_cluster_stonith_custom: + - name: "my-fence-resource" + agent: "stonith:fence_rhevm" + options: + ip: rhevm-server + username: login-user + password: login-user-password + pcmk_host_list: node1,node2 + power_wait: 3 + + + ########################################################################## + # Parameters that are optionally imported from 'ha_cluster' LSR parameters + ########################################################################## + + sap_ha_pacemaker_cluster_ha_cluster: + description: + - The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym. - Optional _**host_vars**_ parameter - if defined it must be set for each node. - Dictionary that can contain various node options for the pacemaker cluster configuration. - Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md]. + - If not defined, the `ha_cluster` Linux System Role default will be used. example: - ha_cluster: + sap_ha_pacemaker_cluster_ha_cluster: corosync_addresses: - 192.168.1.10 - 192.168.2.10 @@ -43,45 +239,45 @@ argument_specs: type: dict sap_ha_pacemaker_cluster_cluster_name: - default: my-cluster description: - The name of the pacemaker cluster. - Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined. + - If not defined, the `ha_cluster` Linux System Role default will be used. required: false type: str - sap_ha_pacemaker_cluster_hacluster_password: + sap_ha_pacemaker_cluster_extra_packages: description: - - The password of the `hacluster` user which is created during pacemaker installation. - no_log: true - required: true - type: str - - sap_ha_pacemaker_cluster_aws_region: - description: - - The AWS region in which the instances to be used for the cluster setup are located. - - Required for cluster nodes setup on Amazon cloud. + - Additional extra packages to be installed, for instance specific resource packages. + - For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included. required: false - type: str + type: list - sap_ha_pacemaker_cluster_aws_access_key_id: + sap_ha_pacemaker_cluster_fence_agent_packages: description: - - AWS access key to allow control of instances (for example for fencing operations). - - Required for cluster nodes setup on Amazon cloud. + - Additional fence agent packages to be installed. + - This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`. required: false - type: str + type: list - sap_ha_pacemaker_cluster_aws_secret_access_key: + sap_ha_pacemaker_cluster_hacluster_password: description: - - AWS secret key, paired with the access key for instance control. - - Required for cluster nodes setup on Amazon cloud. - required: false + - The password of the `hacluster` user which is created during pacemaker installation. + - Inherits the value of `ha_cluster_hacluster_password`, when defined. + no_log: true + required: true type: str sap_ha_pacemaker_cluster_cluster_properties: - default: See example + default: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + description: - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. + - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. + example: sap_ha_pacemaker_cluster_cluster_properties: stonith-enabled: true @@ -91,41 +287,25 @@ argument_specs: required: false type: dict - sap_ha_pacemaker_cluster_create_config_dest: - default: _resource_config.yml - description: - - The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory. - - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. - - Specify a path/filename to save the file in a custom location. - - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. - required: false - type: str - sap_ha_pacemaker_cluster_create_config_varfile: - default: false - description: - - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. - - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. - - 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. - - WARNING! This report may include sensitive details like secrets required for certain cluster resources! - required: false - type: bool + ########################################################################## + # HANA specific parameters + ########################################################################## - sap_ha_pacemaker_cluster_fence_options: + sap_ha_pacemaker_cluster_hana_sid: description: - - STONITH resource common parameters that apply to most fencing agents. - - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). - - The listed options are set by default. - - Additional options can be added by defining this parameter in dictionary format and adding the defaults plus any valid stonith resource key-value pair. - - example: - sap_ha_pacemaker_cluster_fence_options: - pcmk_reboot_retries: 4 - pcmk_reboot_timeout: 400 - power_timeout: 240 + - The SAP HANA SID of the instance that will be configured in the cluster. + - The SID must follow SAP specifications - see SAP Note 1979280. + - Inherits the value of `sap_hana_sid`, when defined. + required: true + type: str - required: false - type: dict + sap_ha_pacemaker_cluster_hana_instance_number: + description: + - The instance number of the SAP HANA database which this role will configure in the cluster. + - Inherits the value of `sap_hana_instance_number`, when defined. + required: true + type: str sap_ha_pacemaker_cluster_hana_automated_register: default: true @@ -164,6 +344,13 @@ argument_specs: required: false type: str + sap_ha_pacemaker_cluster_hana_resource_clone_name: + default: "SAPHana__-clone" + description: + - Customize the cluster resource name of the SAP HANA DB resource clone. + required: false + type: str + sap_ha_pacemaker_cluster_hana_topology_resource_name: default: "SAPHanaTopology__" description: @@ -171,324 +358,505 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_ibmcloud_api_key: + sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: + default: "SAPHanaTopology__-clone" description: - - The API key is required to allow control of instances (for example for fencing operations). - - Required for cluster nodes setup in IBM Cloud. + - Customize the cluster resource name of the SAP HANA Topology resource clone. required: false type: str - sap_ha_pacemaker_cluster_ibmcloud_region: + sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: description: - - The cloud region key in which the instances are running. - - Required for cluster nodes setup in IBM Cloud. + - The virtual IP of the primary HANA instance. + - Mandatory parameter for HANA clusters. required: false type: str - ### ASCS parameters - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: + default: "vip_" description: - - The name of the ASCS instance, typically the profile name. - - Required for the NetWeaver ASCS resource. + - Customize the name of the resource managing the Virtual IP of the primary HANA instance. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: description: - - The full path and name of the ASCS instance profile. - - Required for the NetWeaver ASCS resource. + - The virtual IP for read-only access to the secondary HANA instance. + - Optional parameter in HANA clusters. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + sap_ha_pacemaker_cluster_vip_secondary_resource_name: + default: "vip_" description: - - Name of the filesystem resource for the ASCS instance. + - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + + ########################################################################## + # NetWeaver specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: + default: false description: - - Name of the ASCS instance resource. + - The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2. + - Set this parameter to 'true' to configure it as ENSA1. + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_sid: + description: + - SID of the NetWeaver instances. + - Mandatory for NetWeaver cluster configuration. + - Uses `sap_swpm_sid` if defined. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: description: - - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". - default: false + - Instance number of the NetWeaver ABAP ASCS instance. + - Mandatory for NetWeaver ASCS/ERS cluster configuration. required: false - type: bool + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: description: - - NetWeaver ASCS instance resource stickiness attribute. - default: 5000 + - Instance number of the NetWeaver ABAP ERS instance. + - Mandatory for NetWeaver ASCS/ERS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: description: - - NetWeaver ASCS instance migration-threshold setting attribute. - - Only used for ENSA1 setups. Default is ENSA2. - default: 1 + - Instance number of the NetWeaver ABAP PAS instance. + - Mandatory for NetWeaver PAS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: description: - - NetWeaver ASCS instance failure-timeout attribute. - - Only used for ENSA1 setups. Default is ENSA2. - default: 60 + - Instance number of the NetWeaver ABAP AAS instance. + - Mandatory for NetWeaver AAS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + sap_ha_pacemaker_cluster_storage_definition: description: - - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. - default: 3000 + - List of filesystem definitions used for filesystem cluster resources. + - Uses `sap_storage_setup_definition` when defined. + + elements: dict + options: + name: + description: + - Unique name of the filesystem definition entry. + required: true + type: str + + 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//" and "/usr/sap//SYS". + required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input) + type: str + + nfs_filesystem_type: + default: + description: + - NFS filesystem type used to mount this filesystem. + required: false + type: str + + nfs_mount_options: + default: + description: + - Mount options to be used for this specific filesystem. + required: false + type: str + + nfs_path: + description: + - Path to the filesystem source directory on the NFS server. + required: false + type: str + + nfs_server: + default: + description: + - Name of the NFS server for this particular filesystem. + required: false + type: str + + example: + sap_ha_pacemaker_cluster_storage_definition: + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap + nfs_server: "nfs-server.example.com:/" + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans + nfs_server: "nfs-server.example.com:/" + - name: sapmnt + mountpoint: /sapmnt + nfs_filesystem_type: nfs + nfs_mount_options: defaults + nfs_path: /sapmnt + nfs_server: "nfs-server.example.com:/" + + required: false + type: list + + sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: + default: nfs + description: + - Filesystem type of the NFS filesystems that are part of the cluster configuration. required: false type: str - ### ERS parameters + sap_ha_pacemaker_cluster_storage_nfs_mount_options: + default: defaults + description: + - Mount options of the NFS filesystems that are part of the cluster configuration. + required: false + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: + sap_ha_pacemaker_cluster_storage_nfs_server: description: - - The name of the ERS instance, typically the profile name. - - Required for the NetWeaver ERS resource. + - Default address of the NFS server, if not defined individually by filesystem. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + default: + - /ASCS + - /ERS description: - - The full path and name of the ERS instance profile. - - Required for the NetWeaver ERS resource. + - Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`. + required: false + type: list + + sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: + description: + - Virtual IP of the NetWeaver ASCS instance. + - Mandatory for NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: + default: vip___ascs description: - - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". - default: false + - Name of the SAPInstance resource for NetWeaver ASCS. required: false - type: bool + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: description: - - Name of the filesystem resource for the ERS instance. + - Virtual IP of the NetWeaver ERS instance. + - Mandatory for NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: + default: vip___ers description: - - Name of the ERS instance resource. + - Name of the SAPInstance resource for NetWeaver ERS. required: false type: str + sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: + description: + - Virtual IP of the NetWeaver PAS instance. + - Mandatory for NetWeaver PAS cluster setup. + required: false + type: str - ### HANA - sap_ha_pacemaker_cluster_replication_type: - choices: - - mtr - - none - default: none + sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: + default: vip___pas description: - - The type of SAP HANA site replication across multiple hosts. - - _Not yet supported_ + - Name of the SAPInstance resource for NetWeaver PAS. required: false type: str - sap_ha_pacemaker_cluster_resource_defaults: - default: See example + sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: description: - - Set default parameters that will be valid for all pacemaker resources. - example: - sap_ha_pacemaker_cluster_resource_defaults: - resource-stickiness: 1000 - migration-threshold: 5000 + - Virtual IP of the NetWeaver AAS instance. + - Mandatory for NetWeaver AAS cluster setup. + required: false + type: str + sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: + default: vip___aas + description: + - Name of the SAPInstance resource for NetWeaver AAS. required: false - type: dict + type: str -# sap_ha_pacemaker_cluster_host_type: -# choices: -## - hana_scaleup_costopt -# - hana_scaleup_perf -## - hana_scaleup_perf_dr -## - hana_scaleout -# - nwas_abap_ascs_ers -# - nwas_abap_pas_aas -## - nwas_java_scs_ers -# default: hana_scaleup_perf -# description: -# - The SAP landscape to be installed. -# required: false -# type: str + sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: + default: Filesystem_NWAS_SAPMNT_ + description: + - Filesystem resource name for the shared filesystem /sapmnt. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. + required: false + type: str - sap_ha_pacemaker_cluster_vip_client_interface: + sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: + default: Filesystem_NWAS_TRANS_ description: - - OS device name of the network interface to use for the Virtual IP configuration. - - When there is only one interface on the system, its name will be used by default. + - Filesystem resource name for the transports filesystem /usr/sap/trans. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. required: false type: str - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: + sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: + default: Filesystem_NWAS_SYS_ description: - - The virtual IP of the primary HANA instance. + - Filesystem resource name for the transports filesystem /usr/sap//SYS. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. required: false type: str - sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: + default: false description: - - Customize the name of the resource managing the Virtual IP of the primary HANA instance. + - Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources. + required: false + type: bool + + + ########################################################################## + # NetWeaver ASCS specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + description: + - The name of the ASCS instance, typically the profile name. + - Mandatory for the NetWeaver ASCS/ERS cluster setup required: false type: str - sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: description: - - The virtual IP for read-only access to the secondary HANA instance. + - The full path and name of the ASCS instance profile. + - Mandatory for the NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_vip_secondary_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + default: Filesystem_NWAS_ABAP_ASCS__ description: - - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. + - Name of the filesystem resource for the ASCS instance. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + default: SAPInstance_NWAS_ABAP_ASCS__ description: - - The virtual IP of the NetWeaver ASCS instance. + - Name of the ASCS instance resource. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + default: false description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance. + - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + default: 5000 + description: + - NetWeaver ASCS instance resource stickiness attribute. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + default: 1 description: - - The virtual IP of the NetWeaver ERS instance. + - NetWeaver ASCS instance migration-threshold setting attribute. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + default: 60 description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance. + - NetWeaver ASCS instance failure-timeout attribute. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + default: 3000 description: - - The virtual IP of the NetWeaver PAS instance. + - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: - default: "vip_" + + ########################################################################## + # NetWeaver ERS specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance. + - The name of the ERS instance, typically the profile name. + - Mandatory for the NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: description: - - The virtual IP of the NetWeaver AAS instance. + - The full path and name of the ERS instance profile. + - Mandatory for the NetWeaver ASCS/ERS cluster. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + default: false + description: + - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + default: Filesystem_NWAS_ABAP_ERS__ + description: + - Name of the filesystem resource for the ERS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + default: SAPInstance_NWAS_ABAP_ERS__ description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance. + - Name of the ERS instance resource. required: false type: str + + ########################################################################## + # PAS specific parameters + ########################################################################## + + # TODO: implement PAS cluster setup + + ########################################################################## + # PAS specific parameters + ########################################################################## + + # TODO: implement AAS cluster setup + + + ########################################################################## + # Platforms: AWS specific parameters + ########################################################################## + sap_ha_pacemaker_cluster_aws_vip_update_rt: description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. - - Required for VIP configuration in AWS EC2 environments. + - Mandatory for the VIP resource configuration in AWS EC2 environments. required: false type: list - sap_hana_cluster_nodes: + sap_ha_pacemaker_cluster_aws_region: description: - - List of cluster nodes and associated attributes to describe the target SAP HA environment. - - This is required for the HANA System Replication configuration. - - example: - sap_hana_cluster_nodes: - - node_name: nodeA - node_role: primary - hana_site: DC01 - node_ip: 192.168.5.1 - - node_name: nodeB - node_role: secondary - hana_site: DC02 - node_ip: 192.168.5.2 + - The AWS region in which the instances to be used for the cluster setup are located. + - Mandatory for cluster nodes setup on AWS EC2 instances. + required: false + type: str - elements: dict + sap_ha_pacemaker_cluster_aws_access_key_id: + description: + - AWS access key to allow control of instances (for example for fencing operations). + - Mandatory for the cluster nodes setup on AWS EC2 instances. required: false - type: list - options: - node_ip: - description: - - IP address of the node used for HANA System Replication. - required: true - node_name: - description: - - Name of the cluster node, should match the remote systems' hostnames. - - This is needed by the cluster members to know all their partner nodes. - required: true - node_role: - choices: - - primary - - secondary - description: - - Role of this node in the SAP cluster setup. - - There must be only **one** primary, but there can be multiple secondary nodes. - required: true - hana_site: - description: - - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). - - This is required for HANA System Replication configuration. - required: true + type: str - sap_hana_instance_number: + sap_ha_pacemaker_cluster_aws_secret_access_key: description: - - The instance number of the SAP HANA database which this role will configure in the cluster. + - AWS secret key, paired with the access key for instance control. + - Mandatory for the cluster setup on AWS EC2 instances. required: false type: str - sap_hana_sid: + + ########################################################################## + # Platforms: GCP specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_gcp_project: description: - - The SAP HANA SID of the instance that will be configured in the cluster. - - The SID must follow SAP specifications - see SAP Note 1979280. + - Google Cloud project name in which the target instances are installed. + - Mandatory for the cluster setup on GCP instances. required: false type: str - sap_hana_vip: + sap_ha_pacemaker_cluster_gcp_region_zone: description: - - One floating IP is required for SAP HANA DB connection by clients. - - This main VIP will always run on the promoted HANA node and be moved with it during a failover. + - Goocle Cloud Platform region zone ID. + - Mandatory for the cluster setup on GCP instances. + required: false + type: str - example: - sap_hana_vip: - primary: 192.168.10.100 + ########################################################################## + # Platforms: IBM Cloud specific parameters - VS and Power VS common + ########################################################################## + + sap_ha_pacemaker_cluster_ibmcloud_api_key: + description: + - The API key which is required to allow the control of instances (for example for fencing operations). + - Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances. required: false - type: dict - required_one_of: [{ primary, main, rw, promoted }] + type: str + + sap_ha_pacemaker_cluster_ibmcloud_region: + description: + - The IBM Cloud VS region name in which the instances are running. + - Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances. + required: false + type: str + + + ########################################################################## + # Platforms: IBM Cloud Power VS specific parameters + ########################################################################## -# TODO: review the global parameter vs. role parameter logic and compatibility of combination of HANA + NW -# sap_system_sid: +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: # description: -# - The SID of the SAP Netweaver system that will be configured in the cluster. -# - The SID must follow SAP specifications - see SAP Note 1979280. +# - +# - Mandatory for the cluster setup on IBM Cloud Power VS instances. # required: false -# type: str +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: +# +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: +# +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: + + + ########################################################################## + # Platforms: MS Azure specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_msazure_subscription_id: + description: + - Subscription ID of the MS Azure environment containing the target instances. + - Mandatory for the cluster setup on MS Azure instances. + required: false + type: str + + sap_ha_pacemaker_cluster_msazure_resource_group: + description: + - Resource group name/ID in which the target instances are defined. + - Mandatory for the cluster setup on MS Azure instances. + required: false + type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml deleted file mode 100644 index 408bb89e6..000000000 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -# If there are "ha_cluster" linux system role parameters already defined in the -# inventory, we will include these custom specifications. - -### Take the following template to add additional parameters to be inherited: -# - name: "SAP HA Prepare Pacemaker - Register ha_cluster_" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_: "{{ ha_cluster_ }}" -# when: ha_cluster_ is defined - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_cluster_properties" - when: ha_cluster_cluster_properties is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_colocation" - when: ha_cluster_constraints_colocation is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_location" - when: ha_cluster_constraints_location is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_order" - when: ha_cluster_constraints_order is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_fence_agent_packages" - when: ha_cluster_fence_agent_packages is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_repos" - when: ha_cluster_repos is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_clones" - when: ha_cluster_resource_clones is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_groups" - when: ha_cluster_resource_groups is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_primitives" - when: ha_cluster_resource_primitives is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml new file mode 100644 index 000000000..5a7084754 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml @@ -0,0 +1,95 @@ +--- +# After all of the previous construction flows, the final parameters must +# be translated to 'ha_cluster' Linux System Role syntax. +# +# This way the include_role parameters are set as play vars and do not +# require a static list of vars when the role is included. + +# List of parameters that are constructed by this role, but not all of them +# are mandatory to be defined. For any undefined parameter the default of the +# 'ha_cluster' role will apply, if the role has a default defined. +# +# Make sure to always define those parameters which have no 'ha_cluster' LSR default! +# +# SAP HA Pacemaker Cluster role -> 'ha_cluster' Linux System Role +# ------------------------------------------------------------------------------ +# __sap_ha_pacemaker_cluster_ha_cluster ha_cluster +# __sap_ha_pacemaker_cluster_cluster_name ha_cluster_cluster_name +# __sap_ha_pacemaker_cluster_cluster_properties ha_cluster_cluster_properties +# __sap_ha_pacemaker_cluster_constraints_colocation ha_cluster_constraints_colocation +# __sap_ha_pacemaker_cluster_constraints_location ha_cluster_constraints_location +# __sap_ha_pacemaker_cluster_constraints_order ha_cluster_constraints_order +# __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages +# __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages +# __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password +# __sap_ha_pacemaker_cluster_repos ha_cluster_repos +# __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones +# __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups +# __sap_ha_pacemaker_cluster_resource_primitives ha_cluster_resource_primitives + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster'" + when: __sap_ha_pacemaker_cluster_ha_cluster is defined + ansible.builtin.set_fact: + ha_cluster: "{{ __sap_ha_pacemaker_cluster_ha_cluster }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_name'" + when: __sap_ha_pacemaker_cluster_cluster_name is defined + ansible.builtin.set_fact: + ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_properties'" + when: __sap_ha_pacemaker_cluster_cluster_properties is defined + ansible.builtin.set_fact: + ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_colocation'" + when: __sap_ha_pacemaker_cluster_constraints_colocation is defined + ansible.builtin.set_fact: + ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_location'" + when: __sap_ha_pacemaker_cluster_constraints_location is defined + ansible.builtin.set_fact: + ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_order'" + when: __sap_ha_pacemaker_cluster_constraints_order is defined + ansible.builtin.set_fact: + ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_extra_packages'" + when: __sap_ha_pacemaker_cluster_extra_packages is defined + 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_fence_agent_packages'" + when: __sap_ha_pacemaker_cluster_fence_agent_packages is defined + ansible.builtin.set_fact: + ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_hacluster_password'" + when: __sap_ha_pacemaker_cluster_hacluster_password is defined + ansible.builtin.set_fact: + ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" + no_log: true # secure the credential + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" + when: __sap_ha_pacemaker_cluster_repos is defined + ansible.builtin.set_fact: + ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_clones'" + when: __sap_ha_pacemaker_cluster_resource_clones is defined + ansible.builtin.set_fact: + ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_groups'" + when: __sap_ha_pacemaker_cluster_resource_groups is defined + ansible.builtin.set_fact: + ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_primitives'" + when: __sap_ha_pacemaker_cluster_resource_primitives is defined + ansible.builtin.set_fact: + ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" + no_log: true # be paranoid, there could be credentials in it diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index 96a4bdb63..6553e8f98 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -1,29 +1,49 @@ --- -# Create or combine input parameters for the ha_cluster role. +# Combine input parameters with inherited vars from the 'ha_cluster' role. +# The inherited values take precedence. Some parameters are not required to be set. +# The 'ha_cluster' LSR will apply its role defaults. +# For mandatory parameters, sanity checks will be done separately. +# sap_ha_pacemaker_cluster_cluster_name -> user-defined or default inherited from {{ ha_cluster_cluster_name }} - name: "SAP HA Prepare Pacemaker - Set cluster name" + when: + - __sap_ha_pacemaker_cluster_cluster_name is not defined + - sap_ha_pacemaker_cluster_cluster_name is defined ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default(sap_ha_pacemaker_cluster_cluster_name) }}" + __sap_ha_pacemaker_cluster_cluster_name: "{{ sap_ha_pacemaker_cluster_cluster_name }}" +# sap_ha_pacemaker_cluster_hacluster_password -> user-defined or default inherited from {{ ha_cluster_hacluster_password }} - name: "SAP HA Prepare Pacemaker - Register the 'hacluster' user password" + when: + - __sap_ha_pacemaker_cluster_hacluster_password is not defined + - sap_ha_pacemaker_cluster_hacluster_password ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password | default(sap_ha_pacemaker_cluster_hacluster_password) }}" - no_log: true + __sap_ha_pacemaker_cluster_hacluster_password: "{{ sap_ha_pacemaker_cluster_hacluster_password }}" + no_log: true # secure the credential + + +# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default +# sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* for certain target environments +# sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* +# Empty defaults defined here for optional non-user-facing parameters. - name: "SAP HA Prepare Pacemaker - Combine extra packages lists" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_extra_packages: "{{ sap_ha_pacemaker_cluster_extra_packages - + - sap_ha_pacemaker_cluster_sap_extra_packages | default([]) - + - sap_ha_pacemaker_cluster_platform_extra_packages | default([]) + + sap_ha_pacemaker_cluster_sap_extra_packages | default([]) + + sap_ha_pacemaker_cluster_platform_extra_packages | default([]) }}" + +# sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default +# sap_ha_pacemaker_cluster_fence_agent_packages -> global default +# __sap_ha_pacemaker_cluster_fence_agent_packages -> internal default (vars/main.yml) + - name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ - sap_ha_pacemaker_cluster_fence_agent_packages - + - __sap_ha_pacemaker_cluster_fence_agent_packages + sap_ha_pacemaker_cluster_fence_agent_minimal_packages + + sap_ha_pacemaker_cluster_fence_agent_packages + + __sap_ha_pacemaker_cluster_fence_agent_packages }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index 9859b979a..43da8bf1b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -7,7 +7,7 @@ # This block is entered when # - no default stonith resource is defined and no custom is defined either # - an empty custom is defined to override any default (defined or not) -- name: "SAP HA Prepare Pacemaker - Block when no STONITH resource is defined" +- name: "SAP HA Prepare Pacemaker - (STONITH) Block when no STONITH resource is defined" when: - ( sap_ha_pacemaker_cluster_stonith_custom is defined @@ -34,7 +34,7 @@ ) block: - - name: "SAP HA Prepare Pacemaker - Set STONITH to disabled when no fencing resource is defined" + - name: "SAP HA Prepare Pacemaker - (STONITH) Set to disabled when no fencing resource is defined" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_cluster_properties: "{{ sap_ha_pacemaker_cluster_cluster_properties | combine({ 'stonith-enabled': false }) }}" @@ -53,13 +53,15 @@ # END of block for disabling stonith -- name: "SAP HA Prepare Pacemaker - Define cluster stonith properties" +- name: "SAP HA Prepare Pacemaker - (STONITH) Define cluster properties" when: - sap_ha_pacemaker_cluster_cluster_properties is defined - sap_ha_pacemaker_cluster_cluster_properties is iterable - sap_ha_pacemaker_cluster_cluster_properties | length > 0 ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_properties: + __sap_ha_pacemaker_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties | default([]) + __stonith_properties }}" + vars: + __stonith_properties: - attrs: |- {% set attrs = __sap_ha_pacemaker_cluster_cluster_properties | map(attribute='attrs') | flatten -%} {%- for default_cluster_properties in (sap_ha_pacemaker_cluster_cluster_properties | dict2items) -%} @@ -83,7 +85,7 @@ # - generic pacemaker fence resource options # (see defaults: sap_ha_pacemaker_cluster_fence_options) -- name: "SAP HA Prepare Pacemaker - Assemble the stonith resource definition from platform default" +- name: "SAP HA Prepare Pacemaker - (STONITH) Assemble the resource definition from platform default" when: - sap_ha_pacemaker_cluster_stonith_default is defined - sap_ha_pacemaker_cluster_stonith_custom is not defined @@ -117,7 +119,7 @@ {%- endfor %} {{ attrs }} -- name: "SAP HA Prepare Pacemaker - Assemble the stonith resources from custom definition" +- name: "SAP HA Prepare Pacemaker - (STONITH) Assemble the resources from custom definition" when: - sap_ha_pacemaker_cluster_stonith_custom is defined ansible.builtin.set_fact: @@ -144,7 +146,7 @@ # The STONITH resource is an element in the cluster_resource_primitives list -- name: "SAP HA Prepare Pacemaker - Construct stonith resources definition" +- name: "SAP HA Prepare Pacemaker - (STONITH) Construct resources definition" when: - __sap_ha_pacemaker_cluster_stonith_resource is defined ansible.builtin.set_fact: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 98a49b57c..fda53ca9b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -2,7 +2,7 @@ # Reminder: This file is included in a loop over a dictionary. # VIP resource definition itself -- name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" +- name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }} ({{ sap_ha_pacemaker_cluster_vip_resource_agent }})" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: @@ -17,3 +17,4 @@ value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - __sap_ha_pacemaker_cluster_vip_resource_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - '"IPaddr2" in sap_ha_pacemaker_cluster_vip_resource_agent' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml new file mode 100644 index 000000000..6598e8ff3 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml @@ -0,0 +1,94 @@ +--- +# If there are "ha_cluster" Linux System Role parameters already defined in the +# inventory, we will include these custom specifications and they take precedence. + +# Only parameters which need to be adjusted or enhanced by the SAP HA role +# need to be included here. + + +### Take the following template to add additional parameters to be inherited: +# - name: "SAP HA Prepare Pacemaker - Register ha_cluster_" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_: "{{ ha_cluster_ }}" +# when: ha_cluster_ is defined + + +# ha_cluster +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster'" + when: ha_cluster is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" + +# ha_cluster_cluster_name +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_name'" + when: ha_cluster_cluster_name is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name }}" + +# ha_cluster_cluster_properties +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_properties'" + when: ha_cluster_cluster_properties is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" + +#__sap_ha_pacemaker_cluster_resource_groups ha_cluster_constraints_colocation +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_colocation'" + when: ha_cluster_constraints_colocation is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" + +# ha_cluster_constraints_location +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_location'" + when: ha_cluster_constraints_location is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" + +# ha_cluster_constraints_order +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_order'" + when: ha_cluster_constraints_order is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" + +# ha_cluster_extra_packages +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_extra_packages'" + when: ha_cluster_extra_packages is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages }}" + +# ha_cluster_fence_agent_packages +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_fence_agent_packages'" + when: ha_cluster_fence_agent_packages is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" + +# ha_cluster_hacluster_password +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" + when: ha_cluster_hacluster_password is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" + no_log: true # handle credentials with care + +# ha_cluster_repos +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" + when: ha_cluster_repos is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" + +# ha_cluster_resource_clones +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_clones'" + when: ha_cluster_resource_clones is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" + +# ha_cluster_resource_groups +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_groups'" + when: ha_cluster_resource_groups is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" + +# ha_cluster_resource_primitives +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_primitives'" + when: ha_cluster_resource_primitives is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" + no_log: true # be paranoid, there could be credentials in it diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 8d7f4e92d..02deaebbc 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -21,8 +21,8 @@ # Make sure that all parameters already set for 'ha_cluster' are also inherited. # Add to this file a task for EACH parameter which this SAP cluster role # supports. -- name: "SAP HA Prepare Pacemaker - Include tasks for checking 'ha_cluster' predefinitions" - ansible.builtin.import_tasks: ascertain_ha_cluster_in_inventory.yml +- name: "SAP HA Prepare Pacemaker - Include tasks from 'ha_cluster' role definitions" + ansible.builtin.import_tasks: import_hacluster_vars_from_inventory.yml - name: "SAP HA Prepare Pacemaker - Include facts and common variables" ansible.builtin.import_tasks: include_vars_common.yml @@ -94,6 +94,17 @@ when: - "'nwas_java' in nwas_build_item" +# All of the SAP HA role constructed parameters must be translated to +# 'ha_cluster' Linux System Role parameters. +- name: "SAP HA Prepare Pacemaker - Translate all parameters to 'ha_cluster' input variables" + ansible.builtin.include_tasks: + file: construct_final_hacluster_vars.yml + + +########################################################## +# BLOCK which covers actual changes on the target systems +########################################################## + - name: "SAP HA Install Pacemaker - Block with actual changes" block: @@ -124,19 +135,19 @@ - __sap_ha_pacemaker_cluster_disable_services.failed - '"Could not find the requested service" not in __sap_ha_pacemaker_cluster_disable_services.msg' - # Before we are ready to call the ha_cluster role, we want to validate - # that the minimum required parameters are defined and not empty. - # TODO: make this smarter, currently all these vars are pre-defined anyway - - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" - ansible.builtin.assert: - that: - - __sap_ha_pacemaker_cluster_cluster_properties is defined - - __sap_ha_pacemaker_cluster_extra_packages is defined - - __sap_ha_pacemaker_cluster_resource_primitives is defined - - __sap_ha_pacemaker_cluster_resource_clones is defined - - __sap_ha_pacemaker_cluster_constraints_order is defined - - __sap_ha_pacemaker_cluster_constraints_colocation is defined - fail_msg: "Cluster build parameter construction has failed for this parameter." +# # Before we are ready to call the ha_cluster role, we want to validate +# # that the minimum required parameters are defined and not empty. +# # TODO: make this smarter, currently all these vars are pre-defined anyway +# - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" +# ansible.builtin.assert: +# that: +# - __sap_ha_pacemaker_cluster_cluster_properties is defined +# - __sap_ha_pacemaker_cluster_extra_packages is defined +# - __sap_ha_pacemaker_cluster_resource_primitives is defined +# - __sap_ha_pacemaker_cluster_resource_clones is defined +# - __sap_ha_pacemaker_cluster_constraints_order is defined +# - __sap_ha_pacemaker_cluster_constraints_colocation is defined +# fail_msg: "Cluster build parameter construction has failed for this parameter." - name: "SAP HA Install Pacemaker - Query if CIB already exists" ansible.builtin.command: @@ -167,20 +178,22 @@ tags: ha_cluster no_log: true # some parameters contain secrets no_log: true # some parameters contain secrets - vars: - __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" - ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" - ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" - ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" - ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" - ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" - ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" - ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" - ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" - ha_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" - ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" - ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" - ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" +# +# Remove hard-coded parameters and set 'ha_cluster' LSR parameters in this play right +# before the 'ha_cluster' role is included. +# vars: +# __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" +# ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" +# ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" +# ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" +# ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" +# ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" +# ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" +# ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" +# ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" +# ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" +# ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" +# ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" tags: ha_cluster # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 27b93aee8..70c7d6a8c 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -48,18 +48,23 @@ __sap_ha_pacemaker_cluster_supported_platforms: # - conditionals (if applicable) # - config report template # -__sap_ha_pacemaker_cluster_cluster_name: '' -__sap_ha_pacemaker_cluster_cluster_properties: [] -__sap_ha_pacemaker_cluster_constraints_colocation: [] -__sap_ha_pacemaker_cluster_constraints_location: [] -__sap_ha_pacemaker_cluster_constraints_order: [] -__sap_ha_pacemaker_cluster_extra_packages: [] -__sap_ha_pacemaker_cluster_fence_agent_packages: [] -__sap_ha_pacemaker_cluster_hacluster_password: -__sap_ha_pacemaker_cluster_repos: [] -__sap_ha_pacemaker_cluster_resource_primitives: [] -__sap_ha_pacemaker_cluster_resource_groups: [] -__sap_ha_pacemaker_cluster_resource_clones: [] - +# TODO: verify that the task flow logic works without these explicit +# pre-definitions. Otherwise there is a need to hard-code parameters +# which have defaults in the 'ha_cluster' LSR. +# Remove this section when validated. +# +#__sap_ha_pacemaker_cluster_cluster_name: '' +#__sap_ha_pacemaker_cluster_cluster_properties: [] +#__sap_ha_pacemaker_cluster_constraints_colocation: [] +#__sap_ha_pacemaker_cluster_constraints_location: [] +#__sap_ha_pacemaker_cluster_constraints_order: [] +#__sap_ha_pacemaker_cluster_extra_packages: [] +#__sap_ha_pacemaker_cluster_fence_agent_packages: [] +#__sap_ha_pacemaker_cluster_hacluster_password: +#__sap_ha_pacemaker_cluster_repos: [] +#__sap_ha_pacemaker_cluster_resource_primitives: [] +#__sap_ha_pacemaker_cluster_resource_groups: [] +#__sap_ha_pacemaker_cluster_resource_clones: [] +# # Predefine host_map for variable construction __sap_ha_pacemaker_cluster_pcmk_host_map: '' From efc0092942dca718d84d2578f47c46b14269ccf6 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 11:43:21 +0200 Subject: [PATCH 3/8] sap_ha_pacemaker_cluster: fix: typo --- roles/sap_ha_pacemaker_cluster/README.md | 6 ++-- .../meta/argument_specs.yml | 28 ++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 7caef631d..70e8916de 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -293,7 +293,7 @@ Mandatory for the cluster setup on GCP instances.
- _Type:_ `str` -Goocle Cloud Platform region zone ID.
+Google Cloud Platform region zone ID.
Mandatory for the cluster setup on GCP instances.
### sap_ha_pacemaker_cluster_ha_cluster @@ -406,14 +406,14 @@ The default is a 2-node SAP HANA scale-up cluster.
- _Type:_ `str` The API key which is required to allow the control of instances (for example for fencing operations).
-Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances.
+Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `str` The IBM Cloud VS region name in which the instances are running.
-Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances.
+Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_msazure_resource_group diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index d5c82623c..c052bff53 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -799,7 +799,7 @@ argument_specs: sap_ha_pacemaker_cluster_gcp_region_zone: description: - - Goocle Cloud Platform region zone ID. + - Google Cloud Platform region zone ID. - Mandatory for the cluster setup on GCP instances. required: false type: str @@ -812,35 +812,49 @@ argument_specs: sap_ha_pacemaker_cluster_ibmcloud_api_key: description: - The API key which is required to allow the control of instances (for example for fencing operations). - - Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances. + - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. required: false type: str sap_ha_pacemaker_cluster_ibmcloud_region: description: - The IBM Cloud VS region name in which the instances are running. - - Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances. + - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. required: false type: str ########################################################################## - # Platforms: IBM Cloud Power VS specific parameters + # Platforms: IBM Power VS on IBM Cloud specific parameters ########################################################################## # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: # description: # - -# - Mandatory for the cluster setup on IBM Cloud Power VS instances. +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. # required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: -# +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: -# +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str ########################################################################## From 7a0e1339abb1ce9ba7ceec3e59b6798f2fe8a738 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 14:44:45 +0200 Subject: [PATCH 4/8] sap_ha_pacemaker_cluster: enh: additional checks and variable re-org - added pre-flight checks for instance numbers - removed default required/type entries from argument_specifications - regenerated README - added prefix to internal vars and pre-defined them in vars/main.yml - simplified configuration output file structure and changed to 'ha_cluster' vars - fixed: the __ha_cluster_repos LSR variable has a __ prefix --- roles/sap_ha_pacemaker_cluster/README.md | 144 +++++---- .../defaults/main.yml | 29 +- .../meta/argument_specs.yml | 284 ++++-------------- .../tasks/construct_final_hacluster_vars.yml | 4 +- .../tasks/construct_vars_common.yml | 18 +- .../tasks/validate_input_parameters.yml | 53 ++++ .../templates/cluster_create_config.j2 | 42 +-- .../vars/hana_scaleout_common.yml | 2 +- .../vars/hana_scaleup_common.yml | 2 +- roles/sap_ha_pacemaker_cluster/vars/main.yml | 36 ++- .../vars/nwas_common.yml | 2 +- .../vars/platform_cloud_aws_ec2_vs.yml | 2 +- .../vars/platform_cloud_gcp_ce_vm.yml | 2 +- .../vars/platform_cloud_ibmcloud_powervs.yml | 2 +- .../vars/platform_cloud_ibmcloud_vs.yml | 2 +- .../vars/platform_cloud_msazure_vm.yml | 2 +- .../vars/platform_hyp_ibmpower_vm.yml | 2 +- 17 files changed, 254 insertions(+), 374 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 70e8916de..fb18aff22 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -131,30 +131,29 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions ## Role Input Parameters -Minimum required parameters: +Minimum required parameters for all clusters: - [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) -- [sap_ha_pacemaker_cluster_hana_instance_number](#sap_ha_pacemaker_cluster_hana_instance_number) -- [sap_ha_pacemaker_cluster_hana_sid](#sap_ha_pacemaker_cluster_hana_sid) +Additional minimum requirements depend on the type of cluster setup and on the target platform. ### sap_ha_pacemaker_cluster_aws_access_key_id -- _Type:_ `str` +- _Type:_ `string` AWS access key to allow control of instances (for example for fencing operations).
Mandatory for the cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_region -- _Type:_ `str` +- _Type:_ `string` The AWS region in which the instances to be used for the cluster setup are located.
Mandatory for cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_secret_access_key -- _Type:_ `str` +- _Type:_ `string` AWS secret key, paired with the access key for instance control.
Mandatory for the cluster setup on AWS EC2 instances.
@@ -168,7 +167,7 @@ Mandatory for the VIP resource configuration in AWS EC2 environments.
### sap_ha_pacemaker_cluster_cluster_name -- _Type:_ `str` +- _Type:_ `string` The name of the pacemaker cluster.
Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined.
@@ -181,15 +180,16 @@ If not defined, the `ha_cluster` Linux System Role default will be used.
List of cluster nodes and associated attributes to describe the target SAP HA environment.
This is required for the HANA System Replication configuration.
Synonym for this parameter is `sap_hana_cluster_nodes`.
+Mandatory to be defined for HANA clusters.
- **hana_site**
- Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. + Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
Mandatory for HANA clusters (sudo config for system replication). - **node_ip**
- IP address of the node used for HANA System Replication. + IP address of the node used for HANA System Replication.
_Optional. Currently not needed/used in cluster configuration._ - **node_name**
- Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. + Name of the cluster node, should match the remote systems' hostnames.
_Optional. Currently not needed/used in cluster configuration._ - **node_role**
- Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. + Role of the defined `node_name` in the SAP HANA cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes.
_Optional. Currently not needed/used in cluster configuration._ Example: @@ -200,9 +200,6 @@ sap_ha_pacemaker_cluster_cluster_nodes: node_name: nodeA node_role: primary - hana_site: DC02 - node_ip: 192.168.5.2 - node_name: nodeB - node_role: secondary ``` ### sap_ha_pacemaker_cluster_cluster_properties @@ -224,7 +221,7 @@ sap_ha_pacemaker_cluster_cluster_properties: ### sap_ha_pacemaker_cluster_create_config_dest -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `_resource_config.yml` The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory.
@@ -284,14 +281,14 @@ sap_ha_pacemaker_cluster_fence_options: ### sap_ha_pacemaker_cluster_gcp_project -- _Type:_ `str` +- _Type:_ `string` Google Cloud project name in which the target instances are installed.
Mandatory for the cluster setup on GCP instances.
### sap_ha_pacemaker_cluster_gcp_region_zone -- _Type:_ `str` +- _Type:_ `string` Google Cloud Platform region zone ID.
Mandatory for the cluster setup on GCP instances.
@@ -318,7 +315,7 @@ sap_ha_pacemaker_cluster_ha_cluster: ### sap_ha_pacemaker_cluster_hacluster_password required -- _Type:_ `str` +- _Type:_ `string` The password of the `hacluster` user which is created during pacemaker installation.
Inherits the value of `ha_cluster_hacluster_password`, when defined.
@@ -341,12 +338,13 @@ Time difference needed between to primary time stamps, if a dual-primary situati If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status.
This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed.
-### sap_ha_pacemaker_cluster_hana_instance_number required +### sap_ha_pacemaker_cluster_hana_instance_number -- _Type:_ `str` +- _Type:_ `string` The instance number of the SAP HANA database which this role will configure in the cluster.
Inherits the value of `sap_hana_instance_number`, when defined.
+Mandatory for SAP HANA cluster setups.
### sap_ha_pacemaker_cluster_hana_prefer_site_takeover @@ -359,43 +357,44 @@ When set to "true" (default) a failover to secondary will be initiated on resour ### sap_ha_pacemaker_cluster_hana_resource_clone_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHana__-clone` Customize the cluster resource name of the SAP HANA DB resource clone.
### sap_ha_pacemaker_cluster_hana_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHana__` Customize the cluster resource name of the SAP HANA DB resource.
-### sap_ha_pacemaker_cluster_hana_sid required +### sap_ha_pacemaker_cluster_hana_sid -- _Type:_ `str` +- _Type:_ `string` The SAP HANA SID of the instance that will be configured in the cluster.
The SID must follow SAP specifications - see SAP Note 1979280.
Inherits the value of `sap_hana_sid`, when defined.
+Mandatory for SAP HANA cluster setups.
### sap_ha_pacemaker_cluster_hana_topology_resource_clone_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHanaTopology__-clone` Customize the cluster resource name of the SAP HANA Topology resource clone.
### sap_ha_pacemaker_cluster_hana_topology_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHanaTopology__` Customize the cluster resource name of the SAP HANA Topology resource.
### sap_ha_pacemaker_cluster_host_type -- _Type:_ `str` +- _Type:_ `list` - _Default:_ `hana_scaleup_perf` The SAP landscape to for which the cluster is to be configured.
@@ -403,35 +402,35 @@ The default is a 2-node SAP HANA scale-up cluster.
### sap_ha_pacemaker_cluster_ibmcloud_api_key -- _Type:_ `str` +- _Type:_ `string` The API key which is required to allow the control of instances (for example for fencing operations).
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_ibmcloud_region -- _Type:_ `str` +- _Type:_ `string` The IBM Cloud VS region name in which the instances are running.
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_msazure_resource_group -- _Type:_ `str` +- _Type:_ `string` Resource group name/ID in which the target instances are defined.
Mandatory for the cluster setup on MS Azure instances.
### sap_ha_pacemaker_cluster_msazure_subscription_id -- _Type:_ `str` +- _Type:_ `string` Subscription ID of the MS Azure environment containing the target instances.
Mandatory for the cluster setup on MS Azure instances.
### sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP AAS instance.
Mandatory for NetWeaver AAS cluster configuration.
@@ -445,21 +444,21 @@ Standard NetWeaver paths in "/usr/sap" and automatically appended to the configu ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ASCS__` Name of the filesystem resource for the ASCS instance.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `3000` NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
@@ -473,7 +472,7 @@ NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `60` NetWeaver ASCS instance failure-timeout attribute.
@@ -481,7 +480,7 @@ Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ens ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `1` NetWeaver ASCS instance migration-threshold setting attribute.
@@ -489,42 +488,42 @@ Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ens ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name -- _Type:_ `str` +- _Type:_ `string` The name of the ASCS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ASCS__` Name of the ASCS instance resource.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `5000` NetWeaver ASCS instance resource stickiness attribute.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string -- _Type:_ `str` +- _Type:_ `string` The full path and name of the ASCS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ERS__` Name of the filesystem resource for the ERS instance.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
@@ -538,28 +537,28 @@ NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name -- _Type:_ `str` +- _Type:_ `string` The name of the ERS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ERS__` Name of the ERS instance resource.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string -- _Type:_ `str` +- _Type:_ `string` The full path and name of the ERS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster.
### sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP PAS instance.
Mandatory for NetWeaver PAS cluster configuration.
@@ -574,7 +573,7 @@ Set this parameter to 'true' to configure it as ENSA1.
### sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_SAPMNT_` Filesystem resource name for the shared filesystem /sapmnt.
@@ -590,15 +589,16 @@ Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/ ### sap_ha_pacemaker_cluster_netweaver_sid -- _Type:_ `str` +- _Type:_ `string` SID of the NetWeaver instances.
Mandatory for NetWeaver cluster configuration.
Uses `sap_swpm_sid` if defined.
+Mandatory for NetWeaver cluster setups.
### sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_SYS_` Filesystem resource name for the transports filesystem /usr/sap//SYS.
@@ -607,21 +607,13 @@ Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_file ### sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_TRANS_` Filesystem resource name for the transports filesystem /usr/sap/trans.
Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
-### sap_ha_pacemaker_cluster_replication_type - -- _Type:_ `str` -- _Default:_ `none` - -The type of SAP HANA site replication across multiple hosts.
-_Not yet supported_
- ### sap_ha_pacemaker_cluster_resource_defaults - _Type:_ `dict` @@ -710,27 +702,27 @@ sap_ha_pacemaker_cluster_storage_definition: ### sap_ha_pacemaker_cluster_storage_nfs_filesytem_type -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `nfs` Filesystem type of the NFS filesystems that are part of the cluster configuration.
### sap_ha_pacemaker_cluster_storage_nfs_mount_options -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `defaults` Mount options of the NFS filesystems that are part of the cluster configuration.
### sap_ha_pacemaker_cluster_storage_nfs_server -- _Type:_ `str` +- _Type:_ `string` Default address of the NFS server, if not defined individually by filesystem.
### sap_ha_pacemaker_cluster_system_roles_collection -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `fedora.linux_system_roles` Reference to the Ansible Collection used for the Linux System Roles.
@@ -739,91 +731,91 @@ For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_syste ### sap_ha_pacemaker_cluster_vip_client_interface -- _Type:_ `str` +- _Type:_ `string` OS device name of the network interface to use for the Virtual IP configuration.
When there is only one interface on the system, its name will be used by default.
### sap_ha_pacemaker_cluster_vip_hana_primary_ip_address -- _Type:_ `str` +- _Type:_ `string` The virtual IP of the primary HANA instance.
Mandatory parameter for HANA clusters.
### sap_ha_pacemaker_cluster_vip_hana_primary_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip_` Customize the name of the resource managing the Virtual IP of the primary HANA instance.
### sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address -- _Type:_ `str` +- _Type:_ `string` The virtual IP for read-only access to the secondary HANA instance.
Optional parameter in HANA clusters.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver AAS instance.
Mandatory for NetWeaver AAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___aas` Name of the SAPInstance resource for NetWeaver AAS.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___ascs` Name of the SAPInstance resource for NetWeaver ASCS.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___ers` Name of the SAPInstance resource for NetWeaver ERS.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver PAS instance.
Mandatory for NetWeaver PAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___pas` Name of the SAPInstance resource for NetWeaver PAS.
### sap_ha_pacemaker_cluster_vip_secondary_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip_` Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance.
diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index d2d8b1752..c654ab685 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -24,6 +24,10 @@ sap_ha_pacemaker_cluster_create_config_varfile: false sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" # Inherit SAP common (global synonyms) parameters when defined. + +# This variable is currently only required for HANA nodes to define +# - hana_site: +# Other options are needed in the separate HSR setup role. sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes | default([]) }}" # Make sure that there is always the minimal default fed into the included role. @@ -49,6 +53,7 @@ sap_ha_pacemaker_cluster_resource_defaults: {} # 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in # 'tasks/ascertain_sap_landscape.yml'. +# TODO: review with testers, updated arg specs now require it to be a list from the start sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" # Currently unused parameter. Keeping for future functionality. @@ -76,28 +81,32 @@ sap_ha_pacemaker_cluster_vip_client_interface: '' #sap_ha_pacemaker_cluster_stonith_custom: [] +# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native +# 'ha_cluster_cluster_properties' parameter. +sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true ################################################################################ # Inherit from 'ha_cluster' Linux System Role parameters when defined ################################################################################ -sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" -sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" +# Optional without a default. The 'ha_cluster' LSR defaults will apply when not defined. +#sap_ha_pacemaker_cluster_ha_cluster: +#sap_ha_pacemaker_cluster_cluster_name: -sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" +# Optional. Set a default here and not in the code. +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: [] -# Mandatory. Inherit 'ha_cluster' LSR variable when defined, but do not set a default otherwise. +# 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. sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" -# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native -# 'ha_cluster_cluster_properties' parameter. -sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true ################################################################################ # HANA diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index c052bff53..131a26662 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -36,8 +36,6 @@ argument_specs: - Reference to the Ansible Collection used for the Linux System Roles. - For community/upstream, use 'fedora.linux_system_roles'. - For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'. - required: false - type: str sap_ha_pacemaker_cluster_create_config_dest: default: _resource_config.yml @@ -46,72 +44,62 @@ argument_specs: - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. - Specify a path/filename to save the file in a custom location. - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. - required: false - type: str sap_ha_pacemaker_cluster_create_config_varfile: + type: bool default: false description: - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. - 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. - WARNING! This report may include sensitive details like secrets required for certain cluster resources! - required: false - type: bool - sap_ha_pacemaker_cluster_cluster_nodes: + type: list description: - List of cluster nodes and associated attributes to describe the target SAP HA environment. - This is required for the HANA System Replication configuration. - Synonym for this parameter is `sap_hana_cluster_nodes`. - - example: - sap_ha_pacemaker_cluster_cluster_nodes: - - node_name: nodeA - node_role: primary - hana_site: DC01 - node_ip: 192.168.5.1 - - node_name: nodeB - node_role: secondary - hana_site: DC02 - node_ip: 192.168.5.2 - - required: false - type: list + - Mandatory to be defined for HANA clusters. elements: dict options: node_ip: description: - IP address of the node used for HANA System Replication. - required: true + - _Optional. Currently not needed/used in cluster configuration._ node_name: description: - Name of the cluster node, should match the remote systems' hostnames. - - This is needed by the cluster members to know all their partner nodes. - required: true + - _Optional. Currently not needed/used in cluster configuration._ node_role: choices: - primary - secondary description: - - Role of this node in the SAP cluster setup. + - Role of the defined `node_name` in the SAP HANA cluster setup. - There must be only **one** primary, but there can be multiple secondary nodes. - required: true + - _Optional. Currently not needed/used in cluster configuration._ hana_site: description: - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). - - This is required for HANA System Replication configuration. - required: true + - Mandatory for HANA clusters (sudo config for system replication). + + example: + sap_ha_pacemaker_cluster_cluster_nodes: + - hana_site: DC01 + node_name: nodeA + node_role: primary + node_ip: 192.168.5.1 + - hana_site: DC02 sap_ha_pacemaker_cluster_fence_agent_minimal_packages: + type: list default: ['fence-agents-all'] description: - The minimal set of fence agent packages that will be installed. - required: false - type: list sap_ha_pacemaker_cluster_resource_defaults: + type: dict default: resource-stickiness: 3000 migration-threshold: 5000 @@ -122,10 +110,8 @@ argument_specs: resource-stickiness: 1000 migration-threshold: 5000 - required: false - type: dict - sap_ha_pacemaker_cluster_host_type: + type: list choices: # - hana_scaleup_costopt - hana_scaleup_perf @@ -138,26 +124,22 @@ argument_specs: description: - The SAP landscape to for which the cluster is to be configured. - The default is a 2-node SAP HANA scale-up cluster. - required: false - type: str - sap_ha_pacemaker_cluster_replication_type: - choices: - - mtr - - none - default: none - description: - - The type of SAP HANA site replication across multiple hosts. - - _Not yet supported_ - required: false - type: str +# sap_ha_pacemaker_cluster_replication_type: +# choices: +# - mtr +# - none +# default: none +# description: +# - The type of SAP HANA site replication across multiple hosts. +# - _Not yet supported_ sap_ha_pacemaker_cluster_fence_options: + type: dict default: pcmk_reboot_retries: 4 pcmk_reboot_timeout: 400 power_timeout: 240 - description: - STONITH resource common parameters that apply to most fencing agents. - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). @@ -170,40 +152,32 @@ argument_specs: pcmk_reboot_timeout: 400 power_timeout: 240 - required: false - type: dict sap_ha_pacemaker_cluster_vip_client_interface: description: - OS device name of the network interface to use for the Virtual IP configuration. - When there is only one interface on the system, its name will be used by default. - required: false - type: str sap_ha_pacemaker_cluster_stonith_custom: + type: list description: - Custom list of STONITH resource(s) to be configured in the cluster. - This definition override any defaults the role would apply otherwise. - required: false - type: list elements: dict options: name: description: - Name that will be used as the resource ID (name). required: true - type: str agent: description: - Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. required: true - type: str options: description: - The resource options listed in dictionary format, one option per line. - Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. required: true - type: str example: sap_ha_pacemaker_cluster_stonith_custom: @@ -216,18 +190,36 @@ argument_specs: pcmk_host_list: node1,node2 power_wait: 3 + sap_ha_pacemaker_cluster_cluster_properties: + type: dict + default: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + description: + - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. + - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. + + example: + sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + ########################################################################## # Parameters that are optionally imported from 'ha_cluster' LSR parameters ########################################################################## sap_ha_pacemaker_cluster_ha_cluster: + type: dict description: - The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym. - Optional _**host_vars**_ parameter - if defined it must be set for each node. - Dictionary that can contain various node options for the pacemaker cluster configuration. - Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md]. - If not defined, the `ha_cluster` Linux System Role default will be used. + example: sap_ha_pacemaker_cluster_ha_cluster: corosync_addresses: @@ -235,30 +227,24 @@ argument_specs: - 192.168.2.10 node_name: nodeA - required: false - type: dict sap_ha_pacemaker_cluster_cluster_name: description: - The name of the pacemaker cluster. - Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined. - If not defined, the `ha_cluster` Linux System Role default will be used. - required: false - type: str sap_ha_pacemaker_cluster_extra_packages: + type: list description: - Additional extra packages to be installed, for instance specific resource packages. - For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included. - required: false - type: list sap_ha_pacemaker_cluster_fence_agent_packages: + type: list description: - Additional fence agent packages to be installed. - This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`. - required: false - type: list sap_ha_pacemaker_cluster_hacluster_password: description: @@ -266,26 +252,6 @@ argument_specs: - Inherits the value of `ha_cluster_hacluster_password`, when defined. no_log: true required: true - type: str - - sap_ha_pacemaker_cluster_cluster_properties: - default: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - description: - - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. - - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. - - example: - sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - required: false - type: dict ########################################################################## @@ -297,35 +263,32 @@ argument_specs: - The SAP HANA SID of the instance that will be configured in the cluster. - The SID must follow SAP specifications - see SAP Note 1979280. - Inherits the value of `sap_hana_sid`, when defined. - required: true - type: str + - Mandatory for SAP HANA cluster setups. sap_ha_pacemaker_cluster_hana_instance_number: description: - The instance number of the SAP HANA database which this role will configure in the cluster. - Inherits the value of `sap_hana_instance_number`, when defined. - required: true - type: str + - Mandatory for SAP HANA cluster setups. sap_ha_pacemaker_cluster_hana_automated_register: + type: bool default: true description: - Parameter for the 'SAPHana' cluster resource. - Define if a former primary should be re-registered automatically as secondary. - required: false - type: bool sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: + type: int default: 900 description: - Parameter for the 'SAPHana' cluster resource. - Time difference needed between to primary time stamps, if a dual-primary situation occurs. - If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status. - This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed. - required: false - type: int sap_ha_pacemaker_cluster_hana_prefer_site_takeover: + type: bool choices: - true - false @@ -334,64 +297,46 @@ argument_specs: - Parameter for the 'SAPHana' cluster resource. - Set to "false" if the cluster should first attempt to restart the instance on the same node. - When set to "true" (default) a failover to secondary will be initiated on resource failure. - required: false - type: bool sap_ha_pacemaker_cluster_hana_resource_name: default: "SAPHana__" description: - Customize the cluster resource name of the SAP HANA DB resource. - required: false - type: str sap_ha_pacemaker_cluster_hana_resource_clone_name: default: "SAPHana__-clone" description: - Customize the cluster resource name of the SAP HANA DB resource clone. - required: false - type: str sap_ha_pacemaker_cluster_hana_topology_resource_name: default: "SAPHanaTopology__" description: - Customize the cluster resource name of the SAP HANA Topology resource. - required: false - type: str sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: default: "SAPHanaTopology__-clone" description: - Customize the cluster resource name of the SAP HANA Topology resource clone. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: description: - The virtual IP of the primary HANA instance. - Mandatory parameter for HANA clusters. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: default: "vip_" description: - Customize the name of the resource managing the Virtual IP of the primary HANA instance. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: description: - The virtual IP for read-only access to the secondary HANA instance. - Optional parameter in HANA clusters. - required: false - type: str sap_ha_pacemaker_cluster_vip_secondary_resource_name: default: "vip_" description: - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. - required: false - type: str ########################################################################## @@ -399,61 +344,50 @@ argument_specs: ########################################################################## sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: + type: bool default: false description: - The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2. - Set this parameter to 'true' to configure it as ENSA1. - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_sid: description: - SID of the NetWeaver instances. - Mandatory for NetWeaver cluster configuration. - Uses `sap_swpm_sid` if defined. - required: false - type: str + - Mandatory for NetWeaver cluster setups. sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: description: - Instance number of the NetWeaver ABAP ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: description: - Instance number of the NetWeaver ABAP ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: description: - Instance number of the NetWeaver ABAP PAS instance. - Mandatory for NetWeaver PAS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: description: - Instance number of the NetWeaver ABAP AAS instance. - Mandatory for NetWeaver AAS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_definition: + type: list description: - List of filesystem definitions used for filesystem cluster resources. - Uses `sap_storage_setup_definition` when defined. - elements: dict options: name: description: - Unique name of the filesystem definition entry. required: true - type: str mountpoint: description: @@ -461,34 +395,25 @@ argument_specs: - 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//" and "/usr/sap//SYS". required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input) - type: str nfs_filesystem_type: default: description: - NFS filesystem type used to mount this filesystem. - required: false - type: str nfs_mount_options: default: description: - Mount options to be used for this specific filesystem. - required: false - type: str nfs_path: description: - Path to the filesystem source directory on the NFS server. - required: false - type: str nfs_server: default: description: - Name of the NFS server for this particular filesystem. - required: false - type: str example: sap_ha_pacemaker_cluster_storage_definition: @@ -507,93 +432,68 @@ argument_specs: nfs_path: /sapmnt nfs_server: "nfs-server.example.com:/" - required: false - type: list sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: default: nfs description: - Filesystem type of the NFS filesystems that are part of the cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_nfs_mount_options: default: defaults description: - Mount options of the NFS filesystems that are part of the cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_nfs_server: description: - Default address of the NFS server, if not defined individually by filesystem. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + type: list default: - /ASCS - /ERS description: - Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`. - required: false - type: list sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: description: - Virtual IP of the NetWeaver ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: default: vip___ascs description: - Name of the SAPInstance resource for NetWeaver ASCS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: description: - Virtual IP of the NetWeaver ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: default: vip___ers description: - Name of the SAPInstance resource for NetWeaver ERS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: description: - Virtual IP of the NetWeaver PAS instance. - Mandatory for NetWeaver PAS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: default: vip___pas description: - Name of the SAPInstance resource for NetWeaver PAS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: description: - Virtual IP of the NetWeaver AAS instance. - Mandatory for NetWeaver AAS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: default: vip___aas description: - Name of the SAPInstance resource for NetWeaver AAS. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: default: Filesystem_NWAS_SAPMNT_ @@ -601,8 +501,6 @@ argument_specs: - Filesystem resource name for the shared filesystem /sapmnt. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: default: Filesystem_NWAS_TRANS_ @@ -610,8 +508,6 @@ argument_specs: - Filesystem resource name for the transports filesystem /usr/sap/trans. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: default: Filesystem_NWAS_SYS_ @@ -619,15 +515,12 @@ argument_specs: - Filesystem resource name for the transports filesystem /usr/sap//SYS. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: + type: bool default: false description: - Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources. - required: false - type: bool ########################################################################## @@ -638,66 +531,49 @@ argument_specs: description: - The name of the ASCS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: description: - The full path and name of the ASCS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ASCS__ description: - Name of the filesystem resource for the ASCS instance. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ASCS__ description: - Name of the ASCS instance resource. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + type: bool default: false description: - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: default: 5000 description: - NetWeaver ASCS instance resource stickiness attribute. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: default: 1 description: - NetWeaver ASCS instance migration-threshold setting attribute. - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: default: 60 description: - NetWeaver ASCS instance failure-timeout attribute. - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: default: 3000 description: - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. - required: false - type: str ########################################################################## @@ -708,36 +584,27 @@ argument_specs: description: - The name of the ERS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: description: - The full path and name of the ERS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + type: bool default: false description: - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ERS__ description: - Name of the filesystem resource for the ERS instance. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ERS__ description: - Name of the ERS instance resource. - required: false - type: str ########################################################################## @@ -758,32 +625,25 @@ argument_specs: ########################################################################## sap_ha_pacemaker_cluster_aws_vip_update_rt: + type: list description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. - Mandatory for the VIP resource configuration in AWS EC2 environments. - required: false - type: list sap_ha_pacemaker_cluster_aws_region: description: - The AWS region in which the instances to be used for the cluster setup are located. - Mandatory for cluster nodes setup on AWS EC2 instances. - required: false - type: str sap_ha_pacemaker_cluster_aws_access_key_id: description: - AWS access key to allow control of instances (for example for fencing operations). - Mandatory for the cluster nodes setup on AWS EC2 instances. - required: false - type: str sap_ha_pacemaker_cluster_aws_secret_access_key: description: - AWS secret key, paired with the access key for instance control. - Mandatory for the cluster setup on AWS EC2 instances. - required: false - type: str ########################################################################## @@ -794,15 +654,11 @@ argument_specs: description: - Google Cloud project name in which the target instances are installed. - Mandatory for the cluster setup on GCP instances. - required: false - type: str sap_ha_pacemaker_cluster_gcp_region_zone: description: - Google Cloud Platform region zone ID. - Mandatory for the cluster setup on GCP instances. - required: false - type: str ########################################################################## @@ -813,15 +669,11 @@ argument_specs: description: - The API key which is required to allow the control of instances (for example for fencing operations). - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. - required: false - type: str sap_ha_pacemaker_cluster_ibmcloud_region: description: - The IBM Cloud VS region name in which the instances are running. - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. - required: false - type: str ########################################################################## @@ -832,29 +684,21 @@ argument_specs: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str ########################################################################## @@ -865,12 +709,8 @@ argument_specs: description: - Subscription ID of the MS Azure environment containing the target instances. - Mandatory for the cluster setup on MS Azure instances. - required: false - type: str sap_ha_pacemaker_cluster_msazure_resource_group: description: - Resource group name/ID in which the target instances are defined. - Mandatory for the cluster setup on MS Azure instances. - required: false - type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml index 5a7084754..db3eded7f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml @@ -22,7 +22,7 @@ # __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages # __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages # __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password -# __sap_ha_pacemaker_cluster_repos ha_cluster_repos +# __sap_ha_pacemaker_cluster_repos __ha_cluster_repos # __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones # __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups # __sap_ha_pacemaker_cluster_resource_primitives ha_cluster_resource_primitives @@ -76,7 +76,7 @@ - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" when: __sap_ha_pacemaker_cluster_repos is defined ansible.builtin.set_fact: - ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" + __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_clones'" when: __sap_ha_pacemaker_cluster_resource_clones is defined diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index 6553e8f98..d990853b9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -22,18 +22,18 @@ no_log: true # secure the credential -# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default -# sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* for certain target environments -# sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* +# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default +# __sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* +# __sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* # Empty defaults defined here for optional non-user-facing parameters. - name: "SAP HA Prepare Pacemaker - Combine extra packages lists" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_extra_packages: "{{ + __sap_ha_pacemaker_cluster_extra_packages: "{{ ( sap_ha_pacemaker_cluster_extra_packages - + sap_ha_pacemaker_cluster_sap_extra_packages | default([]) - + sap_ha_pacemaker_cluster_platform_extra_packages | default([]) - }}" + + __sap_ha_pacemaker_cluster_sap_extra_packages + + __sap_ha_pacemaker_cluster_platform_extra_packages + ) | unique }}" # sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default @@ -42,8 +42,8 @@ - name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ + __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ( sap_ha_pacemaker_cluster_fence_agent_minimal_packages + sap_ha_pacemaker_cluster_fence_agent_packages + __sap_ha_pacemaker_cluster_fence_agent_packages - }}" + ) | unique }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 6d77a1c67..00bfc6eec 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -11,6 +11,28 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 +- name: "SAP HA Prepare Pacemaker - (SAP HANA) Validate SAP Instance Number" + ansible.builtin.assert: + that: + - ( + sap_ha_pacemaker_cluster_hana_instance_number | type_debug != 'int' + and sap_ha_pacemaker_cluster_hana_instance_number | length == 2 + ) + or + ( + sap_ha_pacemaker_cluster_hana_instance_number | type_debug == 'int' + and sap_ha_pacemaker_cluster_hana_instance_number is regex("^[0-9][0-9]$") + ) + fail_msg: | + + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires 'sap_ha_pacemaker_cluster_hana_instance_number' to be defined. + + The instance number must be exactly 2 digits. + Add quotes if the number starts with a 0! + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + - name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP System ID" ansible.builtin.assert: that: @@ -22,6 +44,37 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 +- name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP Instance Number" + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap') | length > 0 + ansible.builtin.assert: + that: + - ( + ascs_ers_nr_item | type_debug != 'int' + and ascs_ers_nr_item | length == 2 + ) + or + ( + ascs_ers_nr_item | type_debug == 'int' + and ascs_ers_nr_item is regex("^[0-9][0-9]$") + ) + fail_msg: | + + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires the ASCS/ERS instance numbers to be defined: + - sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number + - sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number + + The instance number must be exactly 2 digits. + Add quotes if the number starts with a 0! + + loop: + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + loop_control: + loop_var: ascs_ers_nr_item + + # NIC definition validation - name: "SAP HA Prepare Pacemaker - Verify that a custom NIC name is defined when multiple NICs exist" ansible.builtin.assert: diff --git a/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 b/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 index 5f35649d0..87a96a067 100644 --- a/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 +++ b/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 @@ -5,66 +5,46 @@ # Created by: {{ ansible_role_name }} # The name of the cluster -ha_cluster_cluster_name: {{ __sap_ha_pacemaker_cluster_cluster_name }} +ha_cluster_cluster_name: {{ ha_cluster_cluster_name | default('') }} -{% if __sap_ha_pacemaker_cluster_cluster_properties is defined and __sap_ha_pacemaker_cluster_cluster_properties|length > 0 %} # Properties that enable and control cluster behavior ha_cluster_cluster_properties: -{{ __sap_ha_pacemaker_cluster_cluster_properties | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_cluster_properties | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_colocation is defined and __sap_ha_pacemaker_cluster_constraints_colocation|length > 0 %} # Definition of resources which depend on other resources ha_cluster_constraints_colocation: -{{ __sap_ha_pacemaker_cluster_constraints_colocation | to_nice_yaml(indent=2) }} -{%- endif -%} +{{ ha_cluster_constraints_colocation | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_location is defined and __sap_ha_pacemaker_cluster_constraints_location|length > 0 %} # Definition of resources which have specific location dependencies or preferences ha_cluster_constraints_location: -{{ __sap_ha_pacemaker_cluster_constraints_location | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_constraints_location | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_order is defined and __sap_ha_pacemaker_cluster_constraints_order|length > 0 %} # Definition of an order in which resources must be started. # They are automatically stopped in reverse order. ha_cluster_constraints_order: -{{ __sap_ha_pacemaker_cluster_constraints_order | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_constraints_order | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_extra_packages is defined and __sap_ha_pacemaker_cluster_extra_packages|length > 0 %} # Extra packages that are needed for this HA environment ha_cluster_extra_packages: -{{ __sap_ha_pacemaker_cluster_extra_packages | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_extra_packages | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_fence_agent_packages is defined and __sap_ha_pacemaker_cluster_fence_agent_packages|length > 0 %} # Fence agent package(s) for this HA environment ha_cluster_fence_agent_packages: -{{ __sap_ha_pacemaker_cluster_fence_agent_packages | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_fence_agent_packages | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_repos is defined and __sap_ha_pacemaker_cluster_repos|length > 0 %} # Definition of repositories to enable (if disable) to ensure # access to all required packages __ha_cluster_repos: -{{ __sap_ha_pacemaker_cluster_repos | to_nice_yaml(indent=2) }} -{%- endif %} +{{ __ha_cluster_repos | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_clones is defined and __sap_ha_pacemaker_cluster_resource_clones|length > 0 %} # Definition of resources that are cloned and monitored on all nodes ha_cluster_resource_clones: -{{ __sap_ha_pacemaker_cluster_resource_clones | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_clones | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_groups is defined and __sap_ha_pacemaker_cluster_resource_groups|length > 0 %} # Definition of resources that are grouped together ha_cluster_resource_groups: -{{ __sap_ha_pacemaker_cluster_resource_groups | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_groups | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_primitives is defined and __sap_ha_pacemaker_cluster_resource_primitives|length > 0 %} # Definition of all cluster resources ha_cluster_resource_primitives: -{{ __sap_ha_pacemaker_cluster_resource_primitives | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_primitives | default()| to_nice_yaml(indent=2) }} diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml index 4e356cae9..4175257b5 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml @@ -3,7 +3,7 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap-hana-scaleout sap_ha_pacemaker_cluster_ra_hana: SAPHanaController diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml index 5c76b2497..85043b5c5 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml @@ -3,7 +3,7 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap-hana sap_ha_pacemaker_cluster_ra_hana: SAPHana diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 70c7d6a8c..1590917a3 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -31,12 +31,11 @@ __sap_ha_pacemaker_cluster_required_facts: # This is automatically adjusted during preparation tasks. __sap_ha_pacemaker_cluster_nic_multi_bool: false -# Define empty parameters to avoid undefined input variables. -# The arguments_spec check complains. -# The actual values must be empty, they are set by various tasks! # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' + +# __sap_ha_pacemaker_cluster_supported_platforms: - cloud_aws_ec2_vs - cloud_msazure_vm @@ -53,18 +52,25 @@ __sap_ha_pacemaker_cluster_supported_platforms: # which have defaults in the 'ha_cluster' LSR. # Remove this section when validated. # -#__sap_ha_pacemaker_cluster_cluster_name: '' -#__sap_ha_pacemaker_cluster_cluster_properties: [] -#__sap_ha_pacemaker_cluster_constraints_colocation: [] -#__sap_ha_pacemaker_cluster_constraints_location: [] -#__sap_ha_pacemaker_cluster_constraints_order: [] -#__sap_ha_pacemaker_cluster_extra_packages: [] -#__sap_ha_pacemaker_cluster_fence_agent_packages: [] +# Never set defaults for these: +#__sap_ha_pacemaker_cluster_cluster_name: #__sap_ha_pacemaker_cluster_hacluster_password: -#__sap_ha_pacemaker_cluster_repos: [] -#__sap_ha_pacemaker_cluster_resource_primitives: [] -#__sap_ha_pacemaker_cluster_resource_groups: [] -#__sap_ha_pacemaker_cluster_resource_clones: [] -# + + +# Pre-define internal optional parameters to avoid defaults in the code: +__sap_ha_pacemaker_cluster_sap_extra_packages: [] +__sap_ha_pacemaker_cluster_platform_extra_packages: [] + +__sap_ha_pacemaker_cluster_cluster_properties: [] +__sap_ha_pacemaker_cluster_constraints_colocation: [] +__sap_ha_pacemaker_cluster_constraints_location: [] +__sap_ha_pacemaker_cluster_constraints_order: [] +__sap_ha_pacemaker_cluster_extra_packages: [] +__sap_ha_pacemaker_cluster_fence_agent_packages: [] +__sap_ha_pacemaker_cluster_repos: [] +__sap_ha_pacemaker_cluster_resource_primitives: [] +__sap_ha_pacemaker_cluster_resource_groups: [] +__sap_ha_pacemaker_cluster_resource_clones: [] + # Predefine host_map for variable construction __sap_ha_pacemaker_cluster_pcmk_host_map: '' diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml index 21dd17d20..e23244431 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml @@ -3,5 +3,5 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index 9153f6591..238960267 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-aws -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - awscli __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index 160f6135d..34e9ade20 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-gce -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - resource-agents-gcp __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml index af35b0202..588f97be0 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-ibm-powervs -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml index 5430a4608..076495c61 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-ibm-vpc -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml index 2d056bf12..cf23a19a2 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-azure-arm -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - socat __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml index dfcb407fd..083622f47 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-lpar -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: From a707185e811f7240ee8b7113af49c8a7f5d930b3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 15:45:32 +0200 Subject: [PATCH 5/8] sap_ha_pacemaker_cluster: IBM Power VS adjustments --- roles/sap_ha_pacemaker_cluster/README.md | 22 ++++++++++++ .../defaults/main.yml | 1 - .../meta/argument_specs.yml | 34 ++++++++----------- .../tasks/platform/include_vars_platform.yml | 4 +-- ...egister_sysinfo_cloud_ibmcloud_powervs.yml | 19 ++++++++--- .../vars/platform_cloud_ibmcloud_powervs.yml | 8 ++--- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index fb18aff22..3e212c297 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -407,6 +407,28 @@ The default is a 2-node SAP HANA scale-up cluster.
The API key which is required to allow the control of instances (for example for fencing operations).
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
+### sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type + +- _Type:_ `string` + +IBM Power Virtual Server API Endpoint type (public or private) dependent on network interface attachments for the target instances.
+['Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.']
+ +### sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url + +- _Type:_ `string` + +IBM Power Virtual Server forward proxy url when IBM Power Virtual Server API Endpoint type is set to private.
+When public network interface, can be ignored.
+When private network interface, mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.
+ +### sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn + +- _Type:_ `string` + +IBM Power Virtual Server Workspace service cloud resource name (CRN) identifier which contains the target instances
+Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.
+ ### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `string` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index c654ab685..062c04aa3 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -293,7 +293,6 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 131a26662..eddf1b298 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -680,25 +680,21 @@ argument_specs: # Platforms: IBM Power VS on IBM Cloud specific parameters ########################################################################## -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: + description: + - IBM Power Virtual Server Workspace service cloud resource name (CRN) identifier which contains the target instances + - Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. + + sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: + description: + - IBM Power Virtual Server API Endpoint type (public or private) dependent on network interface attachments for the target instances. + - - Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. + + sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: + description: + - IBM Power Virtual Server forward proxy url when IBM Power Virtual Server API Endpoint type is set to private. + - When public network interface, can be ignored. + - When private network interface, mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. ########################################################################## diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml index f48692a74..82181c6fb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml @@ -20,10 +20,10 @@ {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs" - - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid }}" when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... @@ -31,7 +31,7 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_pcmk_host_map: |- {% for node in ansible_play_hosts_all -%} - {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmcloud_powervs_instance_id }} {%- if not loop.last %};{% endif %} {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml index c31078c72..157beee98 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml @@ -1,9 +1,20 @@ --- # Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture. -# Identify from RSCT binary instead. -- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Register instance ID" + +# The IBM Power Virtual Server Workspace GUID is different from the IBM Power Virtual Server Workspace CRN, +# and the CRN cannot be detected from inside the IBM Power Virtual Server instance +- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server Workspace GUID ansible.builtin.shell: | - /opt/rsct/bin/ctgethscid -value PartitionUUID - register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host + set -o pipefail && cat /run/cloud-init/instance-data.json | grep project_id | cut -d \" -f4 + register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_instance_id + changed_when: false + check_mode: false + +# alt command using IBM Power RSCT binary: /opt/rsct/bin/ctgethscid | grep PartitionUUID | cut -d \" -f2 +# alt command using cloud-init data: cat /run/cloud-init/instance-data.json | grep uuid | cut -d \" -f4 +- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server instance ID + ansible.builtin.shell: | + set -o pipefail && echo $(tr -d '\0' < /proc/device-tree/ibm,partition-name) + register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid changed_when: false check_mode: false diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml index 588f97be0..82e71e1c9 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -28,10 +28,10 @@ sap_ha_pacemaker_cluster_stonith_default: token: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" region: "{{ sap_ha_pacemaker_cluster_ibmcloud_region }}" crn: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn }}" - instance: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid }}" - plug: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }}" # Identified during execution initial tasks, populated when variables are imported - api-type: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type | default('private') }}" - proxy: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url }}" + instance: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid }}" # Identified during execution initial tasks, populated when variables are imported + plug: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_instance_id }}" # Identified during execution initial tasks, populated when variables are imported + api-type: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type | default('public') }}" # Dependent on network interface attachments, if no public network interface then 'private' value must be provided. + proxy: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url | default('') }}" # Dependent on network interface attachments, if no public network interface then a valid HTTP Proxy URL value must be provided. sap_ha_pacemaker_cluster_fence_options: pcmk_reboot_retries: 4 From df6d9cd1418ea6c1eee8f9ea4c9e9cd498e7094c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 17:00:40 +0200 Subject: [PATCH 6/8] sap_ha_pacemaker_cluster: minor IBM Power VS vars adjustments --- .../tasks/platform/include_vars_platform.yml | 2 +- .../platform/register_sysinfo_cloud_ibmcloud_powervs.yml | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml index 82181c6fb..2779d9d65 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml @@ -23,7 +23,7 @@ - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" - sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid }}" + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: '{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_crn | replace("::","") | regex_replace(".*\:") }}' when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml index 157beee98..63be853f6 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml @@ -1,15 +1,6 @@ --- # Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture. -# The IBM Power Virtual Server Workspace GUID is different from the IBM Power Virtual Server Workspace CRN, -# and the CRN cannot be detected from inside the IBM Power Virtual Server instance -- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server Workspace GUID - ansible.builtin.shell: | - set -o pipefail && cat /run/cloud-init/instance-data.json | grep project_id | cut -d \" -f4 - register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_instance_id - changed_when: false - check_mode: false - # alt command using IBM Power RSCT binary: /opt/rsct/bin/ctgethscid | grep PartitionUUID | cut -d \" -f2 # alt command using cloud-init data: cat /run/cloud-init/instance-data.json | grep uuid | cut -d \" -f4 - name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server instance ID From 2aace3534ebf0102c4b121691cd7ee647d6422b6 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 17:55:01 +0200 Subject: [PATCH 7/8] sap_ha_pacemaker_cluster: improved default VIP logic and removal of validated commented blocks --- .../defaults/main.yml | 1 + .../tasks/include_construct_vip_resources.yml | 8 ++--- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 31 ------------------- roles/sap_ha_pacemaker_cluster/vars/main.yml | 4 --- 4 files changed, 5 insertions(+), 39 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 062c04aa3..f3845dace 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -69,6 +69,7 @@ sap_ha_pacemaker_cluster_fence_options: # Currently there is no task for a different default VIP resource agent. # Leaving out of meta/argument_specs.yml. # Platform specific defaults are defined separately. +sap_ha_pacemaker_cluster_vip_method: ipaddr # intended internal usage, but overridable for testing sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 1007f703b..7d2d2ad03 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -40,8 +40,8 @@ loop_var: vip_list_item label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - - vip_list_item.value != '' + - sap_ha_pacemaker_cluster_vip_method == 'ipaddr' + - vip_list_item.value | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" @@ -52,8 +52,8 @@ loop_var: vip_list_item label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms - - vip_list_item.value != '' + - sap_ha_pacemaker_cluster_vip_method != 'ipaddr' + - vip_list_item.value | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 02deaebbc..f13fe361a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -135,20 +135,6 @@ - __sap_ha_pacemaker_cluster_disable_services.failed - '"Could not find the requested service" not in __sap_ha_pacemaker_cluster_disable_services.msg' -# # Before we are ready to call the ha_cluster role, we want to validate -# # that the minimum required parameters are defined and not empty. -# # TODO: make this smarter, currently all these vars are pre-defined anyway -# - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" -# ansible.builtin.assert: -# that: -# - __sap_ha_pacemaker_cluster_cluster_properties is defined -# - __sap_ha_pacemaker_cluster_extra_packages is defined -# - __sap_ha_pacemaker_cluster_resource_primitives is defined -# - __sap_ha_pacemaker_cluster_resource_clones is defined -# - __sap_ha_pacemaker_cluster_constraints_order is defined -# - __sap_ha_pacemaker_cluster_constraints_colocation is defined -# fail_msg: "Cluster build parameter construction has failed for this parameter." - - name: "SAP HA Install Pacemaker - Query if CIB already exists" ansible.builtin.command: cmd: cibadmin --query @@ -177,23 +163,6 @@ apply: tags: ha_cluster no_log: true # some parameters contain secrets - no_log: true # some parameters contain secrets -# -# Remove hard-coded parameters and set 'ha_cluster' LSR parameters in this play right -# before the 'ha_cluster' role is included. -# vars: -# __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" -# ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" -# ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" -# ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" -# ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" -# ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" -# ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" -# ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" -# ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" -# ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" -# ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" -# ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" tags: ha_cluster # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 1590917a3..5ad6c4503 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -35,10 +35,6 @@ __sap_ha_pacemaker_cluster_nic_multi_bool: false # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' -# -__sap_ha_pacemaker_cluster_supported_platforms: - - cloud_aws_ec2_vs - - cloud_msazure_vm # ATTENTION: # Any variables for 'ha_cluster' which this SAP role supports/inherits should also From 621bad64c8a9bd5f2f7035d0e1ae911c736b206f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 18:15:33 +0200 Subject: [PATCH 8/8] sap_ha_pacemaker_cluster: move var and comment out PowerVM include --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 1 - .../tasks/platform/ascertain_platform_type.yml | 12 ++++++------ roles/sap_ha_pacemaker_cluster/vars/main.yml | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index f3845dace..062c04aa3 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -69,7 +69,6 @@ sap_ha_pacemaker_cluster_fence_options: # Currently there is no task for a different default VIP resource agent. # Leaving out of meta/argument_specs.yml. # Platform specific defaults are defined separately. -sap_ha_pacemaker_cluster_vip_method: ipaddr # intended internal usage, but overridable for testing sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml index 26715c375..a12ee9c30 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml @@ -98,12 +98,12 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_powervs -#- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVC" -# when: -# - ansible_architecture == "ppc64le" -# - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVM" + when: + - ansible_architecture == "ppc64le" + - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm #- name: "SAP HA Prepare Pacemaker - Check if platform is VMware vSphere" # when: diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 5ad6c4503..22384d3de 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -31,6 +31,9 @@ __sap_ha_pacemaker_cluster_required_facts: # This is automatically adjusted during preparation tasks. __sap_ha_pacemaker_cluster_nic_multi_bool: false +# By default use the construction of IPaddr2 VIP resources. +# Platforms define different methods as applicable. +sap_ha_pacemaker_cluster_vip_method: ipaddr # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: ''