Skip to content

Commit

Permalink
sap_ha_pacemaker_cluster: fix ibm powervm stonith
Browse files Browse the repository at this point in the history
  • Loading branch information
sean-freeman committed Sep 18, 2023
1 parent ba872db commit 6ace923
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 13 deletions.
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,30 @@
---
# 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, for example '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

0 comments on commit 6ace923

Please sign in to comment.