diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index a95e171b8..c4bdd5f66 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -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: @@ -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 @@ -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 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 8e545c36b..26715c375 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 @@ -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: @@ -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 }}" 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 6a1ad95f8..f48692a74 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 @@ -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: :;:... +- 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: :;:... - name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Assemble host mapping" ansible.builtin.set_fact: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml new file mode 100644 index 000000000..f703571ec --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml @@ -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 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 806d5eb42..dfcb407fd 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 @@ -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