From 0f212872ff8dbd833f8b28f1efdf48d59f49ac67 Mon Sep 17 00:00:00 2001 From: Michele Pagot Date: Wed, 20 Dec 2023 09:35:21 +0100 Subject: [PATCH] Remove hardcoded HANA installer parameters Remove hardcoded parameters from sap-hana-system-replication-hooks --- .../sap-hana-system-replication-hooks.yaml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ansible/playbooks/sap-hana-system-replication-hooks.yaml b/ansible/playbooks/sap-hana-system-replication-hooks.yaml index 40647d4f..162cfb62 100644 --- a/ansible/playbooks/sap-hana-system-replication-hooks.yaml +++ b/ansible/playbooks/sap-hana-system-replication-hooks.yaml @@ -11,8 +11,6 @@ vars: is_primary: "{{ ansible_play_hosts[0] == inventory_hostname }}" hooks_dir: myHooks - sap_hana_install_sid: HDB - sap_hana_install_instance_number: 00 hana_status: unknown handlers: @@ -28,6 +26,19 @@ when: not is_primary tasks: + + - name: Assert that required variables are defined + ansible.builtin.assert: + that: "{{ item }} is defined" + fail_msg: >- + The required variable '{{ item }}' is not defined. This variable must be + defined when using this role. + success_msg: >- + The variable '{{ item }}' is defined. + loop: + - 'sap_hana_install_sid' + - 'sap_hana_install_instance_number' + - name: Ensure hooks directory exists ansible.builtin.file: path: "/hana/shared/{{ hooks_dir }}" @@ -53,7 +64,7 @@ block: - name: Ensure ha_dr_provider_SAPHanaSR section exists in global.ini community.general.ini_file: - path: /usr/sap/HDB/SYS/global/hdb/custom/config/global.ini + path: /usr/sap/{{ sap_hana_install_sid }}/SYS/global/hdb/custom/config/global.ini section: "{{ item.section }}" option: "{{ item.key }}" value: "{{ item.value }}"