-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sap_ha_pacemaker_cluster: enh: SAP HAlib configuration
- new: cluster command definition for RHEL and SLES - new: SAP HAlib components defined for RHEL and SLES - file rename: added ASCS/ERS words to postinstallation file name for clarity
- Loading branch information
Showing
11 changed files
with
255 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 200 additions & 0 deletions
200
roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
--- | ||
# After NetWeaver ASCS/ERS instances were configured in the cluster, | ||
# they must be disabled from automatically (re)starting outside of | ||
# cluster control. | ||
|
||
- name: "SAP HA Pacemaker - (ASCS profile) Prevent automatic restart of enqueue server" | ||
ansible.builtin.replace: | ||
path: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string }}" | ||
backup: true | ||
regexp: 'Restart_Program_01' | ||
replace: 'Start_Program_01' | ||
|
||
- name: "SAP HA Pacemaker - (ERS profile) Prevent automatic restart" | ||
ansible.builtin.replace: | ||
path: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" | ||
backup: true | ||
regexp: 'Restart_Program_00' | ||
replace: 'Start_Program_00' | ||
|
||
# Comment out lines in /usr/sap/sapservices, which | ||
# - contain the target instance profile names | ||
# - are not commented out yet | ||
- name: "SAP HA Pacemaker - Update /usr/sap/sapservices" | ||
ansible.builtin.replace: | ||
path: /usr/sap/sapservices | ||
backup: true | ||
regexp: '^([^#\n].+{{ sapserv_item }}.+)$' | ||
replace: '# \1' | ||
loop: | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name }}" | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" | ||
loop_control: | ||
loop_var: sapserv_item | ||
|
||
- name: "SAP HA Pacemaker - (systemd) Check for ASCS/ERS services" | ||
ansible.builtin.stat: | ||
path: "/etc/systemd/system/SAP{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ systemd_item }}.service" | ||
loop: | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" | ||
loop_control: | ||
loop_var: systemd_item | ||
label: "SAP{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ systemd_item }}.service" | ||
register: __sap_ha_pacemaker_cluster_register_instance_service | ||
|
||
- name: "SAP HA Pacemaker - (systemd) Save found ASCS/ERS services" | ||
ansible.builtin.set_fact: | ||
sap_ha_pacemaker_cluster_instance_services_fact: "{{ | ||
__sap_ha_pacemaker_cluster_register_instance_service.results | ||
| selectattr('stat.exists') | ||
| map(attribute='stat.path') | ||
| regex_replace('/etc/systemd/system/', '') | ||
}}" | ||
|
||
# BLOCK: | ||
# When the systemd based SAP startup framework is used, make sure that the | ||
# instance services do not auto-start. | ||
- name: "SAP HA Pacemaker - Block to disable systemd auto-start of instances" | ||
when: | ||
- sap_ha_pacemaker_cluster_instance_services_fact is defined | ||
- sap_ha_pacemaker_cluster_instance_services_fact | length > 0 | ||
block: | ||
|
||
- name: "SAP HA Pacemaker - (systemd) Disable ASCS/ERS instance service" | ||
ansible.builtin.service: | ||
name: "{{ instance_srv_item }}" | ||
enabled: false | ||
loop: "{{ sap_ha_pacemaker_cluster_instance_services_fact }}" | ||
loop_control: | ||
loop_var: instance_srv_item | ||
|
||
# Creates a config file for the services. | ||
# Parent directories will be created when missing. | ||
- name: "SAP HA Pacemaker - (systemd) Create ASCS/ERS instance unit config file" | ||
ansible.builtin.lineinfile: | ||
create: true | ||
path: "/etc/systemd/system/{{ dropfile_item }}.d/HA.conf" | ||
line: "[Service]" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
loop: "{{ sap_ha_pacemaker_cluster_instance_services_fact }}" | ||
loop_control: | ||
loop_var: dropfile_item | ||
|
||
- name: "SAP HA Pacemaker - (systemd) Disable ASCS/ERS instance unit auto-restart" | ||
ansible.builtin.lineinfile: | ||
path: "/etc/systemd/system/{{ dropfile_item }}.d/HA.conf" | ||
regex: '^Restart\s*=\s*no' | ||
insertafter: '^[Service]$' | ||
line: "Restart=no" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
loop: "{{ sap_ha_pacemaker_cluster_instance_services_fact }}" | ||
loop_control: | ||
loop_var: dropfile_item | ||
|
||
### END of BLOCK for systemd setup. | ||
|
||
|
||
# Block for configuring the SAP HA Interface (sap_cluster_connector). | ||
# | ||
# The 'sap-cluster-connector' package is already optionally added to | ||
# '__sap_ha_pacemaker_cluster_sap_extra_packages'. | ||
- name: "SAP HA Pacemaker - (SAP HAlib) Configure SAP HA Interface" | ||
when: | ||
- sap_ha_pacemaker_cluster_enable_cluster_connector | ||
block: | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Add {{sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm user to 'haclient' group" | ||
ansible.builtin.user: | ||
name: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
groups: haclient | ||
append: true | ||
state: present | ||
|
||
# Using 'lineinfile' with a nested loop to avoid duplicate entries for existing configuration. | ||
- name: "SAP HA Pacemaker - (SAP HAlib) Add connector to start profiles" | ||
ansible.builtin.lineinfile: | ||
backup: true | ||
path: "{{ nwas_profile_item.0 }}" | ||
line: "{{ nwas_profile_item.1 }}" | ||
loop: "{{ __sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_profile_paths | ||
| product(__sap_ha_pacemaker_cluster_connector_config_lines) | ||
}}" | ||
loop_control: | ||
loop_var: nwas_profile_item | ||
label: "{{ nwas_profile_item.0 }} -> {{ nwas_profile_item.1 }}" | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Check where ASCS is running" | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_where_ascs | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }} -function GetProcessList | ||
changed_when: false | ||
failed_when: false | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Check where ERS is running" | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_where_ers | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }} -function GetProcessList | ||
changed_when: false | ||
failed_when: false | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Restart the ASCS service" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_restart_ascs | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }} -function RestartService | ||
changed_when: __sap_ha_pacemaker_cluster_register_restart_ascs.rc == 0 | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Restart the ERS service" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_restart_ers | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }} -function RestartService | ||
changed_when: __sap_ha_pacemaker_cluster_register_restart_ers.rc == 0 | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Run HA check for ASCS" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_ascs_ha | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }} -function HACheckConfig | ||
changed_when: false | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Run HA check for ERS" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 | ||
become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" | ||
register: __sap_ha_pacemaker_cluster_register_ers_ha | ||
ansible.builtin.shell: | | ||
/usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }} -function HACheckConfig | ||
changed_when: false | ||
|
||
- name: "SAP HA Pacemaker - (SAP HAlib) Display HA check results for ASCS" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 | ||
ansible.builtin.debug: | ||
msg: | | ||
{{ __sap_ha_pacemaker_cluster_register_ascs_ha.stdout }} | ||
- name: "SAP HA Pacemaker - (SAP HAlib) Display HA check results for ERS" | ||
when: | ||
- __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 | ||
ansible.builtin.debug: | ||
msg: | | ||
{{ __sap_ha_pacemaker_cluster_register_ers_ha.stdout }} | ||
# TODO: verification checks that the instances are running and HAlib is enabled | ||
|
||
### END of BLOCK for sap_cluster_connector. |
97 changes: 0 additions & 97 deletions
97
roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
--- | ||
#sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" | ||
|
||
# List of ASCS/ERS profile names. | ||
# Used in tasks/configure_netweaver_postinstallation.yml for sap_cluster_connector setup. | ||
__sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_profile_paths: | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string }}" | ||
- "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.