Skip to content

Commit

Permalink
Refactor SAP HANA SR hook validations, add SAP HANA-SR ANGI validatio…
Browse files Browse the repository at this point in the history
…ns, and adjust global.ini configuration
  • Loading branch information
hdamecharla committed Nov 12, 2024
1 parent 2c28f53 commit b48e22f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@
- suschk_hook_check is success
- ansible_os_family | upper == "SUSE"

- name: "5.5 HANA Pacemaker - Create sudoers file for /etc/sudoers.d/20-saphana for SLES"
ansible.builtin.template:
src: "20-saphana-suse.j2"
dest: "/etc/sudoers.d/20-saphana"
mode: "0440"
owner: root
group: root

- name: "5.5 HANA Pacemaker - Start HANA System on both nodes"
become_user: "{{ db_sid | lower }}adm"
become: true
Expand Down Expand Up @@ -302,20 +310,39 @@
2. SAPHanaSR-angi Python Hook: {{ 'PASSED' if angi_hook_check is success else 'FAILED' }}
3. susChkSrv Python Hook: {{ 'PASSED' if suschk_hook_check is success else 'FAILED' }}
- name: "HANA HSR: - Check HANA DB Version and register"
become_user: "{{ db_sid | lower }}adm"
become: true
ansible.builtin.command: /hana/shared/{{ db_sid | upper }}/HDB{{ db_instance_number }}/HDB version
register: hdb_version_output
changed_when: false
# Note: The hook code updates automatically through OS updates or package updates.
# If you point parameter path to the default /usr/share/SAPHanaSR-angi location,
# the Python hook code updates automatically through OS updates or package updates.
# HANA uses the hook code updates when it next restarts. With an optional own path
# like /hana/shared/myHooks, you can decouple OS updates from the hook version that you use
- name: "5.5 HANA Pacemaker - Adjust global.ini on each cluster node"
ansible.builtin.blockinfile:
path: /hana/shared/{{ db_sid | upper }}/global/hdb/custom/config/global.ini
block: |
[ha_dr_provider_sushanasr]
provider = susHanaSR
path = /usr/share/SAPHanaSR-angi
execution_order = 1
[ha_dr_provider_suschksrv]
provider = susChkSrv
path = /usr/share/SAPHanaSR-angi
execution_order = 3
action_on_lost = fence
- name: "Extract SAP HANA version number"
ansible.builtin.set_fact:
hana_version_str: "{{ hdb_version_output.stdout | regex_search('version:\\s+([\\d\\.]+)', '\\1') | first }}"
[trace]
ha_dr_sushanasr = info
ha_dr_saphanasr = info
when:
- suschk_hook_check is success
- ansible_os_family | upper == "SUSE"

- name: "5.5 HANA Pacemaker - Create sudoers file for /etc/sudoers.d/20-saphana for SLES"
ansible.builtin.template:
src: "20-saphana-suse.j2"
dest: "/etc/sudoers.d/20-saphana"
mode: "0440"
owner: root
group: root

- name: "Assert SAP HANA version is greater than SAP HANA 2.0 SP5"
ansible.builtin.assert:
that:
- hana_version_str is version('2.00.050', '>=')
fail_msg: "Installed HANA version is not greater than SAP HANA 2.0 SP5"
# End of configuration for SAPHanaSR python hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Needed for susHanaSR and susChkSrv Python hooks
Cmnd_Alias SOK_SITEA = /usr/sbin/crm_attribute -n hana_{{ db_sid | lower }}_site_srHook_<siteA> -v SOK -t crm_config -s SAPHanaSR
Cmnd_Alias SFAIL_SITEA = /usr/sbin/crm_attribute -n hana_{{ db_sid | lower }}_site_srHook_<siteA> -v SFAIL -t crm_config -s SAPHanaSR
Cmnd_Alias SOK_SITEB = /usr/sbin/crm_attribute -n hana_{{ db_sid | lower }}_site_srHook_<siteB> -v SOK -t crm_config -s SAPHanaSR
Cmnd_Alias SFAIL_SITEB = /usr/sbin/crm_attribute -n hana_{{ db_sid | lower }}_site_srHook_<siteB> -v SFAIL -t crm_config -s SAPHanaSR
Cmnd_Alias HELPER_TAKEOVER = /usr/bin/SAPHanaSR-hookHelper --sid={{ db_sid | upper }} --case=checkTakeover
Cmnd_Alias HELPER_FENCE = /usr/bin/SAPHanaSR-hookHelper --sid={{ db_sid | upper }} --case=fenceMe

{{ db_sid | lower }}adm ALL=(ALL) NOPASSWD: SOK_SITEA, SFAIL_SITEA, SOK_SITEB, SFAIL_SITEB, HELPER_TAKEOVER, HELPER_FENCE

0 comments on commit b48e22f

Please sign in to comment.