Skip to content

Commit

Permalink
Enable native fencing for GCP
Browse files Browse the repository at this point in the history
  • Loading branch information
BillAnastasiadis committed Sep 6, 2024
1 parent 83a0360 commit 123a69a
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 2 deletions.
59 changes: 58 additions & 1 deletion ansible/playbooks/tasks/cluster-bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,14 @@
params tag={{ aws_stonith_tag}} pcmk_delay_max=15
when: cloud_platform_is_aws

- name: Set primary and secondary hostnames
set_fact:
primary_hostname: "{{ groups['hana'][0] }}"
secondary_hostname: "{{ groups['hana'][1] }}"
when:
- cloud_platform_is_gcp
- not (use_sbd | bool)

- name: Enable SBD [sbd]
ansible.builtin.command:
cmd: crm configure primitive rsc_iscsi_sbd stonith:external/sbd
Expand All @@ -252,7 +260,6 @@
failed_when: >
stonith_config_result.stderr_lines | select("match", "ERROR") | reject("match", "ERROR: warning") | list | length > 0
- name: Configure AWS EC2 STONITH for sle 15
ansible.builtin.command: "{{ aws_stonith_cmd }}"
when:
Expand All @@ -263,6 +270,56 @@
register: stonith_config_result
failed_when: "'ERROR' in stonith_config_result.stderr"

# Thee following STONITH commands for GCP have been adapted from
# https://cloud.google.com/solutions/sap/docs/sap-hana-ha-config-sles
- name: Configure GCP Native Fencing STONITH for Primary
ansible.builtin.command: >
crm configure primitive rsc_gce_stonith_primary stonith:fence_gce
params
port="{{ primary_hostname }}"
zone="{{ primary_zone }}"
project="{{ project }}"
op monitor interval="300s" timeout="120s"
op start interval="0" timeout="60s"
meta target-role=Started
when:
- cloud_platform_is_gcp
- is_primary
- not (use_sbd | bool)

- name: Configure GCP Native Fencing STONITH for Secondary
ansible.builtin.command: >
crm configure primitive rsc_gce_stonith_secondary stonith:fence_gce
params
port="{{ secondary_hostname }}"
zone="{{ secondary_zone }}"
project="{{ project }}"
op monitor interval="300s" timeout="120s"
op start interval="0" timeout="60s"
meta target-role=Started
when:
- cloud_platform_is_gcp
- is_primary
- not (use_sbd | bool)

- name: Set Location of Primary Fencing Device (GCP)
ansible.builtin.command: >
crm configure location LOC_STONITH_{{ primary_hostname }} \
rsc_gce_stonith_primary -inf: "{{ primary_hostname }}"
when:
- cloud_platform_is_gcp
- is_primary
- not (use_sbd | bool)

- name: Set Location of Secondary Fencing Device (GCP)
ansible.builtin.command: >
crm configure location LOC_STONITH_{{ secondary_hostname }} \
rsc_gce_stonith_secondary -inf: "{{ secondary_hostname }}"
when:
- cloud_platform_is_gcp
- is_primary
- not (use_sbd | bool)

- name: Set stonith-timeout [sdb]
ansible.builtin.command:
cmd: crm configure property stonith-timeout=144
Expand Down
3 changes: 3 additions & 0 deletions terraform/gcp/inventory.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ all:
use_sbd: ${use_sbd}
gcp_cluster_ip: ${hana-vip}
prefix: ${name_prefix}
project: ${gcp_project}
primary_zone: ${gcp_primary_zone}
secondary_zone: ${gcp_secondary_zone}
children:
hana:
hosts:
Expand Down
5 changes: 4 additions & 1 deletion terraform/gcp/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ resource "local_file" "ansible_inventory" {
iscsi_name = module.iscsi_server.iscsisrv_name,
iscsi_pip = module.iscsi_server.iscsisrv_public_ip,
iscsi_enabled = local.iscsi_enabled,
iscsi_remote_python = var.iscsi_remote_python
iscsi_remote_python = var.iscsi_remote_python,
gcp_project = var.project,
gcp_primary_zone = element(local.compute_zones, 0),
gcp_secondary_zone = element(local.compute_zones, 1),
use_sbd = local.use_sbd
name_prefix = local.deployment_name,
})
Expand Down

0 comments on commit 123a69a

Please sign in to comment.