Skip to content

Commit

Permalink
Merge pull request #456 from sean-freeman/powervm_ha
Browse files Browse the repository at this point in the history
sap_ha_pacemaker_cluster: fix ibm powervm stonith
  • Loading branch information
ja9fuchs authored Sep 19, 2023
2 parents ba872db + 8e17253 commit 1e177de
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 18 deletions.
9 changes: 8 additions & 1 deletion roles/sap_ha_pacemaker_cluster/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool:
################################################################################
# Platform specific
################################################################################
sap_ha_pacemaker_cluster_aws_vip_update_rt: []

## A custom stonith definition that takes precedence over platform defaults.
# sap_ha_pacemaker_cluster_stonith_custom:
Expand All @@ -225,6 +224,7 @@ sap_ha_pacemaker_cluster_cluster_properties:
## 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_access_key_id
# sap_ha_pacemaker_cluster_aws_secret_access_key
# sap_ha_pacemaker_cluster_aws_region
Expand All @@ -245,6 +245,13 @@ sap_ha_pacemaker_cluster_cluster_properties:
# 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
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,6 @@
# ansible.builtin.set_fact:
# __sap_ha_pacemaker_cluster_platform: hyp_vmware_vsphere_vm

# Call tasks to discover information that is needed as input for any further steps.
# Run this before including the platform vars in order to build vars based on the
# discovered data.
- name: "SAP HA Prepare Pacemaker - Include platform specific information collection"
when: __sap_ha_pacemaker_cluster_platform_info is file
ansible.builtin.include_tasks:
file: "{{ item }}"
loop:
- "register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml"
vars:
__sap_ha_pacemaker_cluster_platform_info: "{{ role_path }}/tasks/{{ item }}"

- name: "SAP HA Prepare Pacemaker - Include platform specific tasks - MS Azure VM - Ensure socat binary installed"
ansible.builtin.package:
name:
Expand All @@ -138,6 +126,6 @@
ansible.builtin.include_tasks:
file: "{{ item }}"
loop:
- "register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml"
- "platform/register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml"
vars:
__sap_ha_pacemaker_cluster_platform_info: "{{ role_path }}/tasks/{{ item }}"
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,24 @@
when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs"


- name: "SAP HA Prepare Pacemaker - IBM PowerVM - Set variable for fencing agent"
ansible.builtin.set_fact:
sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_partition_name: "{{ __sap_ha_pacemaker_cluster_register_ibmpower_vm_hmc_system_partition_name.stdout }}"
sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_host_mtms: "{{ __sap_ha_pacemaker_cluster_register_ibmpower_vm_hmc_system_host_mtms_gui_string.stdout }}"

when: __sap_ha_pacemaker_cluster_platform == "hyp_ibmpower_vm"

# pcmk_host_map format: <hostname1>:<host1-id>;<hostname2>:<host2-id>...
- name: "SAP HA Prepare Pacemaker - IBM PowerVM - Assemble host mapping"
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_ibmpower_vm_hmc_system_partition_name }}
{%- if not loop.last %};{% endif %}
{% endfor %}
when: __sap_ha_pacemaker_cluster_platform == "hyp_ibmpower_vm"


# pcmk_host_map format: <hostname1>:<host1-id>;<hostname2>:<host2-id>...
- name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Assemble host mapping"
ansible.builtin.set_fact:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture.
# Use Open Firmware (OF) device tree values

# Do not use cat on /proc files to avoid error 'ignored null byte in input'


# The System's Machine Type and Machine Serial Number (MTMS) is a combined string, which is sometimes separated by underscore '_'
# and in IBM Power HMC Web GUI is separated by asterisk '*'
# An example of the combined string is '9009-22A' as Machine Type + '*' + '11A111' as Machine Serial Number
# This is an alternative value to populate --managed instead of the IBM PowerVM HMC System Name,
# which works with the command 'lssyscfg -r lpar -m <<--managed value of HMC System Name or System MTMS or System UUID>>
- name: SAP HA Prepare Pacemaker - IBM Power VM - HMC System (aka. Hypervisor Node) Machine Type and Machine Serial Number (MTMS)
ansible.builtin.shell: |
set -o pipefail && echo $(tr -d '\0' < /proc/device-tree/model | sed 's/IBM,//g')*$(tr -d '\0' < /proc/device-tree/ibm,hardware-sn)
register: __sap_ha_pacemaker_cluster_register_ibmpower_vm_hmc_system_host_mtms_gui_string
changed_when: false
check_mode: false

- name: SAP HA Prepare Pacemaker - IBM Power VM - HMC System's Partition Name of the Virtual Machine
ansible.builtin.shell: |
set -o pipefail && echo $(tr -d '\0' < /proc/device-tree/ibm,partition-name)
register: __sap_ha_pacemaker_cluster_register_ibmpower_vm_hmc_system_partition_name
changed_when: false
check_mode: false

- name: SAP HA Prepare Pacemaker - IBM Power VM - HMC System's Partition UUID of the Virtual Machine
ansible.builtin.shell: |
set -o pipefail && echo $(tr -d '\0' < /proc/device-tree/ibm,partition-uuid)
register: __sap_ha_pacemaker_cluster_register_ibmpower_vm_hmc_system_partition_uuid
changed_when: false
check_mode: false
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ sap_ha_pacemaker_cluster_stonith_default:
id: "res_fence_lpar"
agent: "stonith:fence_lpar"
options:
ipaddr: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host }}"
ip: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host }}"
ipport: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_port }}"
login: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login }}"
username: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login }}"
password: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login_password }}"
hmc_version: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_version | default('4') }}"
plug: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_uuid }}"

managed: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_host_mtms }}" # Identified during execution initial tasks, populated when variables are imported
#plug: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_system_partition_name }}" # Unnecessary when using pcmk_host_map. Identified during execution initial tasks, populated when variables are imported

sap_ha_pacemaker_cluster_fence_options:
pcmk_reboot_retries: 4
Expand Down

0 comments on commit 1e177de

Please sign in to comment.