From 59b5cda2da3d7f82f7d6a142a7f59a905c635fe5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sun, 6 Aug 2023 21:21:45 +0200 Subject: [PATCH 001/179] sap_install_media_detect: Implement remote_dir while still using the previous file type detection method. The mechanism is as follows: If the variable 'sap_install_media_detect_target_directory' is definied and if this directory is writable, then the variable sap_install_media_detect_source is set to 'remote_dir', and this directory is used for copying and extracting files and also for moving the files as the last step. In all cases, as the first step, we create the required destination directories on the local, writable file system. Then we are creating a list of files for the product by checking the source directory. In case of remote_dir, we are then copying the identified files to the local directory. All remaining steps (extracting, moving and populating the final list of files) are done on the local directory. --- .../tasks/detect_backup_saphana.yml | 20 ++++++++ .../tasks/detect_export_sapbw4hana.yml | 26 +++++++++-- .../tasks/detect_export_sapecc.yml | 43 ++++++++--------- .../tasks/detect_export_sapecc_ides.yml | 43 ++++++++--------- .../tasks/detect_export_sapnwas_abap.yml | 41 +++++++++-------- .../tasks/detect_export_sapnwas_java.yml | 43 ++++++++--------- .../tasks/detect_export_saps4hana.yml | 26 +++++++++-- .../tasks/detect_export_sapsolman_abap.yml | 37 ++++++++------- .../tasks/detect_sapanydb_ibmdb2.yml | 37 +++++++++------ .../tasks/detect_sapanydb_oracledb.yml | 28 +++++++---- .../tasks/detect_sapanydb_sapase.yml | 38 +++++++++++---- .../tasks/detect_sapanydb_sapmaxdb.yml | 25 ++++++---- .../tasks/detect_sapcar.yml | 9 +++- .../tasks/detect_saphana.yml | 23 +++++++--- .../tasks/detect_saphostagent.yml | 13 ++++-- .../tasks/detect_sapigs.yml | 22 +++++++-- .../tasks/detect_sapkernel.yml | 22 +++++++-- .../tasks/detect_sapswpm.yml | 46 ++++--------------- .../tasks/detect_sapwebdisp.yml | 16 ++++++- .../tasks/prepare/check_directories.yml | 10 +++- 20 files changed, 363 insertions(+), 205 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml b/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml index fa7c90219..c081d48db 100644 --- a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml @@ -1,6 +1,26 @@ --- - name: Identify SAP HANA Backup files + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" + recurse: true + file_type: directory + patterns: '.*COMPLETE.*' + use_regex: true + register: backup_saphana_find_dir_source + +- name: SAP Install Media Detect - SAP HANA Backup files - Copy files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ line_item.path }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ backup_saphana_find_dir_source.files }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + +- name: Re-identify SAP HANA Backup files ansible.builtin.find: paths: "{{ sap_install_media_detect_backup_directory }}" recurse: true diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml index 8695a57c0..3c931aaed 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml @@ -12,15 +12,33 @@ - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}" + paths: "{{ sap_install_media_detect_source_directory }}" + recurse: true + file_type: file + patterns: '.*BW4.*EXPORT.*' + use_regex: true + register: bw4hana_export_files_source + +- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ line_item.path }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ bw4hana_export_files_source.files }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + +- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Re-identify SAP BW/4HANA EXPORT files + ansible.builtin.find: + paths: "{{ sap_install_media_detect_target_directory }}" recurse: true file_type: file patterns: '.*BW4.*EXPORT.*' use_regex: true register: bw4hana_export_files -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Local Directory source - move SAP BW/4HANA EXPORT files +- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Move SAP BW/4HANA EXPORT files ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/sapbw4hana_export/{{ item.path | basename }}" with_items: "{{ bw4hana_export_files.files }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 63350993c..a7cb1dd04 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP ECC EXPORT - Create Directories +- name: SAP Install Media Detect - SAP ECC EXPORT - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/" - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" -- name: SAP Install Media Detect - SAP ECC EXPORT - List files in directory +- name: SAP Install Media Detect - SAP ECC EXPORT - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -46,7 +46,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -68,7 +68,18 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP ECC EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when @@ -101,16 +112,14 @@ use_regex: true register: detect_directory_export_extracted -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-list files in directory +- name: SAP Install Media Detect - SAP ECC EXPORT - Re-list files in directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP ECC EXPORT - Re-detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" @@ -119,10 +128,8 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP ECC EXPORT - Re-detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" @@ -131,11 +138,9 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-identify SAP ECC EXPORT files # noqa risky-shell-pipe +- name: SAP Install Media Detect - SAP ECC EXPORT - Re-identify SAP ECC EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then @@ -153,12 +158,8 @@ - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - move SAP ECC EXPORT compressed archive files +- name: SAP Install Media Detect - SAP ECC EXPORT - Move SAP ECC EXPORT compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 9279586bf..521813754 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Create Directories +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/" - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in directory +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -46,7 +46,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -68,7 +68,18 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when @@ -101,16 +112,14 @@ use_regex: true register: detect_directory_export_extracted -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-list files in directory +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-list files in directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" @@ -119,10 +128,8 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" @@ -131,11 +138,9 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]'; then @@ -153,12 +158,8 @@ - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - move SAP ECC IDES EXPORT compressed archive files +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Move SAP ECC IDES EXPORT compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index f9ba5a410..3942e55e6 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in directory +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: no @@ -46,7 +46,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: no @@ -68,7 +68,18 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when @@ -101,16 +112,14 @@ use_regex: true register: detect_directory_export_extracted -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-list files in directory +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-list files in directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" @@ -119,10 +128,8 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" @@ -131,11 +138,9 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP'; then @@ -153,12 +158,8 @@ - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - move EXPORT compressed archive files +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Move EXPORT compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index 141681a35..717a28eea 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Create Directories +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/" - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in directory +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -46,7 +46,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -68,7 +68,18 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) # noqa no-changed-when @@ -101,16 +112,14 @@ use_regex: true register: detect_directory_export_extracted -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-list files in directory +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-list files in directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" @@ -119,10 +128,8 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" @@ -131,11 +138,9 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then @@ -153,12 +158,8 @@ - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - move EXPORT compressed archive files +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - move EXPORT compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_java_export_repeated.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml index a427327bc..d862d5424 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml @@ -12,15 +12,33 @@ - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Identify SAP S/4HANA EXPORT files ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}" + paths: "{{ sap_install_media_detect_source_directory }}" + recurse: true + file_type: file + patterns: '.*S4.*EXPORT.*' + use_regex: true + register: s4hana_export_files_source + +- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ line_item.path }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ s4hana_export_files_source.files }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + +- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Re-Identify SAP S/4HANA EXPORT files + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" recurse: true file_type: file patterns: '.*S4.*EXPORT.*' use_regex: true register: s4hana_export_files -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Local Directory source - move SAP S/4HANA EXPORT files +- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Move SAP S/4HANA EXPORT files ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/saps4hana_export/{{ item.path | basename }}" with_items: "{{ s4hana_export_files.files }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index 7d88dae0d..52e7d200d 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Create Directories +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" - "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in directory +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -49,7 +49,18 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when @@ -71,16 +82,14 @@ use_regex: true register: detect_directory_export_extracted -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-list files in directory +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-list files in directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" @@ -89,11 +98,9 @@ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true - when: - - sap_install_media_detect_source == "local_dir" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-identify EXPORT files # noqa risky-shell-pipe +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated @@ -102,12 +109,8 @@ - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: - - sap_install_media_detect_source == "local_dir" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - move EXPORT compressed archive files +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Move EXPORT compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 3f5d54fe1..e731eb0f3 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -36,7 +36,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - IBM Db2 - Create Directories +- name: SAP Install Media Detect - IBM Db2 - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -49,11 +49,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" -- name: SAP Install Media Detect - IBM Db2 - List files in directory +- name: SAP Install Media Detect - IBM Db2 - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - IBM Db2 - Detect ZIP files (including no file extensions), ignore errors @@ -62,7 +62,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -75,7 +75,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media # noqa risky-shell-pipe @@ -86,7 +86,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file # noqa risky-shell-pipe @@ -97,10 +97,23 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - IBM Db2 - Copy IBM Db2 files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" + - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" + - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media # noqa no-changed-when +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 installation media # noqa no-changed-when ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" @@ -111,7 +124,7 @@ sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media # noqa no-changed-when +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 Client installation media # noqa no-changed-when ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" @@ -122,7 +135,7 @@ sap_install_media_detect_skip_extraction_if_target_dir_exists) # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file # noqa no-changed-when +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 OEM license file # noqa no-changed-when ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" @@ -150,11 +163,9 @@ use_regex: true register: detect_directory_ibmdb2_client_extracted -- name: SAP Install Media Detect - IBM Db2 - Local Directory source - move IBM Db2 compressed archive files +- name: SAP Install Media Detect - IBM Db2 - Move IBM Db2 compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2/{{ item }}" with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 55ace690f..3d79150ad 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -24,7 +24,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - Oracle DB - Create Directories +- name: SAP Install Media Detect - Oracle DB - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -36,11 +36,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" -- name: SAP Install Media Detect - Oracle DB - List files in directory +- name: SAP Install Media Detect - Oracle DB - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - Oracle DB - Detect ZIP files (including no file extensions), ignore errors @@ -49,7 +49,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -62,7 +62,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" # Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media # noqa risky-shell-pipe @@ -73,7 +73,19 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - Oracle DB - Copy Oracle DB files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" + - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media # noqa no-changed-when @@ -115,10 +127,8 @@ use_regex: true register: detect_directory_oracledb_client_extracted -- name: SAP Install Media Detect - Oracle DB - Local Directory source - move Oracle DB compressed archive files +- name: SAP Install Media Detect - Oracle DB - Move Oracle DB compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/oracledb/{{ item }}" with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index 7ffb0825c..9e0809953 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP ASE - Create Directories +- name: SAP Install Media Detect - SAP ASE - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -24,11 +24,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" - "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted/" -- name: SAP Install Media Detect - SAP ASE - List files in directory +- name: SAP Install Media Detect - SAP ASE - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ASE - Detect ZIP files (including no file extensions), ignore errors @@ -37,7 +37,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -50,17 +50,39 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP ASE - Copy SAP ASE files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client installation media ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}" + paths: "{{ sap_install_media_detect_source_directory }}" recurse: true file_type: file patterns: '.*ASEBC.*' use_regex: true register: detect_directory_files_sapase_client +- name: SAP Install Media Detect - SAP ASE - Copy SAP ASE files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ line_item.path }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ detect_directory_files_sapase_client.files }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media # noqa no-changed-when ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/{{ item }}_extracted; fi @@ -102,9 +124,7 @@ use_regex: true register: detect_directory_sapase_client_extracted -- name: SAP Install Media Detect - SAP ASE - Local Directory source - move SAP ASE compressed archive files +- name: SAP Install Media Detect - SAP ASE - Move SAP ASE compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapase/{{ item }}" with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index ec70a2190..458f29ba5 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -12,7 +12,7 @@ when: - not sap_install_media_detect_skip_extraction_if_target_dir_exists -- name: SAP Install Media Detect - SAP MaxDB - Create Directories +- name: SAP Install Media Detect - SAP MaxDB - Ensure directories exist ansible.builtin.file: path: "{{ item }}" state: directory @@ -23,11 +23,11 @@ - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/" - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" -- name: SAP Install Media Detect - SAP MaxDB - List files in directory +- name: SAP Install Media Detect - SAP MaxDB - List files in source directory ansible.builtin.command: find . -maxdepth 1 -type f register: detect_directory_files args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" changed_when: false - name: SAP Install Media Detect - SAP MaxDB - Detect ZIP files (including no file extensions), ignore errors @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" ignore_errors: true changed_when: false @@ -49,7 +49,18 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - SAP MaxDB - Copy SAP MaxDB files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" + remote_src: true + with_items: + - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media # noqa no-changed-when @@ -71,9 +82,7 @@ use_regex: true register: detect_directory_sapmaxdb_extracted -- name: SAP Install Media Detect - SAP MaxDB - Local Directory source - move SAP MaxDB compressed archive files +- name: SAP Install Media Detect - SAP MaxDB - Move SAP MaxDB compressed archive files ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/{{ item }}" with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" - when: - - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapcar.yml b/roles/sap_install_media_detect/tasks/detect_sapcar.yml index a994203f9..be6c7170e 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapcar.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapcar.yml @@ -3,7 +3,7 @@ - name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls SAPCAR*.EXE args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_sapcar_file_name_get changed_when: false @@ -11,6 +11,13 @@ ansible.builtin.set_fact: sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" +- name: SAP Install Media Detect - SAPCAR - Copy SAPCAR file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_sapcar_file_name }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_sapcar_file_name | basename }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAPCAR - Change ownership of SAPCAR ansible.builtin.file: path: "{{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name }}" diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index 0f54d24ad..216d49168 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -12,16 +12,11 @@ owner: root group: root -- name: SAP Install Media Detect - SAP HANA - Copy SAPCAR file - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} - changed_when: true - # IMDB SAR Files - name: SAP Install Media Detect - SAP HANA - Get all IMDB SAR files in folder - {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls IMDB*.SAR args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: imdb_sarfiles_list changed_when: false @@ -31,6 +26,17 @@ when: - not( imdb_sarfiles_list.stdout == '' ) +- name: SAP Install Media Detect - SAP HANA - Copy all IMDB SAR files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item.path | basename }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ sap_hana_install_imdb_sar }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP HANA - Copy SAP HANA files ansible.builtin.shell: | cp {{ __sap_install_media_detect_software_main_directory }}/{{ item }} {{ __sap_install_media_detect_software_main_directory }}/sap_hana/{{ item }} @@ -53,6 +59,11 @@ owner: root group: root +- name: SAP Install Media Detect - SAP HANA - Copy SAPCAR file + ansible.builtin.shell: | + cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} + changed_when: true + # Create directory {{ sap_hana_install_directory }}/extracted # This is where all extracted .SAR files will be stored - name: SAP Install Media Detect - SAP HANA - Remove directory - {{ sap_hana_install_directory }}/extracted diff --git a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml index b9d92b6d2..8a9a93e82 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml @@ -13,14 +13,21 @@ group: root # SAPHOSTAGENT -- name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ __sap_install_media_detect_software_main_directory }} +- name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ sap_install_media_detect_source_directory }} ansible.builtin.shell: ls SAPHOSTAGENT*SAR args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: saphostagent_sarfile changed_when: false -- name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file +- name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ saphostagent_sarfile.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ saphostagent_sarfile.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + +- name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file to subdirectory ansible.builtin.shell: | cp {{ __sap_install_media_detect_software_main_directory }}/{{ saphostagent_sarfile.stdout }} {{ sap_hostagent_install_directory }}/{{ saphostagent_sarfile.stdout }} changed_when: true diff --git a/roles/sap_install_media_detect/tasks/detect_sapigs.yml b/roles/sap_install_media_detect/tasks/detect_sapigs.yml index 9c08067f7..cb8b3002b 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapigs.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapigs.yml @@ -1,12 +1,19 @@ --- -- name: SAP Install Media Detect - SAP IGS - Get IGS from software path +- name: SAP Install Media Detect - SAP IGS - Get IGS from software path in source directory ansible.builtin.shell: ls igsexe*.sar args: - chdir: "{{ sap_swpm_software_path }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_igs_file_name_get changed_when: false +- name: SAP Install Media Detect - SAP IGS - Copy SAP IGS file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_igs_file_name_get.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_igs_file_name_get.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP IGS - Set fact for IGS ansible.builtin.set_fact: sap_swpm_igs_path: "{{ sap_swpm_software_path }}" @@ -20,13 +27,20 @@ failed_when: not sap_swpm_igs_file_name_stat.stat.exists # 4. IGS Helper -- name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path +- name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path in source directory ansible.builtin.shell: ls igshelper*.sar args: - chdir: "{{ sap_swpm_software_path }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_igs_helper_file_name_get changed_when: false +- name: SAP Install Media Detect - SAP IGS - Copy SAP IGS helper file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_igs_helper_file_name_get.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_igs_helper_file_name_get.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP IGS - Set fact for IGS ansible.builtin.set_fact: sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml index 911dd5a10..44f5985e3 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml @@ -1,13 +1,20 @@ --- # 5. SAPEXEDB -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path +- name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path in source directory ansible.builtin.shell: ls SAPEXEDB_*.SAR args: - chdir: "{{ sap_swpm_software_path }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_kernel_dependent_file_name_get changed_when: false +- name: SAP Install Media Detect - SAP Kernel - Copy SAPEXEDB file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB ansible.builtin.set_fact: sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" @@ -20,13 +27,20 @@ failed_when: not sap_swpm_kernel_dependent_file_name_stat.stat.exists # 6. SAPEXE -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path +- name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path in source directory ansible.builtin.shell: ls SAPEXE_*.SAR args: - chdir: "{{ sap_swpm_software_path }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_kernel_independent_file_name_get changed_when: false +- name: SAP Install Media Detect - SAP Kernel - Copy SAPEXEDB file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_kernel_independent_file_name_get.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_kernel_independent_file_name_get.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE ansible.builtin.set_fact: sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml index e42f0b963..0dce8edae 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml @@ -20,19 +20,25 @@ changed_when: true # SWPM -- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ __sap_install_media_detect_software_main_directory }} +- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_install_media_detect_source_directory }} ansible.builtin.shell: ls SWPM*.SAR args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ sap_install_media_detect_source_directory }}" register: sap_swpm_swpm_sar_file_name_get changed_when: false -- name: SAP Install Media Detect - SAP SWPM - Copy SWPM file +- name: SAP Install Media Detect - SAP SWPM - Copy SWPM file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }}" + remote_src: true + when: sap_install_media_detect_source == 'remote_dir' + +- name: SAP Install Media Detect - SAP SWPM - Copy SWPM file to sap_swpm subdirectory ansible.builtin.shell: | cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }} {{ __sap_install_media_detect_software_main_directory }}/sap_swpm/{{ sap_swpm_swpm_sar_file_name_get.stdout }} changed_when: true - - name: SAP Install Media Detect - SAP SWPM - Check availability of software path - {{ sap_swpm_software_path }} ansible.builtin.stat: path: "{{ sap_swpm_software_path }}" @@ -49,38 +55,6 @@ group: root -################ -# Prepare software path -################ - -# Software Path - -# Backup Location - this is moved to install_type/restore_install.yml - -# - name: SAP SWPM Pre Install - Check backup location - -# block: - -# - name: SAP Install Media Detect - SAP SWPM - Check availability backup location - {{ sap_swpm_backup_location }} -# ansible.builtin.stat: -# path: "{{ sap_swpm_backup_location }}" -# register: sap_swpm_backup_location_stat -# failed_when: not sap_swpm_backup_location_stat.stat.exists and '.CP' in sap_swpm_product_catalog_id - -# - name: SAP Install Media Detect - SAP SWPM - Change ownership of backup location - {{ sap_swpm_backup_location }} -# ansible.builtin.file: -# path: "{{ sap_swpm_backup_location }}" -# state: directory -# recurse: yes -# mode: '0755' -# owner: root -# group: root -# when: -# - sap_swpm_backup_location_stat.stat.exists and sap_swpm_backup_location_stat.stat.isdir - -# when: -# - "'restore' in sap_swpm_swpm_installation_type" - # SWPM Path - name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM path - {{ sap_swpm_swpm_path }} diff --git a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml index 960f22cb6..8456e1dc0 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml @@ -1,14 +1,26 @@ --- # 7. Web Dispatcher -- name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path +- name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path in source directory ansible.builtin.shell: ls SAPWEBDISP_*.SAR args: - chdir: "{{ sap_swpm_software_path }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" +# chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_web_dispatcher_file_name_get ignore_errors: true changed_when: false +- name: SAP Install Media Detect - SAP WebDisp - Copy WEBDISP file to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ line_item.path }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" + remote_src: true + loop: + "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + - name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP ansible.builtin.set_fact: sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index f949f3957..813849f5a 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -23,9 +23,10 @@ fail_msg: "FAIL: Directory {{ sap_install_media_detect_target_directory }} is not writable!" success_msg: "PASS: Directory {{ sap_install_media_detect_target_directory }} is writable." - - name: SAP Install Media Detect - Prepare - Set the variable sap_install_media_detect_source in case of writable remote file system + - name: SAP Install Media Detect - Prepare - Set facts in case of remote file system' ansible.builtin.set_fact: sap_install_media_detect_source: 'remote_dir' + __sap_install_media_detect_software_main_directory: "{{ sap_install_media_detect_target_directory }}" - name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_source_directory' when: sap_install_media_detect_target_directory is undefined or @@ -49,7 +50,12 @@ fail_msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} is not writable!" success_msg: "PASS: Directory {{ sap_install_media_detect_source_directory }} is writable." - - name: SAP Install Media Detect - Prepare - Set some variables in case of writable local file system + - name: SAP Install Media Detect - Prepare - Set facts in case of local file system' ansible.builtin.set_fact: sap_install_media_detect_source: 'local_dir' __sap_install_media_detect_software_main_directory: "{{ sap_install_media_detect_source_directory }}" + +- name: SAP Install Media Detect - Prepare - Status report + ansible.builtin.debug: + msg: "Reading from '{{ sap_install_media_detect_source_directory }}'. + Storing and extracting on '{{ __sap_install_media_detect_software_main_directory }}'." From 8535387fabab1a215a75a49e28bdcbe11114f21f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 7 Aug 2023 23:42:58 +0200 Subject: [PATCH 002/179] sap_install_media_detect: Use a one step file type determination method The new method uses a tool named sapfile to examine the SAP and UNIX file types and populate a dictionary. Each file is stored with directory, file name, SAP file type, and archive file type. Using this method, the SAP file types have to be determined only once. The files are then copied to local storage (in case the software is located on a remote NFS file system), extracted and moved properly according to their entries in the dictionary. As the last step, the variables for SWPM are set using the entries for SAP file type in the dictionary, as these are identical to the subdirectory names. --- .../files/tmp/sapfile | 145 ++++++++++++ .../tasks/cleanup/remove_sapfile_utility.yml | 6 + roles/sap_install_media_detect/tasks/main.yml | 208 ++++++++++-------- .../tasks/organize_all_files.yml | 89 ++++++++ ..._list.yml => create_file_list_phase_1.yml} | 16 +- .../prepare/create_file_list_phase_2.yml | 83 +++++++ .../tasks/prepare/provide_sapfile_utility.yml | 23 ++ .../tasks/set_global_vars_v2.yml | 154 +++++++++++++ 8 files changed, 624 insertions(+), 100 deletions(-) create mode 100755 roles/sap_install_media_detect/files/tmp/sapfile create mode 100644 roles/sap_install_media_detect/tasks/cleanup/remove_sapfile_utility.yml create mode 100644 roles/sap_install_media_detect/tasks/organize_all_files.yml rename roles/sap_install_media_detect/tasks/prepare/{create_file_list.yml => create_file_list_phase_1.yml} (86%) create mode 100644 roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml create mode 100644 roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml create mode 100644 roles/sap_install_media_detect/tasks/set_global_vars_v2.yml diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile new file mode 100755 index 000000000..84e9d5b44 --- /dev/null +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -0,0 +1,145 @@ +#!/bin/bash +# sapfile: Determine and display SAP file type +# +# Copyright 2023 Bernd Finger, Red Hat +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -o nounset +set -o pipefail + +usage () { + echo "sapfile: Determine and display SAP file type. If unknown, call the file command." + echo "Usage: sapfile [OPTION...] [FILE...]" + echo "Determine type of SAP FILEs, optionally followed by type of FILEs." + echo " -h, --help display this help and exit" + echo " -l long listing: also display the file type, taken from the output of the file command" + echo "" + echo "Requires:" + echo "- lsar (contained in the unar package from the EPEL RHEL repo)" + echo "- zipinfo (contained in the unzip RHEL package)" + echo "- sapcar (SAP program to handle sapcar files; typical filename: SAPCAR_1115-70006178.EXE)" +} + +_EXTENDED_OUTPUT="n" + +while getopts ":lh" opt; do + case ${opt} in + l) + _EXTENDED_OUTPUT="y" + ;; + h) + usage + exit 1 + ;; + \?) + echo "Invalid option -$OPTARG" + usage + exit 1 + ;; + esac +done +shift "$((OPTIND-1))" + +_ARCHIVE_TYPE="other" + +for _FILE in "$@"; do + _FILE_OUTPUT=$(file "${_FILE}" | sed 's,'"${_FILE}"': ,,') + if [[ ${_FILE_OUTPUT}. == "data." ]] && [[ (${_FILE##*.} == "SAR" || ${_FILE##*.} == "sar") ]]; then + _ARCHIVE_TYPE="sapcar" + _list_content="sapcar -tvf" + else + _ARCHIVE_TYPE=$(echo "${_FILE_OUTPUT}" | awk ' + BEGIN{_file_type="other"} + /RAR self-extracting archive/{_file_type="rarexe"} + /RAR archive data/{_file_type="rar"} + /Zip archive data/{_file_type="zip"} + /SAPCAR archive data/{_file_type="sapcar"} + /directory/{_file_type="dir"} + END{print _file_type}') + if [[ ${_ARCHIVE_TYPE}. == "rarexe." ]]; then + _list_content="lsar" + elif [[ ${_ARCHIVE_TYPE}. == "rar." ]]; then + _list_content="lsar" + elif [[ ${_ARCHIVE_TYPE}. == "zip." ]]; then + _list_content="zipinfo -1" + elif [[ ${_ARCHIVE_TYPE}. == "sapcar." ]]; then + _list_content="sapcar -tvf" + elif [[ ${_ARCHIVE_TYPE}. == "dir." ]]; then + _list_content="" + fi + fi + printf "%-32s " "${_FILE}": + + if [[ ! -e "${_FILE}" ]]; then + echo "No such file or directory." + exit 1 + fi + + SAP_FILE_TYPE_FROM_FILENAME=$(echo "${_FILE}" | awk ' + BEGIN{_sap_file_type="look_inside"} + /SAPCAR/&&/\.EXE/{_sap_file_type="sapcar"} + !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="sap_db_hana_other"} + /IMDB_SERVER/&&/\.SAR/{_sap_file_type="sap_db_hana"} + /IMDB_CLIENT/&&/\.SAR/{_sap_file_type="sap_db_hana_client"} + /SWPM/&&/\.SAR/{_sap_file_type="sap_swpm"} + /SAPHOSTAGENT/&&/\.SAR/{_sap_file_type="sap_hostagent"} + /igsexe/||/igshelper/{_sap_file_type="sap_igs"} + /SAPEXE_/||/SAPEXEDB_/{_sap_file_type="sap_kernel"} + /SAPWEBDISP_/{_sap_file_type="sap_webdisp"} + /SAPJVM/{_sap_file_type="sap_jvm"} + /ASEBC/{_sap_file_type="sap_db_ase_client"} + /COMPLETE/{_sap_file_type="sap_hana_backup"} + /S4/&&/HANA/&&/LANG/{_sap_file_type="sap_s4hana_lang"} + /S4/&&/EXPORT/{_sap_file_type="sap_s4hana_export"} + /BW4/&&/EXPORT/{_sap_file_type="sap_bw4hana_export"} + /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} + END{print _sap_file_type}') + + if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. != "look_inside." ]]; then + _SAP_FILE_TYPE=${SAP_FILE_TYPE_FROM_FILENAME} + else + if [[ ${_ARCHIVE_TYPE}. == "dir." ]]; then + _SAP_FILE_TYPE=${_FILE_OUTPUT} + elif [[ ${_ARCHIVE_TYPE}. == "rarexe." || + ${_ARCHIVE_TYPE}. == "rar." || + ${_ARCHIVE_TYPE}. == "zip." || + ${_ARCHIVE_TYPE}. == "sapcar." ]]; then + _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' + BEGIN{_sap_file_type="sap_unknown"} + /BD_SYBASE_ASE/{_sap_file_type="sap_db_ase"} + /ASEBC/{_sap_file_type="sap_db_ase_client"} + /MaxDB_7.9/{_sap_file_type="sap_db_maxdb"} + /19cinstall.sh/{_sap_file_type="sap_db_oracle"} + /OCL_LINUX_X86_64/{_sap_file_type="sap_db_oracle_client"} + /db2setup/{_sap_file_type="sap_db_db2"} + /db6_update_client.sh/{_sap_file_type="sap_db_db2_client"} + /db2aese_c.lic/{_sap_file_type="sap_db_db2_license"} + /DATA_UNITS\/EXPORT/{_sap_file_type="sap_ecc_export"} + /EXP[0-9]/{_sap_file_type="sap_ecc_ides_export"} + /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_nwas_abap_export"} + /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_nwas_java_export"} + /format error in header/{_sap_file_type="format_error_in_header"} + END{print _sap_file_type}') + else + _SAP_FILE_TYPE="sap_unknown" + fi + fi + + printf "%-24s " "${_SAP_FILE_TYPE}" + if [[ ${_EXTENDED_OUTPUT}. == "y." ]]; then + printf "%s\n" "${_ARCHIVE_TYPE}" + else + printf "\n" + fi +done diff --git a/roles/sap_install_media_detect/tasks/cleanup/remove_sapfile_utility.yml b/roles/sap_install_media_detect/tasks/cleanup/remove_sapfile_utility.yml new file mode 100644 index 000000000..0e95e08bb --- /dev/null +++ b/roles/sap_install_media_detect/tasks/cleanup/remove_sapfile_utility.yml @@ -0,0 +1,6 @@ +--- + +- name: SAP Install Media Detect - Prepare - Remove temporary directory + ansible.builtin.file: + path: "{{ __sap_install_media_detect_tmpdir.path }}" + state: absent diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 15afd825f..27a14ee2d 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,5 +1,12 @@ --- +- name: SAP Install Media Detect - Prepare - Provide sapfile utility + ansible.builtin.include_tasks: + file: prepare/provide_sapfile_utility.yml + apply: + tags: sap_install_media_detect_provide_sapfile_utility + tags: sap_install_media_detect_provide_sapfile_utility + - name: SAP Install Media Detect - Prepare - Enable rar handling ansible.builtin.include_tasks: file: prepare/enable_rar_handling.yml @@ -14,12 +21,12 @@ tags: sap_install_media_detect_check_directories tags: sap_install_media_detect_check_directories -- name: SAP Install Media Detect - Create a list of all files +- name: SAP Install Media Detect - Create a list of all files, phase 1 ansible.builtin.include_tasks: - file: prepare/create_file_list.yml + file: prepare/create_file_list_phase_1.yml apply: - tags: sap_install_media_detect_create_file_list - tags: sap_install_media_detect_create_file_list + tags: sap_install_media_detect_create_file_list_phase_1 + tags: sap_install_media_detect_create_file_list_phase_1 - name: SAP Install Media Detect - Detect and if necessary rename zip and rar files without extension ansible.builtin.include_tasks: @@ -28,100 +35,110 @@ tags: sap_install_media_detect_add_file_extension tags: sap_install_media_detect_add_file_extension -- name: SAP Install Media Detect - Organize SAPCAR - ansible.builtin.include_tasks: detect_sapcar.yml - -- name: SAP Install Media Detect - Organize SAP HANA installation media files - ansible.builtin.include_tasks: detect_saphana.yml - when: - - sap_install_media_detect_db == "saphana" - -- name: SAP Install Media Detect - Organize SAP SWPM installation media files - ansible.builtin.include_tasks: detect_sapswpm.yml - when: - - sap_install_media_detect_swpm - -- name: SAP Install Media Detect - Organize SAP Host Agent installation media files - ansible.builtin.include_tasks: detect_saphostagent.yml - when: - - sap_install_media_detect_hostagent - -- name: SAP Install Media Detect - Organize SAP IGS installation media files - ansible.builtin.include_tasks: detect_sapigs.yml - when: - - sap_install_media_detect_igs - -- name: SAP Install Media Detect - Organize SAP Kernel installation media files - ansible.builtin.include_tasks: detect_sapkernel.yml - when: - - sap_install_media_detect_kernel - -- name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files - ansible.builtin.include_tasks: detect_sapwebdisp.yml - when: - - sap_install_media_detect_webdisp - -- name: SAP Install Media Detect - Complete Data Backup files for SAP HANA - ansible.builtin.include_tasks: detect_backup_saphana.yml - when: - - sap_install_media_detect_backup == "saphana" +- name: SAP Install Media Detect - Create a list of all files, phase 2 + ansible.builtin.include_tasks: + file: prepare/create_file_list_phase_2.yml + apply: + tags: sap_install_media_detect_create_file_list_phase_2 + tags: sap_install_media_detect_create_file_list_phase_2 + +- name: SAP Install Media Detect - Organize all files + ansible.builtin.include_tasks: organize_all_files.yml + +#- name: SAP Install Media Detect - Organize SAPCAR +# ansible.builtin.include_tasks: detect_sapcar.yml + +#- name: SAP Install Media Detect - Organize SAP HANA installation media files +# ansible.builtin.include_tasks: detect_saphana.yml +# when: +# - sap_install_media_detect_db == "saphana" + +#- name: SAP Install Media Detect - Organize SAP SWPM installation media files +# ansible.builtin.include_tasks: detect_sapswpm.yml +# when: +# - sap_install_media_detect_swpm + +#- name: SAP Install Media Detect - Organize SAP Host Agent installation media files +# ansible.builtin.include_tasks: detect_saphostagent.yml +# when: +# - sap_install_media_detect_hostagent + +#- name: SAP Install Media Detect - Organize SAP IGS installation media files +# ansible.builtin.include_tasks: detect_sapigs.yml +# when: +# - sap_install_media_detect_igs + +#- name: SAP Install Media Detect - Organize SAP Kernel installation media files +# ansible.builtin.include_tasks: detect_sapkernel.yml +# when: +# - sap_install_media_detect_kernel + +#- name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files +# ansible.builtin.include_tasks: detect_sapwebdisp.yml +# when: +# - sap_install_media_detect_webdisp + +#- name: SAP Install Media Detect - Complete Data Backup files for SAP HANA +# ansible.builtin.include_tasks: detect_backup_saphana.yml +# when: +# - sap_install_media_detect_backup == "saphana" # Detect files which (historically) have filenames which are Numbered IDs only (e.g. 51054410_2 for SAP MaxDB 7.9) # Leave to last so directory has less files to scan -- name: SAP Install Media Detect - Organize SAP ASE installation media files - ansible.builtin.include_tasks: detect_sapanydb_sapase.yml - when: - - sap_install_media_detect_db == "sapase" - -- name: SAP Install Media Detect - Organize SAP MaxDB installation media files - ansible.builtin.include_tasks: detect_sapanydb_sapmaxdb.yml - when: - - sap_install_media_detect_db == "sapmaxdb" - -- name: SAP Install Media Detect - Organize Oracle DB installation media files - ansible.builtin.include_tasks: detect_sapanydb_oracledb.yml - when: - - sap_install_media_detect_db == "oracledb" - -- name: SAP Install Media Detect - Organize IBM Db2 installation media files - ansible.builtin.include_tasks: detect_sapanydb_ibmdb2.yml - when: - - sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detect - EXPORT files for SAP ECC - ansible.builtin.include_tasks: detect_export_sapecc.yml - when: sap_install_media_detect_export == "sapecc" - -- name: SAP Install Media Detect - EXPORT files for SAP ECC IDES - ansible.builtin.include_tasks: detect_export_sapecc_ides.yml - when: sap_install_media_detect_export == "sapecc_ides" - -- name: SAP Install Media Detect - EXPORT files for SAP S/4HANA - ansible.builtin.include_tasks: detect_export_saps4hana.yml - when: - - sap_install_media_detect_export == "saps4hana" - -- name: SAP Install Media Detect - EXPORT files for SAP BW/4HANA - ansible.builtin.include_tasks: detect_export_sapbw4hana.yml - when: - - sap_install_media_detect_export == "sapbw4hana" - -- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only - ansible.builtin.include_tasks: detect_export_sapnwas_abap.yml - when: sap_install_media_detect_export == "sapnwas_abap" - -- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only - ansible.builtin.include_tasks: detect_export_sapnwas_java.yml - when: sap_install_media_detect_export == "sapnwas_java" - -- name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) - ansible.builtin.include_tasks: detect_export_sapsolman_abap.yml - when: - - sap_install_media_detect_export == "sapsolman_abap" +#- name: SAP Install Media Detect - Organize SAP ASE installation media files +# ansible.builtin.include_tasks: detect_sapanydb_sapase.yml +# when: +# - sap_install_media_detect_db == "sapase" + +#- name: SAP Install Media Detect - Organize SAP MaxDB installation media files +# ansible.builtin.include_tasks: detect_sapanydb_sapmaxdb.yml +# when: +# - sap_install_media_detect_db == "sapmaxdb" + +#- name: SAP Install Media Detect - Organize Oracle DB installation media files +# ansible.builtin.include_tasks: detect_sapanydb_oracledb.yml +# when: +# - sap_install_media_detect_db == "oracledb" + +#- name: SAP Install Media Detect - Organize IBM Db2 installation media files +# ansible.builtin.include_tasks: detect_sapanydb_ibmdb2.yml +# when: +# - sap_install_media_detect_db == "ibmdb2" + +#- name: SAP Install Media Detect - EXPORT files for SAP ECC +# ansible.builtin.include_tasks: detect_export_sapecc.yml +# when: sap_install_media_detect_export == "sapecc" + +#- name: SAP Install Media Detect - EXPORT files for SAP ECC IDES +# ansible.builtin.include_tasks: detect_export_sapecc_ides.yml +# when: sap_install_media_detect_export == "sapecc_ides" + +#- name: SAP Install Media Detect - EXPORT files for SAP S/4HANA +# ansible.builtin.include_tasks: detect_export_saps4hana.yml +# when: +# - sap_install_media_detect_export == "saps4hana" + +#- name: SAP Install Media Detect - EXPORT files for SAP BW/4HANA +# ansible.builtin.include_tasks: detect_export_sapbw4hana.yml +# when: +# - sap_install_media_detect_export == "sapbw4hana" + +#- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only +# ansible.builtin.include_tasks: detect_export_sapnwas_abap.yml +# when: sap_install_media_detect_export == "sapnwas_abap" + +#- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only +# ansible.builtin.include_tasks: detect_export_sapnwas_java.yml +# when: sap_install_media_detect_export == "sapnwas_java" + +#- name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) +# ansible.builtin.include_tasks: detect_export_sapsolman_abap.yml +# when: +# - sap_install_media_detect_export == "sapsolman_abap" - name: SAP Install Media Detection Completed - set global vars for subsequent Ansible Tasks - ansible.builtin.include_tasks: set_global_vars.yml + ansible.builtin.include_tasks: set_global_vars_v2.yml # Output of detected SAP Software @@ -150,3 +167,10 @@ when: - sap_install_media_detect_rar_package == 'EPEL' - __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' + +- name: SAP Install Media Detect - Cleanup - Remove sapfile utility + ansible.builtin.include_tasks: + file: cleanup/remove_sapfile_utility.yml + apply: + tags: sap_install_media_detect_provide_sapfile_utility + tags: sap_install_media_detect_provide_sapfile_utility diff --git a/roles/sap_install_media_detect/tasks/organize_all_files.yml b/roles/sap_install_media_detect/tasks/organize_all_files.yml new file mode 100644 index 000000000..962cfc2f3 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/organize_all_files.yml @@ -0,0 +1,89 @@ +--- + +- name: SAP Install Media Detect - Organize all files - Copy files to {{ sap_install_media_detect_target_directory }} + ansible.builtin.copy: + src: "{{ sap_install_media_detect_source_directory }}/{{ line_item.file }}" + dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.file }}" + remote_src: true + owner: root + group: root + mode: '0755' + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: sap_install_media_detect_source == 'remote_dir' + +- name: SAP Install Media Detect - Organize all files - Create target extraction directories + ansible.builtin.file: + path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + state: directory + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar' + +- name: SAP Install Media Detect - Organize all files - Create target directories + ansible.builtin.file: + path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}" + state: directory + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar' + +- name: SAP Install Media Detect - Organize all files - Extract zip archive files + ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.archive_type == 'zip' + +- name: SAP Install Media Detect - Organize all files - Extract rar archive files + ansible.builtin.shell: "set -o pipefail && {{ sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ sap_install_media_detect_rar_extract_argument }} {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.archive_type == 'rarexe' + +- name: SAP Install Media Detect - Organize all files - Extract sapcar archive files + ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.archive_type == 'sapcar' + +- name: SAP Install Media Detect - Organize all files - Copy sapcar to sap_swpm directory + ansible.builtin.copy: + src: "{{ __sap_install_media_detect_fact_sapcar_path }}" + dest: "{{ sap_install_media_detect_target_directory }}/sap_swpm/" + remote_src: true + owner: root + group: root + mode: '0755' + when: + sap_install_media_detect_swpm + +- name: SAP Install Media Detect - Organize all files - Move all archives files into subdirectories + ansible.builtin.shell: "set -o pipefail && mv {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}/{{ line_item.file }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.sap_file_type != 'sapcar' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml similarity index 86% rename from roles/sap_install_media_detect/tasks/prepare/create_file_list.yml rename to roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index 11148dae3..0b9ee3c33 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -6,31 +6,31 @@ # See https://github.com/sap-linuxlab/community.sap_install/issues/402 . - name: SAP Install Media Detect - Prepare - Initialize fact variables ansible.builtin.set_fact: - __sap_install_media_detect_fact_find_result: [] + __sap_install_media_detect_fact_find_result_phase_1: [] __sap_install_media_detect_fact_files_without_extension: [] __sap_install_media_detect_fact_files_without_extension_file_results: [] __sap_install_media_detect_fact_zip_files_without_extension: [] __sap_install_media_detect_fact_exe_files_without_extension: [] __sap_install_media_detect_fact_rar_files_without_extension: [] -- name: SAP Install Media Detect - Prepare - Create list of all files on the top level of 'sap_install_media_detect_source_directory' +- name: SAP Install Media Detect - Prepare - Create initial list of all files on the top level of 'sap_install_media_detect_source_directory' ansible.builtin.find: paths: "{{ sap_install_media_detect_source_directory }}" patterns: '*' recurse: false use_regex: false - register: __sap_install_media_detect_register_find_result + register: __sap_install_media_detect_register_find_result_phase_1 -- name: SAP Install Media Detect - Prepare - Set fact from find result +- name: SAP Install Media Detect - Prepare - Set fact from find result, phase 1 ansible.builtin.set_fact: - __sap_install_media_detect_fact_find_result: "{{ __sap_install_media_detect_fact_find_result + [item.path] }}" - loop: "{{ __sap_install_media_detect_register_find_result.files }}" + __sap_install_media_detect_fact_find_result_phase_1: "{{ __sap_install_media_detect_fact_find_result_phase_1 + [item.path] }}" + loop: "{{ __sap_install_media_detect_register_find_result_phase_1.files }}" - name: SAP Install Media Detect - Prepare - Set fact with any file names without extension ansible.builtin.set_fact: __sap_install_media_detect_fact_files_without_extension: "{{ __sap_install_media_detect_fact_files_without_extension + [item] }}" when: (item | splitext)[1] | length == 0 - loop: "{{ __sap_install_media_detect_fact_find_result }}" + loop: "{{ __sap_install_media_detect_fact_find_result_phase_1 }}" - name: SAP Install Media Detect - Prepare - Iterate over files without extension and determine file type ansible.builtin.shell: set -o pipefail && file {{ line_item }} | cut -d ' ' -f 2- @@ -50,7 +50,7 @@ file: "{{ item.line_item | basename }}" file_type: "{{ item.stdout }}" -- name: SAP Install Media Detect - Prepare - Display the file dict +- name: SAP Install Media Detect - Prepare - Display the file dict, phase 1 ansible.builtin.debug: var: __sap_install_media_detect_fact_files_without_extension_file_results diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml new file mode 100644 index 000000000..85b83d0f1 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -0,0 +1,83 @@ +--- + +# The fact variables are appended in tasks of this file, so they need to be initialized explicitly. +# With implicit initialization (by using the default filter), the variables would be appended again if the role +# was called more than once in a playbook. +# See https://github.com/sap-linuxlab/community.sap_install/issues/402 . +- name: SAP Install Media Detect - Prepare - Initialize fact variables + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result_phase_2: [] + __sap_install_media_detect_fact_files_sapfile_results: [] + +- name: SAP Install Media Detect - Prepare - Create final list of all files on the top level of 'sap_install_media_detect_source_directory' + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" + patterns: '*' + recurse: false + use_regex: false + register: __sap_install_media_detect_register_find_result_phase_2 + +- name: SAP Install Media Detect - Prepare - Set fact from find result, phase 2 + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result_phase_2: "{{ __sap_install_media_detect_fact_find_result_phase_2 + [item.path] }}" + loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" + +- name: SAP Install Media Detect - Prepare - Iterate over files and determine file type + ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -l {{ line_item }} | awk '{print $(NF-1), $NF}' + register: __sap_install_media_detect_register_files_phase_2 + loop: "{{ __sap_install_media_detect_fact_find_result_phase_2 }}" + loop_control: + loop_var: line_item + changed_when: false + +- name: SAP Install Media Detect - Prepare - Set fact with the results of the sapfile command + ansible.builtin.set_fact: + __sap_install_media_detect_fact_files_sapfile_results: "{{ __sap_install_media_detect_fact_files_sapfile_results + [__new_dict] }}" + loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" + vars: + __new_dict: + dir: "{{ item.line_item | dirname }}" + file: "{{ item.line_item | basename }}" + sap_file_type: "{{ item.stdout.split(' ')[0] }}" + archive_type: "{{ item.stdout.split(' ')[1] }}" + when: + (item.stdout.split(' ')[0] == 'sapcar') or + (sap_install_media_detect_swpm | d('false') and item.stdout.split(' ')[0] == 'sap_swpm') or + (sap_install_media_detect_hostagent | d('false') and item.stdout.split(' ')[0] == 'sap_hostagent') or + (sap_install_media_detect_igs | d('false') and item.stdout.split(' ')[0] == 'sap_igs') or + (sap_install_media_detect_kernel | d('false') and item.stdout.split(' ')[0] == 'sap_kernel') or + (sap_install_media_detect_webdisp | d('false') and item.stdout.split(' ')[0] == 'sap_webdisp') or + (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(' ')[0] == 'sap_db_maxdb') or + (sap_install_media_detect_db == 'sapase' and ( + item.stdout.split(' ')[0] == 'sap_db_ase' or + item.stdout.split(' ')[0] == 'sap_db_ase_client') + ) or + (sap_install_media_detect_db == 'oracledb' and ( + item.stdout.split(' ')[0] == 'sap_db_oracle' or + item.stdout.split(' ')[0] == 'sap_db_oracle_client') + ) or + (sap_install_media_detect_db == 'ibmdb2' and ( + item.stdout.split(' ')[0] == 'sap_db_db2' or + item.stdout.split(' ')[0] == 'sap_db_db2_client' or + item.stdout.split(' ')[0] == 'sap_db_db2_license') + ) or + (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(' ')[0] == 'sap_s4hana_export') or + (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(' ')[0] == 'sap_bw4hana_export') or + (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(' ')[0] == 'sap_nwas_abap_export') or + (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(' ')[0] == 'sap_nwas_java_export') or + (sap_install_media_detect_export == 'sapecc' and item.stdout.split(' ')[0] == 'sap_ecc_export') or + (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(' ')[0] == 'sap_ecc_ides_export') + +- name: SAP Install Media Detect - Organize all files - Identify the sapcar program + ansible.builtin.set_fact: + __sap_install_media_detect_fact_sapcar_path: "{{ sap_install_media_detect_target_directory }}/{{ item.line_item | basename }}" + loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" + when: item.stdout.split(' ')[0] == 'sapcar' + +- name: SAP Install Media Detect - Prepare - Display the file dict, phase 2 + ansible.builtin.debug: + var: __sap_install_media_detect_fact_files_sapfile_results + +- name: SAP Install Media Detect - Prepare - Display the path to the sapcar program + ansible.builtin.debug: + var: __sap_install_media_detect_fact_sapcar_path diff --git a/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml b/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml new file mode 100644 index 000000000..b845ed603 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml @@ -0,0 +1,23 @@ +--- + +- name: SAP Install Media Detect - Prepare - Create temporary directory to store various files + ansible.builtin.tempfile: + state: directory + suffix: media_detect + register: __sap_install_media_detect_tmpdir + +- name: SAP Install Media Detect - Prepare - Copy file sapfile utility to '{{ __sap_install_media_detect_tmpdir.path }}' + ansible.builtin.copy: + src: tmp/sapfile + dest: "{{ __sap_install_media_detect_tmpdir.path }}/sapfile" + owner: root + group: root + mode: '0755' + +- name: SAP Install Media Detect - Prepare - Set fact for sapfile utility + ansible.builtin.set_fact: + __sap_install_media_detect_sapfile_path: "{{ __sap_install_media_detect_tmpdir.path }}/sapfile" + +- name: Debug 1 + debug: + msg: "__sap_install_media_detect_sapfile_path: >{{ __sap_install_media_detect_sapfile_path }}<" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml b/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml new file mode 100644 index 000000000..90266f10f --- /dev/null +++ b/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml @@ -0,0 +1,154 @@ +--- + +- name: SAP Install Media Detection Completed - Set facts for SAP HANA + ansible.builtin.set_fact: + sap_hana_install_software_directory: "{{ sap_hana_install_directory }}" # for sap_hana_install Ansible Role + sap_hana_install_software_extract_directory: "{{ sap_hana_install_directory }}/extracted" # for sap_hana_install Ansible Role + sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role # <--- TODO + ignore_errors: true + when: sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_db_db2_extracted" + recurse: true + file_type: directory + patterns: ".*LINUXX86_64.*" + use_regex: true + register: detect_directory_ibmdb2_extracted + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_db_db2_client_extracted" + recurse: true + file_type: directory + patterns: ".*DATA_UNITS.*" + use_regex: true + register: detect_directory_ibmdb2_client_extracted + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detection Completed - Set facts for IBM Db2 + ansible.builtin.set_fact: + sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detection Completed - Set facts for Oracle DB # <--- TODO + ansible.builtin.set_fact: + sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role + sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detection Completed - Set facts for SAP ASE # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db == "sapase" + +- name: SAP Install Media Detection Completed - Set facts for SAP MaxDB # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db == "sapmaxdb" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapecc" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC IDES # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapecc_ides" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP S/4HANA # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "saps4hana" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP BW/4HANA # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapbw4hana" + +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_abap" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapnwas_abap" + +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_java" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapnwas_java" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP Solution Manager (ABAP) # <--- TODO + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ detect_directory_export_extracted.files[1].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: + - sap_install_media_detect_export == "sapsolman_abap" + +- name: SAP Install Media Detection Completed - Set facts for SAP SWPM + ansible.builtin.set_fact: + sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_swpm + +- name: SAP Install Media Detection Completed - Set fact for displaying all variables + ansible.builtin.set_fact: + __sap_install_media_detect_vars="{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" + loop: + - sap_hana_install_software_directory + - sap_hana_install_software_extract_directory + - sap_swpm_cd_rdms_path + - sap_swpm_cd_ibmdb2_path + - sap_swpm_cd_ibmdb2_client_path + - sap_anydb_install_oracle_extract_path + - sap_swpm_cd_oracle_path + - sap_swpm_cd_oracle_client_path + - sap_swpm_cd_sapase_path + - sap_swpm_cd_sapase_client_path + - sap_swpm_cd_sapmaxdb_path + - sap_swpm_cd_export_path + - sap_swpm_cd_export_pt1_path + - sap_swpm_cd_export_pt2_path + - sap_swpm_sapcar_path + +- name: SAP Install Media Detection Completed - Display all variables + ansible.builtin.debug: + msg: "{{ __sap_install_media_detect_vars.split('\n')[:-1] }}" From 8048729d5b415053834fe403ceb9ddbaec228d75 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 16:45:53 +0200 Subject: [PATCH 003/179] sap_install_media_detect: Simplify file handling With the new code now using the file/file type dictionary, handling the various file types in separate detect_...yml files is no longer necessary. --- .../files/tmp/sapfile | 93 +++-- .../tasks/detect_backup_saphana.yml | 30 -- .../tasks/detect_export_sapbw4hana.yml | 44 --- .../tasks/detect_export_sapecc.yml | 165 --------- .../tasks/detect_export_sapecc_ides.yml | 165 --------- .../tasks/detect_export_sapnwas_abap.yml | 165 --------- .../tasks/detect_export_sapnwas_java.yml | 165 --------- .../tasks/detect_export_saps4hana.yml | 44 --- .../tasks/detect_export_sapsolman_abap.yml | 116 ------ .../tasks/detect_sapanydb_ibmdb2.yml | 171 --------- .../tasks/detect_sapanydb_oracledb.yml | 134 ------- .../tasks/detect_sapanydb_sapase.yml | 130 ------- .../tasks/detect_sapanydb_sapmaxdb.yml | 88 ----- .../tasks/detect_sapcar.yml | 27 -- .../tasks/detect_saphana.yml | 135 ------- .../tasks/detect_saphostagent.yml | 33 -- .../tasks/detect_sapigs.yml | 53 --- .../tasks/detect_sapkernel.yml | 53 --- .../tasks/detect_sapswpm.yml | 97 ----- .../tasks/detect_sapwebdisp.yml | 35 -- .../extract/sapcar_loop_handler_saphana.yml | 41 --- roles/sap_install_media_detect/tasks/main.yml | 112 +----- .../tasks/organize_all_files.yml | 32 +- .../prepare/create_file_list_phase_2.yml | 27 +- .../tasks/prepare/provide_sapfile_utility.yml | 4 - .../tasks/set_global_vars.yml | 340 +++++++++++++++--- .../tasks/set_global_vars_v2.yml | 154 -------- 27 files changed, 397 insertions(+), 2256 deletions(-) delete mode 100644 roles/sap_install_media_detect/tasks/detect_backup_saphana.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapecc.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapcar.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_saphana.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_saphostagent.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapigs.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapkernel.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapswpm.yml delete mode 100644 roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml delete mode 100644 roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml delete mode 100644 roles/sap_install_media_detect/tasks/set_global_vars_v2.yml diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 84e9d5b44..cbd75f61d 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -21,9 +21,13 @@ set -o pipefail usage () { echo "sapfile: Determine and display SAP file type. If unknown, call the file command." echo "Usage: sapfile [OPTION...] [FILE...]" - echo "Determine type of SAP FILEs, optionally followed by type of FILEs." + echo "Determine and display type of SAP FILEs, optionally followed by additional information." echo " -h, --help display this help and exit" echo " -l long listing: also display the file type, taken from the output of the file command" + echo " -d also display the directory where to move the archive files, for use with Ansible role" + echo " community.sap_install.sap_install_media_detect" + echo " -e also display if the SAP FILE should be extracted, for use with Ansible role" + echo " community.sap_install.sap_install_media_detect" echo "" echo "Requires:" echo "- lsar (contained in the unar package from the EPEL RHEL repo)" @@ -31,12 +35,20 @@ usage () { echo "- sapcar (SAP program to handle sapcar files; typical filename: SAPCAR_1115-70006178.EXE)" } -_EXTENDED_OUTPUT="n" +_DISPLAY_FILE_TYPE="n" +_DISPLAY_DIRECTORY="n" +_DISPLAY_EXTRACT="n" -while getopts ":lh" opt; do +while getopts ":ldeh" opt; do case ${opt} in l) - _EXTENDED_OUTPUT="y" + _DISPLAY_FILE_TYPE="y" + ;; + d) + _DISPLAY_DIRECTORY="y" + ;; + e) + _DISPLAY_EXTRACT="y" ;; h) usage @@ -79,7 +91,7 @@ for _FILE in "$@"; do _list_content="" fi fi - printf "%-32s " "${_FILE}": + printf "%-40s " "${_FILE}": if [[ ! -e "${_FILE}" ]]; then echo "No such file or directory." @@ -89,17 +101,17 @@ for _FILE in "$@"; do SAP_FILE_TYPE_FROM_FILENAME=$(echo "${_FILE}" | awk ' BEGIN{_sap_file_type="look_inside"} /SAPCAR/&&/\.EXE/{_sap_file_type="sapcar"} - !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="sap_db_hana_other"} - /IMDB_SERVER/&&/\.SAR/{_sap_file_type="sap_db_hana"} - /IMDB_CLIENT/&&/\.SAR/{_sap_file_type="sap_db_hana_client"} + /IMDB_SERVER/&&/\.SAR/{_sap_file_type="saphana"} + /IMDB_CLIENT/&&/\.SAR/{_sap_file_type="saphana_client"} + !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="saphana_other"} /SWPM/&&/\.SAR/{_sap_file_type="sap_swpm"} /SAPHOSTAGENT/&&/\.SAR/{_sap_file_type="sap_hostagent"} - /igsexe/||/igshelper/{_sap_file_type="sap_igs"} /SAPEXE_/||/SAPEXEDB_/{_sap_file_type="sap_kernel"} + /igsexe/||/igshelper/{_sap_file_type="sap_igs"} /SAPWEBDISP_/{_sap_file_type="sap_webdisp"} /SAPJVM/{_sap_file_type="sap_jvm"} - /ASEBC/{_sap_file_type="sap_db_ase_client"} - /COMPLETE/{_sap_file_type="sap_hana_backup"} + /ASEBC/{_sap_file_type="sapase_client"} + /COMPLETE/{_sap_file_type="saphana_backup"} /S4/&&/HANA/&&/LANG/{_sap_file_type="sap_s4hana_lang"} /S4/&&/EXPORT/{_sap_file_type="sap_s4hana_export"} /BW4/&&/EXPORT/{_sap_file_type="sap_bw4hana_export"} @@ -117,14 +129,14 @@ for _FILE in "$@"; do ${_ARCHIVE_TYPE}. == "sapcar." ]]; then _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' BEGIN{_sap_file_type="sap_unknown"} - /BD_SYBASE_ASE/{_sap_file_type="sap_db_ase"} - /ASEBC/{_sap_file_type="sap_db_ase_client"} - /MaxDB_7.9/{_sap_file_type="sap_db_maxdb"} - /19cinstall.sh/{_sap_file_type="sap_db_oracle"} - /OCL_LINUX_X86_64/{_sap_file_type="sap_db_oracle_client"} - /db2setup/{_sap_file_type="sap_db_db2"} - /db6_update_client.sh/{_sap_file_type="sap_db_db2_client"} - /db2aese_c.lic/{_sap_file_type="sap_db_db2_license"} + /BD_SYBASE_ASE/{_sap_file_type="sapase"} + /ASEBC/{_sap_file_type="sapase_client"} + /MaxDB_7.9/{_sap_file_type="sapmaxdb"} + /19cinstall.sh/{_sap_file_type="oracledb"} + /OCL_LINUX_X86_64/{_sap_file_type="oracledb_client"} + /db2setup/{_sap_file_type="ibmdb2"} + /db6_update_client.sh/{_sap_file_type="ibmdb2_client"} + /db2aese_c.lic/{_sap_file_type="ibmdb2_license"} /DATA_UNITS\/EXPORT/{_sap_file_type="sap_ecc_export"} /EXP[0-9]/{_sap_file_type="sap_ecc_ides_export"} /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_nwas_abap_export"} @@ -136,10 +148,45 @@ for _FILE in "$@"; do fi fi + _DIRECTORY=${_SAP_FILE_TYPE} + _EXTRACT="y" + + case ${_SAP_FILE_TYPE} in + directory) + _EXTRACT="n" + ;; + sapcar) + _EXTRACT="n" + ;; + sapase|sapase_client) + _DIRECTORY="sapase" + ;; + sapmaxdb) + ;; + oracledb|oracledb_client) + _DIRECTORY="oracledb" + ;; + ibmdb2|ibmdb2_client|ibmdb2_license) + _DIRECTORY="ibmdb2" + ;; + saphana|saphana_client|saphana_other) + _DIRECTORY="saphana" + ;; + sap_swpm|sap_kernel|sap_igs|sap_webdisp|sap_jvm) + _DIRECTORY="sap_swpm" + _EXTRACT="n" + ;; + esac + printf "%-24s " "${_SAP_FILE_TYPE}" - if [[ ${_EXTENDED_OUTPUT}. == "y." ]]; then - printf "%s\n" "${_ARCHIVE_TYPE}" - else - printf "\n" + if [[ ${_DISPLAY_DIRECTORY}. == "y." ]]; then + printf "%-24s" "${_DIRECTORY}" + fi + if [[ ${_DISPLAY_FILE_TYPE}. == "y." ]]; then + printf "%-6s " "${_ARCHIVE_TYPE}" + fi + if [[ ${_DISPLAY_EXTRACT}. == "y." ]]; then + printf "%-2s" "${_EXTRACT}" fi + printf "\n" done diff --git a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml b/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml deleted file mode 100644 index c081d48db..000000000 --- a/roles/sap_install_media_detect/tasks/detect_backup_saphana.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- - -- name: Identify SAP HANA Backup files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: directory - patterns: '.*COMPLETE.*' - use_regex: true - register: backup_saphana_find_dir_source - -- name: SAP Install Media Detect - SAP HANA Backup files - Copy files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ line_item.path }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ backup_saphana_find_dir_source.files }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: Re-identify SAP HANA Backup files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_backup_directory }}" - recurse: true - file_type: directory - patterns: '.*COMPLETE.*' - use_regex: true - register: backup_saphana_find_dir diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml deleted file mode 100644 index 3c931aaed..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Create Directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapbw4hana_export/" - -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: file - patterns: '.*BW4.*EXPORT.*' - use_regex: true - register: bw4hana_export_files_source - -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ line_item.path }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ bw4hana_export_files_source.files }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Re-identify SAP BW/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_target_directory }}" - recurse: true - file_type: file - patterns: '.*BW4.*EXPORT.*' - use_regex: true - register: bw4hana_export_files - -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Move SAP BW/4HANA EXPORT files - ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/sapbw4hana_export/{{ item.path | basename }}" - with_items: "{{ bw4hana_export_files.files }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml deleted file mode 100644 index a7cb1dd04..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ /dev/null @@ -1,165 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP ECC EXPORT - Get info of directory 'sapecc_export_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" - register: __sap_install_media_detect_sapecc_export_extracted_stat - -- name: SAP Install Media Detect - SAP ECC EXPORT - Ensure directory 'sapecc_export_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP ECC EXPORT - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" - -- name: SAP Install Media Detect - SAP ECC EXPORT - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP ECC EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -- name: SAP Install Media Detect - SAP ECC EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_ecc_export - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP ECC EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_export_extracted ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapecc_export_extracted/ ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapecc_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC Export extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - -- name: SAP Install Media Detect - SAP ECC EXPORT - Re-list files in directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP ECC EXPORT - Re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -- name: SAP Install Media Detect - SAP ECC EXPORT - Re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC EXPORT - Re-identify SAP ECC EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_ecc_export_repeated - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -- name: SAP Install Media Detect - SAP ECC EXPORT - Move SAP ECC EXPORT compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/{{ item }}" - with_items: - - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml deleted file mode 100644 index 521813754..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ /dev/null @@ -1,165 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Get info of directory 'sapecc_ides_export_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" - register: __sap_install_media_detect_sapecc_ides_export_extracted_stat - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT- Ensure directory 'sapecc_ides_export_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_ecc_export - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_ides_export_extracted ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapecc_ides_export_extracted/ ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapecc_ides_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" - recurse: true - file_type: directory - patterns: '.*EXP.*' - use_regex: true - register: detect_directory_export_extracted - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-list files in directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Re-identify SAP ECC IDES EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_ecc_export_repeated - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Move SAP ECC IDES EXPORT compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/{{ item }}" - with_items: - - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml deleted file mode 100644 index 3942e55e6..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ /dev/null @@ -1,165 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Get info of directory 'sapnwas_abap_export_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" - register: __sap_install_media_detect_sapnwas_abap_export_extracted_stat - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Ensure directory 'sapnwas_abap_export_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: no - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: no - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_nwas_abap_export - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_abap_export_extracted ; fi - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapnwas_abap_export_extracted/ ; fi - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapnwas_abap_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-list files in directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_nwas_abap_export_repeated - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Move EXPORT compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" - with_items: - - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml deleted file mode 100644 index 717a28eea..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ /dev/null @@ -1,165 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Get info of directory 'sapnwas_java_export_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" - register: __sap_install_media_detect_sapnwas_java_export_extracted_stat - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Ensure directory 'sapnwas_java_export_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_nwas_java_export - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_java_export_extracted ; fi - with_items: - - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}{{ sap_install_media_detect_rar_extract_argument }}" sapnwas_java_export_extracted/ ; fi - with_items: - - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapnwas_java_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-list files in directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi - register: detect_directory_files_rar_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then - if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then - echo '{{ item }}' - fi - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then - if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP'; then - echo '{{ item }}' - fi - fi - register: detect_directory_files_nwas_java_export_repeated - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - move EXPORT compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/{{ item }}" - with_items: - - "{{ detect_directory_files_nwas_java_export_repeated.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml deleted file mode 100644 index d862d5424..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Create Directories - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/saps4hana_export/" - -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Identify SAP S/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: file - patterns: '.*S4.*EXPORT.*' - use_regex: true - register: s4hana_export_files_source - -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ line_item.path }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ s4hana_export_files_source.files }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Re-Identify SAP S/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: file - patterns: '.*S4.*EXPORT.*' - use_regex: true - register: s4hana_export_files - -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Move SAP S/4HANA EXPORT files - ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/saps4hana_export/{{ item.path | basename }}" - with_items: "{{ s4hana_export_files.files }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml deleted file mode 100644 index 52e7d200d..000000000 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ /dev/null @@ -1,116 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Get info of directory 'sapsolman_abap_export_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" - register: __sap_install_media_detect_sapsolman_abap_export_extracted_stat - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Ensure directory 'sapsolman_abap_export_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_nwas_abap_export - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Copy EXPORT files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapsolman_abap_export_extracted/{{ item }} ; fi - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapsolman_abap_export_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapsolman_abap_export_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-list files in directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip_repeated -# changed_when: "item.stdout | length > 0" - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - ignore_errors: true - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Re-identify EXPORT files # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_nwas_abap_export_repeated - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Move EXPORT compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" - with_items: - - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml deleted file mode 100644 index e731eb0f3..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ /dev/null @@ -1,171 +0,0 @@ ---- - -- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" - register: __sap_install_media_detect_ibmdb2_extracted_stat - -- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_client_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" - register: __sap_install_media_detect_ibmdb2_client_extracted_stat - -- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_client_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - IBM Db2 - Get info of directory 'ibmdb2_license_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" - register: __sap_install_media_detect_ibmdb2_license_extracted_stat - -- name: SAP Install Media Detect - IBM Db2 - Ensure directory 'ibmdb2_license_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - IBM Db2 - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2/" - - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" - - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" - - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" - -- name: SAP Install Media Detect - IBM Db2 - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - IBM Db2 - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_ibmdb2 - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_ibmdb2_client - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_ibmdb2_license - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - IBM Db2 - Copy IBM Db2 files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_ibmdb2_extracted_stat.stat.exists) or - ( __sap_install_media_detect_ibmdb2_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 Client installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_ibmdb2_client_extracted_stat.stat.exists) or - ( __sap_install_media_detect_ibmdb2_client_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM Db2 OEM license file # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_ibmdb2_license_extracted_stat.stat.exists) or - ( __sap_install_media_detect_ibmdb2_license_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" - recurse: true - file_type: directory - patterns: ".*LINUXX86_64.*" - use_regex: true - register: detect_directory_ibmdb2_extracted - -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" - recurse: true - file_type: directory - patterns: ".*DATA_UNITS.*" - use_regex: true - register: detect_directory_ibmdb2_client_extracted - -- name: SAP Install Media Detect - IBM Db2 - Move IBM Db2 compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2/{{ item }}" - with_items: - - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml deleted file mode 100644 index 3d79150ad..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ /dev/null @@ -1,134 +0,0 @@ ---- - -- name: SAP Install Media Detect - Oracle DB - Get info of directory 'oracledb_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" - register: __sap_install_media_detect_oracledb_extracted_stat - -- name: SAP Install Media Detect - Oracle DB - Ensure directory 'oracledb_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - Oracle DB - Get info of directory 'oracledb_client_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" - register: __sap_install_media_detect_oracledb_client_extracted_stat - -- name: SAP Install Media Detect - Oracle DB - Ensure directory 'oracledb_client_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - Oracle DB - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/oracledb/" - - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" - - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" - -- name: SAP Install Media Detect - Oracle DB - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - Oracle DB - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_oracledb - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_oracledb_client - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - Oracle DB - Copy Oracle DB files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_oracledb_extracted_stat.stat.exists) or - ( __sap_install_media_detect_oracledb_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_oracledb_client_extracted_stat.stat.exists) or - ( __sap_install_media_detect_oracledb_client_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" - recurse: true - file_type: directory - patterns: ".*LINUX_X86_64.*" - use_regex: true - register: detect_directory_oracledb_extracted - -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" - recurse: true - file_type: directory - patterns: ".*OCL_LINUX_X86_64.*" - use_regex: true - register: detect_directory_oracledb_client_extracted - -- name: SAP Install Media Detect - Oracle DB - Move Oracle DB compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/oracledb/{{ item }}" - with_items: - - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml deleted file mode 100644 index 9e0809953..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ /dev/null @@ -1,130 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP ASE - Get info of directory 'sapase_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" - register: __sap_install_media_detect_sapase_extracted_stat - -- name: SAP Install Media Detect - SAP ASE - Ensure directory 'sapase_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP ASE - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapase/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted/" - -- name: SAP Install Media Detect - SAP ASE - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP ASE - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_sapase - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP ASE - Copy SAP ASE files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client installation media - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: file - patterns: '.*ASEBC.*' - use_regex: true - register: detect_directory_files_sapase_client - -- name: SAP Install Media Detect - SAP ASE - Copy SAP ASE files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ line_item.path }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ detect_directory_files_sapase_client.files }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapase_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapase_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP ASE - Extract SAP ASE 16.0 Client with SAPCAR - ansible.builtin.shell: | - {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name }} \ - -xvf {{ item }} \ - -manifest SIGNATURE.SMF \ - -R "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - with_items: - - "{{ detect_directory_files_sapase_client.files[0].path }}" - changed_when: true - -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" - recurse: true - file_type: directory - patterns: ".*SYBASE_LINUX.*" - use_regex: true - register: detect_directory_sapase_extracted - -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" - recurse: true - file_type: file - patterns: ".*sybodbc.*" - use_regex: true - register: detect_directory_sapase_client_extracted - -- name: SAP Install Media Detect - SAP ASE - Move SAP ASE compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapase/{{ item }}" - with_items: - - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml deleted file mode 100644 index 458f29ba5..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP MaxDB - Get info of directory 'sapmaxdb_extracted' - ansible.builtin.stat: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - register: __sap_install_media_detect_sapmaxdb_extracted_stat - -- name: SAP Install Media Detect - SAP MaxDB - Ensure directory 'sapmaxdb_extracted' is absent - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - state: absent - when: - - not sap_install_media_detect_skip_extraction_if_target_dir_exists - -- name: SAP Install Media Detect - SAP MaxDB - Ensure directories exist - ansible.builtin.file: - path: "{{ item }}" - state: directory - mode: '0755' - owner: root - group: root - with_items: - - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/" - - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - -- name: SAP Install Media Detect - SAP MaxDB - List files in source directory - ansible.builtin.command: find . -maxdepth 1 -type f - register: detect_directory_files - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - changed_when: false - -- name: SAP Install Media Detect - SAP MaxDB - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi - register: detect_directory_files_zip - with_items: - - "{{ detect_directory_files.stdout_lines }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - ignore_errors: true - changed_when: false - -# Reason for noqa: grep -q with pipefail shell option returns 141 instead of 0 -- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB installation media # noqa risky-shell-pipe - ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi - register: detect_directory_files_sapmaxdb - changed_when: "item | length > 0" - with_items: - - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - -- name: SAP Install Media Detect - SAP MaxDB - Copy SAP MaxDB files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item }}" - remote_src: true - with_items: - - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -# Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi - with_items: - - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" - when: (not __sap_install_media_detect_sapmaxdb_extracted_stat.stat.exists) or - ( __sap_install_media_detect_sapmaxdb_extracted_stat.stat.exists and not - sap_install_media_detect_skip_extraction_if_target_dir_exists) - -- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - recurse: true - file_type: directory - patterns: '.*MaxDB_7.9.*' - use_regex: true - register: detect_directory_sapmaxdb_extracted - -- name: SAP Install Media Detect - SAP MaxDB - Move SAP MaxDB compressed archive files - ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/{{ item }}" - with_items: - - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapcar.yml b/roles/sap_install_media_detect/tasks/detect_sapcar.yml deleted file mode 100644 index be6c7170e..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapcar.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ __sap_install_media_detect_software_main_directory }} - ansible.builtin.shell: ls SAPCAR*.EXE - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_sapcar_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAPCAR - Set fact - ansible.builtin.set_fact: - sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" - -- name: SAP Install Media Detect - SAPCAR - Copy SAPCAR file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_sapcar_file_name }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_sapcar_file_name | basename }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAPCAR - Change ownership of SAPCAR - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name }}" - state: file - mode: '0755' - owner: root - group: root diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml deleted file mode 100644 index 216d49168..000000000 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ /dev/null @@ -1,135 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP HANA - Set fact for install media directory - ansible.builtin.set_fact: - sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" - -- name: SAP Install Media Detect - SAP HANA - Create Directory - {{ sap_hana_install_directory }} - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}" - state: directory - mode: '0755' - owner: root - group: root - -# IMDB SAR Files -- name: SAP Install Media Detect - SAP HANA - Get all IMDB SAR files in folder - {{ __sap_install_media_detect_software_main_directory }} - ansible.builtin.shell: ls IMDB*.SAR - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: imdb_sarfiles_list - changed_when: false - -- name: SAP Install Media Detect - SAP HANA - Set fact list of SAR files - ansible.builtin.set_fact: - sap_hana_install_imdb_sar: "{{ imdb_sarfiles_list.stdout.split() }}" - when: - - not( imdb_sarfiles_list.stdout == '' ) - -- name: SAP Install Media Detect - SAP HANA - Copy all IMDB SAR files to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ line_item.path | basename }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ sap_hana_install_imdb_sar }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP HANA - Copy SAP HANA files - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ item }} {{ __sap_install_media_detect_software_main_directory }}/sap_hana/{{ item }} - loop: "{{ sap_hana_install_imdb_sar }}" - when: - - not( imdb_sarfiles_list.stdout == '' ) - -- name: SAP Install Media Detect - SAP HANA - Check availability of software path - {{ sap_hana_install_directory }} - ansible.builtin.stat: - path: "{{ sap_hana_install_directory }}" - register: sap_hana_install_software_path_stat - failed_when: not sap_hana_install_software_path_stat.stat.exists - -- name: SAP Install Media Detect - SAP HANA - Change ownership of software path - {{ sap_hana_install_directory }} - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}" - state: directory - recurse: yes - mode: '0755' - owner: root - group: root - -- name: SAP Install Media Detect - SAP HANA - Copy SAPCAR file - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} - changed_when: true - -# Create directory {{ sap_hana_install_directory }}/extracted -# This is where all extracted .SAR files will be stored -- name: SAP Install Media Detect - SAP HANA - Remove directory - {{ sap_hana_install_directory }}/extracted - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}/extracted" - state: absent - -- name: SAP Install Media Detect - SAP HANA - Create directory - {{ sap_hana_install_directory }}/extracted - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}/extracted" - state: directory - mode: '0755' - -- name: SAP Install Media Detect - SAP HANA - Change ownership of deployment directory - {{ sap_hana_install_directory }} - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}" - state: directory - recurse: yes - mode: '0755' - owner: root - group: root - -- name: SAP Install Media Detect - SAP HANA - Get all SAR files in folder - {{ sap_hana_install_directory }} - ansible.builtin.shell: ls *.SAR - args: - chdir: "{{ sap_hana_install_directory }}" - register: sarfiles_list - changed_when: false - -- name: SAP Install Media Detect - SAP HANA - Set fact for list of SAR files - ansible.builtin.set_fact: - sap_hana_install_components_sar: "{{ sarfiles_list.stdout.split() }}" - when: - - not( sarfiles_list.stdout == '' ) - -- name: SAP Install Media Detect - SAP HANA - Extract all SAR files in folder - {{ sap_hana_install_directory }} - ansible.builtin.include_tasks: ./extract/sapcar_loop_handler_saphana.yml - register: extract_all_sar_files - loop: "{{ sap_hana_install_components_sar }}" - loop_control: - loop_var: passed_sap_hana_install_components_sar - when: - - not( sarfiles_list.stdout == '' ) - -- name: SAP Install Media Detect - SAP HANA - Change ownership of software path - {{ sap_hana_install_directory }} - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}" - state: directory - recurse: yes - mode: '0755' - owner: root - group: root - -- name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_DATABASE - ansible.builtin.find: - paths: "{{ sap_hana_install_directory }}" - recurse: true - file_type: directory - patterns: "SAP_HANA_DATABASE" - register: sap_hana_database - -- name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_CLIENT for SAP SWPM - ansible.builtin.find: - paths: "{{ sap_hana_install_directory }}" - recurse: true - file_type: directory - patterns: "SAP_HANA_CLIENT" - register: sap_hana_client_path - ignore_errors: true diff --git a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml deleted file mode 100644 index 8a9a93e82..000000000 --- a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml +++ /dev/null @@ -1,33 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP Host Agent - Set fact for install media directory - ansible.builtin.set_fact: - sap_hostagent_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hostagent" - -- name: SAP Install Media Detect - SAP Host Agent - Create Directory - {{ sap_hostagent_install_directory }} - ansible.builtin.file: - path: "{{ sap_hostagent_install_directory }}" - state: directory - mode: '0755' - owner: root - group: root - -# SAPHOSTAGENT -- name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ sap_install_media_detect_source_directory }} - ansible.builtin.shell: ls SAPHOSTAGENT*SAR - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: saphostagent_sarfile - changed_when: false - -- name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ saphostagent_sarfile.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ saphostagent_sarfile.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file to subdirectory - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ saphostagent_sarfile.stdout }} {{ sap_hostagent_install_directory }}/{{ saphostagent_sarfile.stdout }} - changed_when: true diff --git a/roles/sap_install_media_detect/tasks/detect_sapigs.yml b/roles/sap_install_media_detect/tasks/detect_sapigs.yml deleted file mode 100644 index cb8b3002b..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapigs.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP IGS - Get IGS from software path in source directory - ansible.builtin.shell: ls igsexe*.sar - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_igs_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP IGS - Copy SAP IGS file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_igs_file_name_get.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_igs_file_name_get.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP IGS - Set fact for IGS - ansible.builtin.set_fact: - sap_swpm_igs_path: "{{ sap_swpm_software_path }}" - sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}" - -# failed_when will trigger if more than 1 igsexe is identified and added to the register -- name: SAP Install Media Detect - SAP IGS - Check availability of IGS - {{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }}" - register: sap_swpm_igs_file_name_stat - failed_when: not sap_swpm_igs_file_name_stat.stat.exists - -# 4. IGS Helper -- name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path in source directory - ansible.builtin.shell: ls igshelper*.sar - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_igs_helper_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP IGS - Copy SAP IGS helper file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_igs_helper_file_name_get.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_igs_helper_file_name_get.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP IGS - Set fact for IGS - ansible.builtin.set_fact: - sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" - sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" - -- name: SAP Install Media Detect - SAP IGS - Check availability of IGS Helper - {{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }}" - register: sap_swpm_igs_helper_file_name_stat - failed_when: not sap_swpm_igs_helper_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml deleted file mode 100644 index 44f5985e3..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- - -# 5. SAPEXEDB -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path in source directory - ansible.builtin.shell: ls SAPEXEDB_*.SAR - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_kernel_dependent_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP Kernel - Copy SAPEXEDB file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB - ansible.builtin.set_fact: - sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" - sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" - -- name: SAP Install Media Detect - SAP Kernel - Check availability of SAPEXEDB - {{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }}" - register: sap_swpm_kernel_dependent_file_name_stat - failed_when: not sap_swpm_kernel_dependent_file_name_stat.stat.exists - -# 6. SAPEXE -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path in source directory - ansible.builtin.shell: ls SAPEXE_*.SAR - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_kernel_independent_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP Kernel - Copy SAPEXEDB file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_kernel_independent_file_name_get.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_kernel_independent_file_name_get.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE - ansible.builtin.set_fact: - sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" - sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" - -- name: SAP Install Media Detect - SAP Kernel - Check availability of SAPEXE - {{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }}" - register: sap_swpm_kernel_independent_file_name_stat - failed_when: not sap_swpm_kernel_independent_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml deleted file mode 100644 index 0dce8edae..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP SWPM - Set fact for install media directory - ansible.builtin.set_fact: - sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" - sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" - -- name: SAP Install Media Detect - SAP SWPM - Create Directory - {{ sap_swpm_install_directory }} - ansible.builtin.file: - path: "{{ sap_swpm_install_directory }}" - state: directory - mode: '0755' - owner: root - group: root - -- name: SAP Install Media Detect - SAP SWPM - Copy SAPCAR file - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_swpm_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} - changed_when: true - -# SWPM -- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_install_media_detect_source_directory }} - ansible.builtin.shell: ls SWPM*.SAR - args: - chdir: "{{ sap_install_media_detect_source_directory }}" - register: sap_swpm_swpm_sar_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP SWPM - Copy SWPM file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ sap_install_media_detect_source_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }}" - remote_src: true - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP SWPM - Copy SWPM file to sap_swpm subdirectory - ansible.builtin.shell: | - cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }} {{ __sap_install_media_detect_software_main_directory }}/sap_swpm/{{ sap_swpm_swpm_sar_file_name_get.stdout }} - changed_when: true - -- name: SAP Install Media Detect - SAP SWPM - Check availability of software path - {{ sap_swpm_software_path }} - ansible.builtin.stat: - path: "{{ sap_swpm_software_path }}" - register: sap_swpm_software_path_stat - failed_when: not sap_swpm_software_path_stat.stat.exists - -- name: SAP Install Media Detect - SAP SWPM - Change ownership of software path - {{ sap_swpm_software_path }} - ansible.builtin.file: - path: "{{ sap_swpm_software_path }}" - state: directory - recurse: yes - mode: '0755' - owner: root - group: root - - -# SWPM Path - -- name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM path - {{ sap_swpm_swpm_path }} - ansible.builtin.stat: - path: "{{ sap_swpm_swpm_path }}" - register: sap_swpm_swpm_path_stat - failed_when: not sap_swpm_swpm_path_stat.stat.exists - -- name: SAP Install Media Detect - SAP SWPM - Change ownership of SWPM path - {{ sap_swpm_swpm_path }} - ansible.builtin.file: - path: "{{ sap_swpm_swpm_path }}" - state: directory - recurse: yes - mode: '0755' - owner: root - group: root - - -################ -# Get software files from software paths -################ - -# 2. SWPM - -- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_swpm_swpm_path }} - ansible.builtin.shell: ls SWPM*.SAR - args: - chdir: "{{ sap_swpm_swpm_path }}" - register: sap_swpm_swpm_sar_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAP SWPM - Set fact for SWPM - ansible.builtin.set_fact: - sap_swpm_swpm_sar_file_name: "{{ sap_swpm_swpm_sar_file_name_get.stdout }}" - -- name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }}" - register: sap_swpm_swpm_sar_file_name_stat - failed_when: not sap_swpm_swpm_sar_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml deleted file mode 100644 index 8456e1dc0..000000000 --- a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- - -# 7. Web Dispatcher -- name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path in source directory - ansible.builtin.shell: ls SAPWEBDISP_*.SAR - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" -# chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_web_dispatcher_file_name_get - ignore_errors: true - changed_when: false - -- name: SAP Install Media Detect - SAP WebDisp - Copy WEBDISP file to {{ sap_install_media_detect_target_directory }} - ansible.builtin.copy: - src: "{{ line_item.path }}" - dest: "{{ sap_install_media_detect_target_directory }}/{{ line_item.path | basename }}" - remote_src: true - loop: - "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" - loop_control: - loop_var: line_item - when: sap_install_media_detect_source == 'remote_dir' - -- name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP - ansible.builtin.set_fact: - sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" - sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" - ignore_errors: true - -- name: SAP Install Media Detect - SAP WebDisp - Check availability of WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} - ansible.builtin.stat: - path: "{{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }}" - register: sap_swpm_web_dispatcher_file_name_stat - failed_when: not sap_swpm_web_dispatcher_file_name_stat.stat.exists - ignore_errors: true diff --git a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml deleted file mode 100644 index b99da95da..000000000 --- a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- - -- name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Create temp dir - {{ sap_hana_install_directory }}/tmp - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}/tmp" - state: directory - mode: '0700' - -- name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Extracting {{ passed_sap_hana_install_components_sar }} - ansible.builtin.command: >- - {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} \ - -R {{ sap_hana_install_directory }}/tmp - -xvf {{ sap_hana_install_directory }}/{{ passed_sap_hana_install_components_sar }} \ - -manifest SIGNATURE.SMF - register: sap_hana_install_extract - args: - chdir: "{{ sap_hana_install_directory }}" - changed_when: "'SAPCAR: processing archive' in sap_hana_install_extract.stdout" - -- name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Create directory if SAP Host Agent - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}/tmp/SAP_HOST_AGENT" - state: directory - mode: '0755' - owner: root - group: root - when: "'SAPHOST' in passed_sap_hana_install_components_sar" - -- name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Prepare extracted dir - ansible.builtin.shell: | - extracted_dir=$(ls -d */) - cp SIGNATURE.SMF $extracted_dir - cp -R $extracted_dir ../extracted/$extracted_dir - args: - chdir: "{{ sap_hana_install_directory }}/tmp" - changed_when: true - -- name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Remove temp dir - {{ sap_hana_install_directory }}/tmp - ansible.builtin.file: - path: "{{ sap_hana_install_directory }}/tmp" - state: absent diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 27a14ee2d..ccd3a392d 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -45,118 +45,8 @@ - name: SAP Install Media Detect - Organize all files ansible.builtin.include_tasks: organize_all_files.yml -#- name: SAP Install Media Detect - Organize SAPCAR -# ansible.builtin.include_tasks: detect_sapcar.yml - -#- name: SAP Install Media Detect - Organize SAP HANA installation media files -# ansible.builtin.include_tasks: detect_saphana.yml -# when: -# - sap_install_media_detect_db == "saphana" - -#- name: SAP Install Media Detect - Organize SAP SWPM installation media files -# ansible.builtin.include_tasks: detect_sapswpm.yml -# when: -# - sap_install_media_detect_swpm - -#- name: SAP Install Media Detect - Organize SAP Host Agent installation media files -# ansible.builtin.include_tasks: detect_saphostagent.yml -# when: -# - sap_install_media_detect_hostagent - -#- name: SAP Install Media Detect - Organize SAP IGS installation media files -# ansible.builtin.include_tasks: detect_sapigs.yml -# when: -# - sap_install_media_detect_igs - -#- name: SAP Install Media Detect - Organize SAP Kernel installation media files -# ansible.builtin.include_tasks: detect_sapkernel.yml -# when: -# - sap_install_media_detect_kernel - -#- name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files -# ansible.builtin.include_tasks: detect_sapwebdisp.yml -# when: -# - sap_install_media_detect_webdisp - -#- name: SAP Install Media Detect - Complete Data Backup files for SAP HANA -# ansible.builtin.include_tasks: detect_backup_saphana.yml -# when: -# - sap_install_media_detect_backup == "saphana" - -# Detect files which (historically) have filenames which are Numbered IDs only (e.g. 51054410_2 for SAP MaxDB 7.9) -# Leave to last so directory has less files to scan - -#- name: SAP Install Media Detect - Organize SAP ASE installation media files -# ansible.builtin.include_tasks: detect_sapanydb_sapase.yml -# when: -# - sap_install_media_detect_db == "sapase" - -#- name: SAP Install Media Detect - Organize SAP MaxDB installation media files -# ansible.builtin.include_tasks: detect_sapanydb_sapmaxdb.yml -# when: -# - sap_install_media_detect_db == "sapmaxdb" - -#- name: SAP Install Media Detect - Organize Oracle DB installation media files -# ansible.builtin.include_tasks: detect_sapanydb_oracledb.yml -# when: -# - sap_install_media_detect_db == "oracledb" - -#- name: SAP Install Media Detect - Organize IBM Db2 installation media files -# ansible.builtin.include_tasks: detect_sapanydb_ibmdb2.yml -# when: -# - sap_install_media_detect_db == "ibmdb2" - -#- name: SAP Install Media Detect - EXPORT files for SAP ECC -# ansible.builtin.include_tasks: detect_export_sapecc.yml -# when: sap_install_media_detect_export == "sapecc" - -#- name: SAP Install Media Detect - EXPORT files for SAP ECC IDES -# ansible.builtin.include_tasks: detect_export_sapecc_ides.yml -# when: sap_install_media_detect_export == "sapecc_ides" - -#- name: SAP Install Media Detect - EXPORT files for SAP S/4HANA -# ansible.builtin.include_tasks: detect_export_saps4hana.yml -# when: -# - sap_install_media_detect_export == "saps4hana" - -#- name: SAP Install Media Detect - EXPORT files for SAP BW/4HANA -# ansible.builtin.include_tasks: detect_export_sapbw4hana.yml -# when: -# - sap_install_media_detect_export == "sapbw4hana" - -#- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only -# ansible.builtin.include_tasks: detect_export_sapnwas_abap.yml -# when: sap_install_media_detect_export == "sapnwas_abap" - -#- name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only -# ansible.builtin.include_tasks: detect_export_sapnwas_java.yml -# when: sap_install_media_detect_export == "sapnwas_java" - -#- name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) -# ansible.builtin.include_tasks: detect_export_sapsolman_abap.yml -# when: -# - sap_install_media_detect_export == "sapsolman_abap" - - name: SAP Install Media Detection Completed - set global vars for subsequent Ansible Tasks - ansible.builtin.include_tasks: set_global_vars_v2.yml - -# Output of detected SAP Software - -- name: SAP Install Media Detection Completed - Display Paths for SAP HANA - ansible.builtin.debug: - msg: - - "SAP HANA Path - {{ sap_hana_install_directory }}" - when: - - sap_install_media_detect_db == "saphana" - -- name: SAP Install Media Detection Completed - Display Paths for SAP SWPM - ansible.builtin.debug: - msg: - - "SAP SWPM Software Path - {{ sap_swpm_software_path }}" - - "SAP SWPM SAPCAR Path - {{ sap_swpm_sapcar_path }}" - - "SAP SWPM Path - {{ sap_swpm_swpm_path }}" - when: - - sap_install_media_detect_swpm + ansible.builtin.include_tasks: set_global_vars.yml - name: SAP Install Media Detect - Cleanup - Disable the EPEL repo if necessary ansible.builtin.include_tasks: diff --git a/roles/sap_install_media_detect/tasks/organize_all_files.yml b/roles/sap_install_media_detect/tasks/organize_all_files.yml index 962cfc2f3..f39aeecad 100644 --- a/roles/sap_install_media_detect/tasks/organize_all_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_all_files.yml @@ -17,24 +17,31 @@ ansible.builtin.file: path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" state: directory + owner: root + group: root + mode: '0755' loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item when: - line_item.archive_type == 'zip' or - line_item.archive_type == 'rarexe' or - line_item.archive_type == 'rar' or - line_item.archive_type == 'sapcar' + line_item.extract_archive == 'y' and + (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') - name: SAP Install Media Detect - Organize all files - Create target directories ansible.builtin.file: - path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}" + path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.archive_dir }}" state: directory + owner: root + group: root + mode: '0755' loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item when: - line_item.archive_type == 'zip' or + line_item.archive_type == 'zip' or line_item.archive_type == 'rarexe' or line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar' @@ -47,7 +54,8 @@ loop_control: loop_var: line_item when: - line_item.archive_type == 'zip' + - line_item.archive_type == 'zip' + - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract rar archive files ansible.builtin.shell: "set -o pipefail && {{ sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ sap_install_media_detect_rar_extract_argument }} {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" @@ -57,7 +65,8 @@ loop_control: loop_var: line_item when: - line_item.archive_type == 'rarexe' + - line_item.archive_type == 'rarexe' + - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" @@ -67,7 +76,8 @@ loop_control: loop_var: line_item when: - line_item.archive_type == 'sapcar' + - line_item.archive_type == 'sapcar' + - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Copy sapcar to sap_swpm directory ansible.builtin.copy: @@ -80,8 +90,8 @@ when: sap_install_media_detect_swpm -- name: SAP Install Media Detect - Organize all files - Move all archives files into subdirectories - ansible.builtin.shell: "set -o pipefail && mv {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}/{{ line_item.file }}" +- name: SAP Install Media Detect - Organize all files - Move all archive files into subdirectories + ansible.builtin.shell: "set -o pipefail && mv {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.archive_dir }}/{{ line_item.file }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 85b83d0f1..4eee9389e 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -23,7 +23,7 @@ loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" - name: SAP Install Media Detect - Prepare - Iterate over files and determine file type - ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -l {{ line_item }} | awk '{print $(NF-1), $NF}' + ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -lde {{ line_item }} | awk '{print $(NF-3), $(NF-2), $(NF-1), $NF}' register: __sap_install_media_detect_register_files_phase_2 loop: "{{ __sap_install_media_detect_fact_find_result_phase_2 }}" loop_control: @@ -39,7 +39,9 @@ dir: "{{ item.line_item | dirname }}" file: "{{ item.line_item | basename }}" sap_file_type: "{{ item.stdout.split(' ')[0] }}" - archive_type: "{{ item.stdout.split(' ')[1] }}" + archive_dir: "{{ item.stdout.split(' ')[1] }}" + archive_type: "{{ item.stdout.split(' ')[2] }}" + extract_archive: "{{ item.stdout.split(' ')[3] }}" when: (item.stdout.split(' ')[0] == 'sapcar') or (sap_install_media_detect_swpm | d('false') and item.stdout.split(' ')[0] == 'sap_swpm') or @@ -47,19 +49,24 @@ (sap_install_media_detect_igs | d('false') and item.stdout.split(' ')[0] == 'sap_igs') or (sap_install_media_detect_kernel | d('false') and item.stdout.split(' ')[0] == 'sap_kernel') or (sap_install_media_detect_webdisp | d('false') and item.stdout.split(' ')[0] == 'sap_webdisp') or - (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(' ')[0] == 'sap_db_maxdb') or + (sap_install_media_detect_db == 'saphana' and ( + item.stdout.split(' ')[0] == 'saphana' or + item.stdout.split(' ')[0] == 'saphana_client' or + item.stdout.split(' ')[0] == 'saphana_other') + ) or + (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(' ')[0] == 'sapmaxdb') or (sap_install_media_detect_db == 'sapase' and ( - item.stdout.split(' ')[0] == 'sap_db_ase' or - item.stdout.split(' ')[0] == 'sap_db_ase_client') + item.stdout.split(' ')[0] == 'sapase' or + item.stdout.split(' ')[0] == 'sapase_client') ) or (sap_install_media_detect_db == 'oracledb' and ( - item.stdout.split(' ')[0] == 'sap_db_oracle' or - item.stdout.split(' ')[0] == 'sap_db_oracle_client') + item.stdout.split(' ')[0] == 'oracledb' or + item.stdout.split(' ')[0] == 'oracledb_client') ) or (sap_install_media_detect_db == 'ibmdb2' and ( - item.stdout.split(' ')[0] == 'sap_db_db2' or - item.stdout.split(' ')[0] == 'sap_db_db2_client' or - item.stdout.split(' ')[0] == 'sap_db_db2_license') + item.stdout.split(' ')[0] == 'ibmdb2' or + item.stdout.split(' ')[0] == 'ibmdb2_client' or + item.stdout.split(' ')[0] == 'ibmdb2_license') ) or (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(' ')[0] == 'sap_s4hana_export') or (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(' ')[0] == 'sap_bw4hana_export') or diff --git a/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml b/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml index b845ed603..4572d739b 100644 --- a/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml +++ b/roles/sap_install_media_detect/tasks/prepare/provide_sapfile_utility.yml @@ -17,7 +17,3 @@ - name: SAP Install Media Detect - Prepare - Set fact for sapfile utility ansible.builtin.set_fact: __sap_install_media_detect_sapfile_path: "{{ __sap_install_media_detect_tmpdir.path }}/sapfile" - -- name: Debug 1 - debug: - msg: "__sap_install_media_detect_sapfile_path: >{{ __sap_install_media_detect_sapfile_path }}<" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 8ccd8fcb6..13736500e 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -1,125 +1,361 @@ --- -- name: SAP Install Media Detection Completed - set facts for SAP HANA +- name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ sap_install_media_detect_directory }} + ansible.builtin.shell: ls SAPCAR*.EXE + args: + chdir: "{{ sap_install_media_detect_directory }}" + register: sap_swpm_sapcar_file_name_get + changed_when: false + +- name: SAP Install Media Detect - SAPCAR - Set fact + ansible.builtin.set_fact: + sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" + +- name: SAP Install Media Detection Completed - Set facts for SAP SWPM + ansible.builtin.set_fact: + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role + sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_swpm + +- name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_CLIENT for SAP SWPM + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}" + recurse: true + file_type: directory + patterns: "SAP_HANA_CLIENT" + register: sap_hana_client_path + ignore_errors: true + when: sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detection Completed - Set facts for SAP HANA ansible.builtin.set_fact: - sap_hana_install_software_directory: "{{ sap_hana_install_directory }}" # for sap_hana_install Ansible Role - sap_hana_install_software_extract_directory: "{{ sap_hana_install_directory }}/extracted" # for sap_hana_install Ansible Role + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" + sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" # for sap_hana_install Ansible Role + sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana_extracted" # for sap_hana_install Ansible Role sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_db == "saphana" + when: sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" + recurse: true + file_type: directory + patterns: ".*LINUXX86_64.*" + use_regex: true + register: detect_directory_ibmdb2_extracted + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" + recurse: true + file_type: directory + patterns: ".*DATA_UNITS.*" + use_regex: true + register: detect_directory_ibmdb2_client_extracted + when: sap_install_media_detect_db == "ibmdb2" -- name: SAP Install Media Detection Completed - set facts for IBM Db2 +- name: SAP Install Media Detection Completed - Set facts for IBM Db2 ansible.builtin.set_fact: sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_db == "ibmdb2" + when: sap_install_media_detect_db == "ibmdb2" -- name: SAP Install Media Detection Completed - set facts for Oracle DB +- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" + recurse: true + file_type: directory + patterns: ".*LINUX_X86_64.*" + use_regex: true + register: detect_directory_oracledb_extracted + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" + recurse: true + file_type: directory + patterns: ".*OCL_LINUX_X86_64.*" + use_regex: true + register: detect_directory_oracledb_client_extracted + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detection Completed - Set facts for Oracle DB ansible.builtin.set_fact: sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_db == "oracledb" + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" + recurse: true + file_type: directory + patterns: ".*SYBASE_LINUX.*" + use_regex: true + register: detect_directory_sapase_extracted + when: sap_install_media_detect_db == "sapase" -- name: SAP Install Media Detection Completed - set facts for SAP ASE +- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" + recurse: true + file_type: file + patterns: ".*sybodbc.*" + use_regex: true + register: detect_directory_sapase_client_extracted + when: sap_install_media_detect_db == "sapase" + +- name: SAP Install Media Detection Completed - Set facts for SAP ASE ansible.builtin.set_fact: sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_db == "sapase" + when: sap_install_media_detect_db == "sapase" + +- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" + recurse: true + file_type: directory + patterns: '.*MaxDB_7.9.*' + use_regex: true + register: detect_directory_sapmaxdb_extracted + when: sap_install_media_detect_db == "sapmaxdb" -- name: SAP Install Media Detection Completed - set facts for SAP MaxDB +- name: SAP Install Media Detection Completed - Set facts for SAP MaxDB ansible.builtin.set_fact: sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_db == "sapmaxdb" + when: sap_install_media_detect_db == "sapmaxdb" + +- name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path + ansible.builtin.shell: | + ls SAPEXEDB_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_kernel_dependent_file_name_get + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path + ansible.builtin.shell: | + ls SAPEXE_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_kernel_independent_file_name_get + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE + ansible.builtin.set_fact: + sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - SAP IGS - Get IGS from software path + ansible.builtin.shell: | + ls igsexe*.sar + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_igs_file_name_get + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - SAP IGS - Set fact for IGS + ansible.builtin.set_fact: + sap_swpm_igs_path: "{{ sap_swpm_software_path }}" + sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}" + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path + ansible.builtin.shell: | + ls igshelper*.sar + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_igs_helper_file_name_get + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - SAP IGS - Set fact for IGS Helper + ansible.builtin.set_fact: + sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" + sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path + ansible.builtin.shell: | + ls SAPWEBDISP_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_web_dispatcher_file_name_get + ignore_errors: true + when: sap_install_media_detect_webdisp + +- name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP + ansible.builtin.set_fact: + sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" + sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" + ignore_errors: true + when: sap_install_media_detect_webdisp + +- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC Export extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapecc" -- name: SAP Install Media Detection Completed - set facts for Export of SAP ECC +- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapecc" + when: sap_install_media_detect_export == "sapecc" -- name: SAP Install Media Detection Completed - set facts for Export of SAP ECC IDES +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" + recurse: true + file_type: directory + patterns: '.*EXP.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapecc_ides" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC IDES ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt1_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt2_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapecc_ides" + when: sap_install_media_detect_export == "sapecc_ides" + +- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Re-Identify SAP S/4HANA EXPORT files + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" + recurse: true + file_type: file + patterns: '.*S4.*EXPORT.*' + use_regex: true + register: s4hana_export_files + when: sap_install_media_detect_export == "saps4hana" -- name: SAP Install Media Detection Completed - set facts for Export of SAP S/4HANA +- name: SAP Install Media Detection Completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "saps4hana" + when: sap_install_media_detect_export == "saps4hana" -- name: SAP Install Media Detection Completed - set facts for Export of SAP BW/4HANA +- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files + ansible.builtin.find: + paths: "{{ sap_install_media_detect_target_directory }}" + recurse: true + file_type: file + patterns: '.*BW4.*EXPORT.*' + use_regex: true + register: bw4hana_export_files + when: sap_install_media_detect_export == "sapbw4hana" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapbw4hana" + when: sap_install_media_detect_export == "sapbw4hana" + +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_abap" -- name: SAP Install Media Detection Completed - set facts for Export of SAP NetWeaver AS (ABAP) platform only +- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapnwas_abap" + when: sap_install_media_detect_export == "sapnwas_abap" -- name: SAP Install Media Detection Completed - set facts for Export of SAP NetWeaver AS (JAVA) platform only +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_java" + +- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapnwas_java" + when: sap_install_media_detect_export == "sapnwas_java" + +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT extracted + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapsolman_abap" -- name: SAP Install Media Detection Completed - set facts for Export of SAP Solution Manager (ABAP) +- name: SAP Install Media Detection Completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt1_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt2_path: "{{ detect_directory_export_extracted.files[1].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: - - sap_install_media_detect_export == "sapsolman_abap" + when: sap_install_media_detect_export == "sapsolman_abap" -- name: SAP Install Media Detection Completed - set facts for SAP SWPM +- name: SAP Install Media Detection Completed - Set fact for displaying all variables ansible.builtin.set_fact: - sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role - ignore_errors: true - when: - - sap_install_media_detect_swpm - -- name: SAP Install Media Detection Completed - set fact for displaying all variables - ansible.builtin.set_fact: - __sap_install_media_detect_vars="{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" + __sap_install_media_detect_vars: "{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" loop: + - sap_hana_install_directory - sap_hana_install_software_directory - sap_hana_install_software_extract_directory - - sap_swpm_cd_rdms_path - - sap_swpm_cd_ibmdb2_path - - sap_swpm_cd_ibmdb2_client_path - sap_anydb_install_oracle_extract_path + - sap_swpm_swpm_path + - sap_swpm_software_path + - sap_swpm_cd_ibmdb2_path - sap_swpm_cd_oracle_path - - sap_swpm_cd_oracle_client_path - sap_swpm_cd_sapase_path - - sap_swpm_cd_sapase_client_path - sap_swpm_cd_sapmaxdb_path + - sap_swpm_cd_rdms_path + - sap_swpm_cd_ibmdb2_client_path + - sap_swpm_cd_oracle_client_path + - sap_swpm_cd_sapase_client_path - sap_swpm_cd_export_path - sap_swpm_cd_export_pt1_path - sap_swpm_cd_export_pt2_path - sap_swpm_sapcar_path + - sap_swpm_sapcar_file_name + - sap_swpm_igs_path + - sap_swpm_igs_file_name + - sap_swpm_igs_helper_path + - sap_swpm_igs_helper_file_name + - sap_swpm_kernel_dependent_path + - sap_swpm_kernel_dependent_file_name + - sap_swpm_kernel_independent_path + - sap_swpm_kernel_independent_file_name + - sap_swpm_web_dispatcher_path + - sap_swpm_web_dispatcher_file_name - name: SAP Install Media Detection Completed - Display all variables ansible.builtin.debug: diff --git a/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml b/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml deleted file mode 100644 index 90266f10f..000000000 --- a/roles/sap_install_media_detect/tasks/set_global_vars_v2.yml +++ /dev/null @@ -1,154 +0,0 @@ ---- - -- name: SAP Install Media Detection Completed - Set facts for SAP HANA - ansible.builtin.set_fact: - sap_hana_install_software_directory: "{{ sap_hana_install_directory }}" # for sap_hana_install Ansible Role - sap_hana_install_software_extract_directory: "{{ sap_hana_install_directory }}/extracted" # for sap_hana_install Ansible Role - sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role # <--- TODO - ignore_errors: true - when: sap_install_media_detect_db == "saphana" - -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_db_db2_extracted" - recurse: true - file_type: directory - patterns: ".*LINUXX86_64.*" - use_regex: true - register: detect_directory_ibmdb2_extracted - when: sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_db_db2_client_extracted" - recurse: true - file_type: directory - patterns: ".*DATA_UNITS.*" - use_regex: true - register: detect_directory_ibmdb2_client_extracted - when: sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detection Completed - Set facts for IBM Db2 - ansible.builtin.set_fact: - sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detection Completed - Set facts for Oracle DB # <--- TODO - ansible.builtin.set_fact: - sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role - sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_db == "oracledb" - -- name: SAP Install Media Detection Completed - Set facts for SAP ASE # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_db == "sapase" - -- name: SAP Install Media Detection Completed - Set facts for SAP MaxDB # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_db == "sapmaxdb" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "sapecc" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC IDES # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "sapecc_ides" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP S/4HANA # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "saps4hana" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP BW/4HANA # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "sapbw4hana" - -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapnwas_abap" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "sapnwas_abap" - -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapnwas_java" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_export == "sapnwas_java" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP Solution Manager (ABAP) # <--- TODO - ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ detect_directory_export_extracted.files[1].path }}" # for sap_swpm Ansible Role - ignore_errors: true - when: - - sap_install_media_detect_export == "sapsolman_abap" - -- name: SAP Install Media Detection Completed - Set facts for SAP SWPM - ansible.builtin.set_fact: - sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role - ignore_errors: true - when: sap_install_media_detect_swpm - -- name: SAP Install Media Detection Completed - Set fact for displaying all variables - ansible.builtin.set_fact: - __sap_install_media_detect_vars="{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" - loop: - - sap_hana_install_software_directory - - sap_hana_install_software_extract_directory - - sap_swpm_cd_rdms_path - - sap_swpm_cd_ibmdb2_path - - sap_swpm_cd_ibmdb2_client_path - - sap_anydb_install_oracle_extract_path - - sap_swpm_cd_oracle_path - - sap_swpm_cd_oracle_client_path - - sap_swpm_cd_sapase_path - - sap_swpm_cd_sapase_client_path - - sap_swpm_cd_sapmaxdb_path - - sap_swpm_cd_export_path - - sap_swpm_cd_export_pt1_path - - sap_swpm_cd_export_pt2_path - - sap_swpm_sapcar_path - -- name: SAP Install Media Detection Completed - Display all variables - ansible.builtin.debug: - msg: "{{ __sap_install_media_detect_vars.split('\n')[:-1] }}" From 9aaab0fed10ce1424563a6b308e09ca89794346f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 18:26:08 +0200 Subject: [PATCH 004/179] sap_install_media_detect: separate detect from setting vars Also implement more tags and describe them in the README.md file No longer support sap_install_media_detect_skip_extraction_if_target_dir_exists because this behavior can be in part achieved by skipping tag sap_install_media_detect_organize_files. --- roles/sap_install_media_detect/README.md | 9 +- .../defaults/main.yml | 5 - .../tasks/detect_files_after_extraction.yml | 207 +++++++++++++++ roles/sap_install_media_detect/tasks/main.yml | 27 +- ...anize_all_files.yml => organize_files.yml} | 14 + .../prepare/create_file_list_phase_2.yml | 2 +- .../tasks/set_global_vars.yml | 242 ++---------------- 7 files changed, 272 insertions(+), 234 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml rename roles/sap_install_media_detect/tasks/{organize_all_files.yml => organize_files.yml} (88%) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index 32912f80f..e1a6b9c99 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -25,9 +25,14 @@ This role does not depend on any other Ansible Role. With the following tags, the role can be called to perform certain activities only: - tag `sap_install_media_detect_rar_handling`: Only perform the tasks for enabling the listing and extracting of files of type `RAR`. This includes enabling and disabling the EPEL repo for RHEL systems, if desired. -- tag `sap_install_media_detect_add_rar_extension`: Only add `.rar` to any files in `sap_install_media_detect_source_directory` which are of type `RAR` and have no ending. Needs to be used with tag `sap_install_media_detect_create_file_list`. +- tag `sap_install_media_detect_add_file_extension`: Add file name extensions to any files in `sap_install_media_detect_source_directory` which are of type `RAR` or `ZIP` and have no ending. Needs to be used with tag `sap_install_media_detect_create_file_list_phase_1`. - tag `sap_install_media_detect_check_directories`: Find out if the directory `sap_install_media_detect_target_directory` or `sap_install_media_detect_source_directory` is writable. -- tag `sap_install_media_detect_create_file_list`: Only create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. +- tag `sap_install_media_detect_provide_sapfile_utility `: Provides the sapfile utility on the managed node. This tool is required for determining the SAP file type. +- tag `sap_install_media_detect_create_file_list_phase_1`: Create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. +- tag `sap_install_media_detect_create_file_list_phase_2`: Create a final list of all required files in `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) +- tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files in to the target directories if specified by the output of the sapfile command. +- tag `sap_install_media_detect_detect_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. +- tag `sap_install_media_detect_set_global_vars`: Set all final variables for later use by Ansible roles or tasks. ## License diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 3c57ea55e..b9463eceb 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -31,11 +31,6 @@ sap_install_media_detect_rename_target_file_exists: 'skip' # local_dir, remote_dir (e.g. NFS, s3fuse) #sap_install_media_detect_source: local_dir -# If the following parameter is set to true and the target directory for the extracted files (= *_extracted) already exists, -# the extraction of the corresponding file will be skipped. If set to false, target directories will be removed initially, -# forcing a fresh extraction, including re-creation of the target directory. -sap_install_media_detect_skip_extraction_if_target_dir_exists: false - # saphana, sapase, sapmaxdb, oracledb, ibmdb2 sap_install_media_detect_db: "saphana" diff --git a/roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml new file mode 100644 index 000000000..4340632ff --- /dev/null +++ b/roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml @@ -0,0 +1,207 @@ +--- + +- name: SAP Install Media Detect - Detect Files after extraction - Set fact for SAP kernel files + ansible.builtin.set_fact: + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for setting consecutive vars + ignore_errors: true + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAPCAR + ansible.builtin.shell: ls SAPCAR*.EXE + args: + chdir: "{{ sap_install_media_detect_directory }}" + register: sap_swpm_sapcar_file_name_get + changed_when: false + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP_HANA_CLIENT for SAP SWPM + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}" + recurse: true + file_type: directory + patterns: "SAP_HANA_CLIENT" + register: sap_hana_client_path + ignore_errors: true + when: sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detect - Detect Files after extraction - Find IBM Db2 + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" + recurse: true + file_type: directory + patterns: ".*LINUXX86_64.*" + use_regex: true + register: detect_directory_ibmdb2_extracted + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detect - Detect Files after extraction - Find IBM Db2 Client + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" + recurse: true + file_type: directory + patterns: ".*DATA_UNITS.*" + use_regex: true + register: detect_directory_ibmdb2_client_extracted + when: sap_install_media_detect_db == "ibmdb2" + +- name: SAP Install Media Detect - Detect Files after extraction - Find Oracle DB + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" + recurse: true + file_type: directory + patterns: ".*LINUX_X86_64.*" + use_regex: true + register: detect_directory_oracledb_extracted + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detect - Detect Files after extraction - Find Oracle DB Client + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" + recurse: true + file_type: directory + patterns: ".*OCL_LINUX_X86_64.*" + use_regex: true + register: detect_directory_oracledb_client_extracted + when: sap_install_media_detect_db == "oracledb" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ASE + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" + recurse: true + file_type: directory + patterns: ".*SYBASE_LINUX.*" + use_regex: true + register: detect_directory_sapase_extracted + when: sap_install_media_detect_db == "sapase" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ASE Client + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" + recurse: true + file_type: file + patterns: ".*sybodbc.*" + use_regex: true + register: detect_directory_sapase_client_extracted + when: sap_install_media_detect_db == "sapase" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP MaxDB + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" + recurse: true + file_type: directory + patterns: '.*MaxDB_7.9.*' + use_regex: true + register: detect_directory_sapmaxdb_extracted + when: sap_install_media_detect_db == "sapmaxdb" + +- debug: + msg: "sap_swpm_software_path - {{ sap_swpm_software_path }}" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAPEXEDB + ansible.builtin.shell: | + ls SAPEXEDB_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_kernel_dependent_file_name_get + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAPEXE + ansible.builtin.shell: | + ls SAPEXE_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_kernel_independent_file_name_get + when: sap_install_media_detect_kernel + +- name: SAP Install Media Detect - Detect Files after extraction - Find IGS + ansible.builtin.shell: | + ls igsexe*.sar + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_igs_file_name_get + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - Detect Files after extraction - Find IGS Helper + ansible.builtin.shell: | + ls igshelper*.sar + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_igs_helper_file_name_get + when: sap_install_media_detect_igs + +- name: SAP Install Media Detect - Detect Files after extraction - Find WEBDISP + ansible.builtin.shell: | + ls SAPWEBDISP_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_web_dispatcher_file_name_get + ignore_errors: true + when: sap_install_media_detect_webdisp + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ECC Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapecc" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ECC IDES Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" + recurse: true + file_type: directory + patterns: '.*EXP.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapecc_ides" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP S/4HANA Export + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" + recurse: true + file_type: file + patterns: '.*S4.*EXPORT.*' + use_regex: true + register: s4hana_export_files + when: sap_install_media_detect_export == "saps4hana" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP BW/4HANA Export + ansible.builtin.find: + paths: "{{ sap_install_media_detect_target_directory }}" + recurse: true + file_type: file + patterns: '.*BW4.*EXPORT.*' + use_regex: true + register: bw4hana_export_files + when: sap_install_media_detect_export == "sapbw4hana" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_abap" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapnwas_java" + +- name: SAP Install Media Detect - Detect Files after extraction - Find SAP Solution Manager (ABAP) platform only Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_export_extracted + when: sap_install_media_detect_export == "sapsolman_abap" diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index ccd3a392d..25a7932ff 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -35,20 +35,35 @@ tags: sap_install_media_detect_add_file_extension tags: sap_install_media_detect_add_file_extension -- name: SAP Install Media Detect - Create a list of all files, phase 2 +- name: SAP Install Media Detect - Create a list of all required files, phase 2 ansible.builtin.include_tasks: file: prepare/create_file_list_phase_2.yml apply: tags: sap_install_media_detect_create_file_list_phase_2 tags: sap_install_media_detect_create_file_list_phase_2 -- name: SAP Install Media Detect - Organize all files - ansible.builtin.include_tasks: organize_all_files.yml +- name: SAP Install Media Detect - Organize files + ansible.builtin.include_tasks: + file: organize_files.yml + apply: + tags: sap_install_media_detect_organize_files + tags: sap_install_media_detect_organize_files -- name: SAP Install Media Detection Completed - set global vars for subsequent Ansible Tasks - ansible.builtin.include_tasks: set_global_vars.yml +- name: SAP Install Media Detect - Detect files after extraction + ansible.builtin.include_tasks: + file: detect_files_after_extraction.yml + apply: + tags: sap_install_media_detect_detect_files_after_extraction + tags: sap_install_media_detect_detect_files_after_extraction + +- name: SAP Install Media Detection Completed - Set global vars for subsequent Ansible tasks or roles + ansible.builtin.include_tasks: + file: set_global_vars.yml + apply: + tags: sap_install_media_detect_set_global_vars + tags: sap_install_media_detect_set_global_vars -- name: SAP Install Media Detect - Cleanup - Disable the EPEL repo if necessary +- name: SAP Install Media Detection Completed - Cleanup - Disable the EPEL repo if necessary ansible.builtin.include_tasks: file: cleanup/disable-epel-repo.yml apply: diff --git a/roles/sap_install_media_detect/tasks/organize_all_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml similarity index 88% rename from roles/sap_install_media_detect/tasks/organize_all_files.yml rename to roles/sap_install_media_detect/tasks/organize_files.yml index f39aeecad..6343725ec 100644 --- a/roles/sap_install_media_detect/tasks/organize_all_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -13,6 +13,20 @@ loop_var: line_item when: sap_install_media_detect_source == 'remote_dir' +- name: SAP Install Media Detect - Organize all files - Remove existing target extraction directories + ansible.builtin.file: + path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + state: absent + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.extract_archive == 'y' and + (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') + - name: SAP Install Media Detect - Organize all files - Create target extraction directories ansible.builtin.file: path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 4eee9389e..cb0c3a6df 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -75,7 +75,7 @@ (sap_install_media_detect_export == 'sapecc' and item.stdout.split(' ')[0] == 'sap_ecc_export') or (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(' ')[0] == 'sap_ecc_ides_export') -- name: SAP Install Media Detect - Organize all files - Identify the sapcar program +- name: SAP Install Media Detect - Prepare - Identify the sapcar program ansible.builtin.set_fact: __sap_install_media_detect_fact_sapcar_path: "{{ sap_install_media_detect_target_directory }}/{{ item.line_item | basename }}" loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 13736500e..ecd0e670a 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -1,34 +1,17 @@ --- -- name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ sap_install_media_detect_directory }} - ansible.builtin.shell: ls SAPCAR*.EXE - args: - chdir: "{{ sap_install_media_detect_directory }}" - register: sap_swpm_sapcar_file_name_get - changed_when: false - -- name: SAP Install Media Detect - SAPCAR - Set fact +- name: SAP Install Media Detect - Detection completed - Set fact for SAPCAR ansible.builtin.set_fact: sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" -- name: SAP Install Media Detection Completed - Set facts for SAP SWPM +- name: SAP Install Media Detect - Detection completed - Set fact for SWPM ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role +# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # now in identify_files_after_extraction.yml sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_swpm -- name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_CLIENT for SAP SWPM - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}" - recurse: true - file_type: directory - patterns: "SAP_HANA_CLIENT" - register: sap_hana_client_path - ignore_errors: true - when: sap_install_media_detect_db == "saphana" - -- name: SAP Install Media Detection Completed - Set facts for SAP HANA +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA ansible.builtin.set_fact: sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" # for sap_hana_install Ansible Role @@ -37,54 +20,14 @@ ignore_errors: true when: sap_install_media_detect_db == "saphana" -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" - recurse: true - file_type: directory - patterns: ".*LINUXX86_64.*" - use_regex: true - register: detect_directory_ibmdb2_extracted - when: sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" - recurse: true - file_type: directory - patterns: ".*DATA_UNITS.*" - use_regex: true - register: detect_directory_ibmdb2_client_extracted - when: sap_install_media_detect_db == "ibmdb2" - -- name: SAP Install Media Detection Completed - Set facts for IBM Db2 +- name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "ibmdb2" -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" - recurse: true - file_type: directory - patterns: ".*LINUX_X86_64.*" - use_regex: true - register: detect_directory_oracledb_extracted - when: sap_install_media_detect_db == "oracledb" - -- name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" - recurse: true - file_type: directory - patterns: ".*OCL_LINUX_X86_64.*" - use_regex: true - register: detect_directory_oracledb_client_extracted - when: sap_install_media_detect_db == "oracledb" - -- name: SAP Install Media Detection Completed - Set facts for Oracle DB +- name: SAP Install Media Detect - Detection completed - Set facts for Oracle DB ansible.builtin.set_fact: sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role @@ -92,148 +35,57 @@ ignore_errors: true when: sap_install_media_detect_db == "oracledb" -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" - recurse: true - file_type: directory - patterns: ".*SYBASE_LINUX.*" - use_regex: true - register: detect_directory_sapase_extracted - when: sap_install_media_detect_db == "sapase" - -- name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" - recurse: true - file_type: file - patterns: ".*sybodbc.*" - use_regex: true - register: detect_directory_sapase_client_extracted - when: sap_install_media_detect_db == "sapase" - -- name: SAP Install Media Detection Completed - Set facts for SAP ASE +- name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapase" -- name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - recurse: true - file_type: directory - patterns: '.*MaxDB_7.9.*' - use_regex: true - register: detect_directory_sapmaxdb_extracted - when: sap_install_media_detect_db == "sapmaxdb" - -- name: SAP Install Media Detection Completed - Set facts for SAP MaxDB +- name: SAP Install Media Detect - Detection completed - Set facts for SAP MaxDB ansible.builtin.set_fact: sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapmaxdb" -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path - ansible.builtin.shell: | - ls SAPEXEDB_*.SAR - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_dependent_file_name_get - when: sap_install_media_detect_kernel - -- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB +- name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB ansible.builtin.set_fact: sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path - ansible.builtin.shell: | - ls SAPEXE_*.SAR - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_independent_file_name_get - when: sap_install_media_detect_kernel - -- name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE +- name: SAP Install Media Detect - Detection completed - Set facts for SAPEXE ansible.builtin.set_fact: sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - SAP IGS - Get IGS from software path - ansible.builtin.shell: | - ls igsexe*.sar - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_igs_file_name_get - when: sap_install_media_detect_igs - -- name: SAP Install Media Detect - SAP IGS - Set fact for IGS +- name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS ansible.builtin.set_fact: sap_swpm_igs_path: "{{ sap_swpm_software_path }}" sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}" when: sap_install_media_detect_igs -- name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path - ansible.builtin.shell: | - ls igshelper*.sar - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_igs_helper_file_name_get - when: sap_install_media_detect_igs - -- name: SAP Install Media Detect - SAP IGS - Set fact for IGS Helper +- name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS Helper ansible.builtin.set_fact: sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" when: sap_install_media_detect_igs -- name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path - ansible.builtin.shell: | - ls SAPWEBDISP_*.SAR - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_web_dispatcher_file_name_get - ignore_errors: true - when: sap_install_media_detect_webdisp - -- name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP +- name: SAP Install Media Detect - Detection completed - Set facts for WebDisp ansible.builtin.set_fact: sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" ignore_errors: true when: sap_install_media_detect_webdisp -- name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC Export extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapecc" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" - recurse: true - file_type: directory - patterns: '.*EXP.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapecc_ides" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP ECC IDES +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC IDES ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt1_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role @@ -241,81 +93,31 @@ ignore_errors: true when: sap_install_media_detect_export == "sapecc_ides" -- name: SAP Install Media Detect - SAP S/4HANA EXPORT - Re-Identify SAP S/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" - recurse: true - file_type: file - patterns: '.*S4.*EXPORT.*' - use_regex: true - register: s4hana_export_files - when: sap_install_media_detect_export == "saps4hana" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP S/4HANA +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "saps4hana" -- name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files - ansible.builtin.find: - paths: "{{ sap_install_media_detect_target_directory }}" - recurse: true - file_type: file - patterns: '.*BW4.*EXPORT.*' - use_regex: true - register: bw4hana_export_files - when: sap_install_media_detect_export == "sapbw4hana" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP BW/4HANA +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapbw4hana" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapnwas_abap" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_abap" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapnwas_java" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_java" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT extracted - ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" - recurse: true - file_type: directory - patterns: '.*DATA_UNITS.*' - use_regex: true - register: detect_directory_export_extracted - when: sap_install_media_detect_export == "sapsolman_abap" - -- name: SAP Install Media Detection Completed - Set facts for Export of SAP Solution Manager (ABAP) +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role sap_swpm_cd_export_pt1_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role @@ -323,7 +125,7 @@ ignore_errors: true when: sap_install_media_detect_export == "sapsolman_abap" -- name: SAP Install Media Detection Completed - Set fact for displaying all variables +- name: SAP Install Media Detect - Detection completed - Set fact for displaying all variables ansible.builtin.set_fact: __sap_install_media_detect_vars: "{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" loop: @@ -357,6 +159,6 @@ - sap_swpm_web_dispatcher_path - sap_swpm_web_dispatcher_file_name -- name: SAP Install Media Detection Completed - Display all variables +- name: SAP Install Media Detect - Detection completed - Display all variables ansible.builtin.debug: msg: "{{ __sap_install_media_detect_vars.split('\n')[:-1] }}" From 3f04f597fe75bddf0493f72365bb0b1dc1bda5c6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 18:34:34 +0200 Subject: [PATCH 005/179] sap_install_media_detect: Rename detect_files to find_files --- roles/sap_install_media_detect/README.md | 2 +- ...on.yml => find_files_after_extraction.yml} | 44 +++++++++---------- roles/sap_install_media_detect/tasks/main.yml | 8 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) rename roles/sap_install_media_detect/tasks/{detect_files_after_extraction.yml => find_files_after_extraction.yml} (75%) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index e1a6b9c99..d99460c21 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -31,7 +31,7 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_install_media_detect_create_file_list_phase_1`: Create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. - tag `sap_install_media_detect_create_file_list_phase_2`: Create a final list of all required files in `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) - tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files in to the target directories if specified by the output of the sapfile command. -- tag `sap_install_media_detect_detect_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. +- tag `sap_install_media_detect_find_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. - tag `sap_install_media_detect_set_global_vars`: Set all final variables for later use by Ansible roles or tasks. ## License diff --git a/roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml similarity index 75% rename from roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml rename to roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 4340632ff..3314ee71e 100644 --- a/roles/sap_install_media_detect/tasks/detect_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -1,18 +1,18 @@ --- -- name: SAP Install Media Detect - Detect Files after extraction - Set fact for SAP kernel files +- name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files ansible.builtin.set_fact: sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for setting consecutive vars ignore_errors: true -- name: SAP Install Media Detect - Detect Files after extraction - Find SAPCAR +- name: SAP Install Media Detect - Find files after extraction - Find SAPCAR ansible.builtin.shell: ls SAPCAR*.EXE args: chdir: "{{ sap_install_media_detect_directory }}" register: sap_swpm_sapcar_file_name_get changed_when: false -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP_HANA_CLIENT for SAP SWPM +- name: SAP Install Media Detect - Find files after extraction - Find SAP_HANA_CLIENT for SAP SWPM ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: true @@ -22,7 +22,7 @@ ignore_errors: true when: sap_install_media_detect_db == "saphana" -- name: SAP Install Media Detect - Detect Files after extraction - Find IBM Db2 +- name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" recurse: true @@ -32,7 +32,7 @@ register: detect_directory_ibmdb2_extracted when: sap_install_media_detect_db == "ibmdb2" -- name: SAP Install Media Detect - Detect Files after extraction - Find IBM Db2 Client +- name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 Client ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" recurse: true @@ -42,7 +42,7 @@ register: detect_directory_ibmdb2_client_extracted when: sap_install_media_detect_db == "ibmdb2" -- name: SAP Install Media Detect - Detect Files after extraction - Find Oracle DB +- name: SAP Install Media Detect - Find files after extraction - Find Oracle DB ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" recurse: true @@ -52,7 +52,7 @@ register: detect_directory_oracledb_extracted when: sap_install_media_detect_db == "oracledb" -- name: SAP Install Media Detect - Detect Files after extraction - Find Oracle DB Client +- name: SAP Install Media Detect - Find files after extraction - Find Oracle DB Client ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" recurse: true @@ -62,7 +62,7 @@ register: detect_directory_oracledb_client_extracted when: sap_install_media_detect_db == "oracledb" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ASE +- name: SAP Install Media Detect - Find files after extraction - Find SAP ASE ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" recurse: true @@ -72,7 +72,7 @@ register: detect_directory_sapase_extracted when: sap_install_media_detect_db == "sapase" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ASE Client +- name: SAP Install Media Detect - Find files after extraction - Find SAP ASE Client ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" recurse: true @@ -82,7 +82,7 @@ register: detect_directory_sapase_client_extracted when: sap_install_media_detect_db == "sapase" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP MaxDB +- name: SAP Install Media Detect - Find files after extraction - Find SAP MaxDB ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" recurse: true @@ -95,7 +95,7 @@ - debug: msg: "sap_swpm_software_path - {{ sap_swpm_software_path }}" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAPEXEDB +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB ansible.builtin.shell: | ls SAPEXEDB_*.SAR args: @@ -103,7 +103,7 @@ register: sap_swpm_kernel_dependent_file_name_get when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - Detect Files after extraction - Find SAPEXE +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXE ansible.builtin.shell: | ls SAPEXE_*.SAR args: @@ -111,7 +111,7 @@ register: sap_swpm_kernel_independent_file_name_get when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - Detect Files after extraction - Find IGS +- name: SAP Install Media Detect - Find files after extraction - Find IGS ansible.builtin.shell: | ls igsexe*.sar args: @@ -119,7 +119,7 @@ register: sap_swpm_igs_file_name_get when: sap_install_media_detect_igs -- name: SAP Install Media Detect - Detect Files after extraction - Find IGS Helper +- name: SAP Install Media Detect - Find files after extraction - Find IGS Helper ansible.builtin.shell: | ls igshelper*.sar args: @@ -127,7 +127,7 @@ register: sap_swpm_igs_helper_file_name_get when: sap_install_media_detect_igs -- name: SAP Install Media Detect - Detect Files after extraction - Find WEBDISP +- name: SAP Install Media Detect - Find files after extraction - Find WEBDISP ansible.builtin.shell: | ls SAPWEBDISP_*.SAR args: @@ -136,7 +136,7 @@ ignore_errors: true when: sap_install_media_detect_webdisp -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ECC Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP ECC Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" recurse: true @@ -146,7 +146,7 @@ register: detect_directory_export_extracted when: sap_install_media_detect_export == "sapecc" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP ECC IDES Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" recurse: true @@ -156,7 +156,7 @@ register: detect_directory_export_extracted when: sap_install_media_detect_export == "sapecc_ides" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP S/4HANA Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export ansible.builtin.find: paths: "{{ sap_install_media_detect_source_directory }}" recurse: true @@ -166,7 +166,7 @@ register: s4hana_export_files when: sap_install_media_detect_export == "saps4hana" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP BW/4HANA Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP BW/4HANA Export ansible.builtin.find: paths: "{{ sap_install_media_detect_target_directory }}" recurse: true @@ -176,7 +176,7 @@ register: bw4hana_export_files when: sap_install_media_detect_export == "sapbw4hana" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" recurse: true @@ -186,7 +186,7 @@ register: detect_directory_export_extracted when: sap_install_media_detect_export == "sapnwas_abap" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" recurse: true @@ -196,7 +196,7 @@ register: detect_directory_export_extracted when: sap_install_media_detect_export == "sapnwas_java" -- name: SAP Install Media Detect - Detect Files after extraction - Find SAP Solution Manager (ABAP) platform only Export +- name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" recurse: true diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 25a7932ff..a05eaafab 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -49,12 +49,12 @@ tags: sap_install_media_detect_organize_files tags: sap_install_media_detect_organize_files -- name: SAP Install Media Detect - Detect files after extraction +- name: SAP Install Media Detect - Find files after extraction ansible.builtin.include_tasks: - file: detect_files_after_extraction.yml + file: find_files_after_extraction.yml apply: - tags: sap_install_media_detect_detect_files_after_extraction - tags: sap_install_media_detect_detect_files_after_extraction + tags: sap_install_media_detect_find_files_after_extraction + tags: sap_install_media_detect_find_files_after_extraction - name: SAP Install Media Detection Completed - Set global vars for subsequent Ansible tasks or roles ansible.builtin.include_tasks: From 2433d289b74553933330e68f6d223778846b8dc5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 20:00:21 +0200 Subject: [PATCH 006/179] sap_install_media_detect: rename some variables With identical variables in `find_files_after_extraction.yml`, some of them can be overwritten as follows: "detect_directory_export_extracted": { "changed": false, "skip_reason": "Conditional result was False", "skipped": true } These variables have to have different names so that the assignment of final variables in `set_global_vars.yml` is done correctly. This error did not happen with the previous version because each detection was done in a separately included file. --- .../tasks/find_files_after_extraction.yml | 13 +++++------- .../tasks/organize_files.yml | 20 +++++++++---------- .../prepare/create_file_list_phase_2.yml | 2 +- .../tasks/set_global_vars.yml | 18 ++++++++--------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 3314ee71e..ec2803dab 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -92,9 +92,6 @@ register: detect_directory_sapmaxdb_extracted when: sap_install_media_detect_db == "sapmaxdb" -- debug: - msg: "sap_swpm_software_path - {{ sap_swpm_software_path }}" - - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB ansible.builtin.shell: | ls SAPEXEDB_*.SAR @@ -143,7 +140,7 @@ file_type: directory patterns: '.*DATA_UNITS.*' use_regex: true - register: detect_directory_export_extracted + register: detect_directory_ecc_export_extracted when: sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export @@ -153,7 +150,7 @@ file_type: directory patterns: '.*EXP.*' use_regex: true - register: detect_directory_export_extracted + register: detect_directory_ecc_ides_export_extracted when: sap_install_media_detect_export == "sapecc_ides" - name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export @@ -183,7 +180,7 @@ file_type: directory patterns: '.*DATA_UNITS.*' use_regex: true - register: detect_directory_export_extracted + register: detect_directory_nwas_abap_export_extracted when: sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export @@ -193,7 +190,7 @@ file_type: directory patterns: '.*DATA_UNITS.*' use_regex: true - register: detect_directory_export_extracted + register: detect_directory_nwas_java_export_extracted when: sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export @@ -203,5 +200,5 @@ file_type: directory patterns: '.*DATA_UNITS.*' use_regex: true - register: detect_directory_export_extracted + register: detect_directory_solgmr_export_extracted when: sap_install_media_detect_export == "sapsolman_abap" diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 6343725ec..3eb5468b9 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -13,9 +13,9 @@ loop_var: line_item when: sap_install_media_detect_source == 'remote_dir' -- name: SAP Install Media Detect - Organize all files - Remove existing target extraction directories +- name: SAP Install Media Detect - Organize all files - Remove existing archive extraction directories ansible.builtin.file: - path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" state: absent loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: @@ -27,9 +27,9 @@ line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar') -- name: SAP Install Media Detect - Organize all files - Create target extraction directories +- name: SAP Install Media Detect - Organize all files - Create archive extraction directories ansible.builtin.file: - path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" state: directory owner: root group: root @@ -44,9 +44,9 @@ line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar') -- name: SAP Install Media Detect - Organize all files - Create target directories +- name: SAP Install Media Detect - Organize all files - Create archive directories ansible.builtin.file: - path: "{{ sap_install_media_detect_target_directory }}/{{ line_item.archive_dir }}" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.archive_dir }}" state: directory owner: root group: root @@ -61,7 +61,7 @@ line_item.archive_type == 'sapcar' - name: SAP Install Media Detect - Organize all files - Extract zip archive files - ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -72,7 +72,7 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract rar archive files - ansible.builtin.shell: "set -o pipefail && {{ sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ sap_install_media_detect_rar_extract_argument }} {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && {{ sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ sap_install_media_detect_rar_extract_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -83,7 +83,7 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files - ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ sap_install_media_detect_target_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -96,7 +96,7 @@ - name: SAP Install Media Detect - Organize all files - Copy sapcar to sap_swpm directory ansible.builtin.copy: src: "{{ __sap_install_media_detect_fact_sapcar_path }}" - dest: "{{ sap_install_media_detect_target_directory }}/sap_swpm/" + dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" remote_src: true owner: root group: root diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index cb0c3a6df..af765772c 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -77,7 +77,7 @@ - name: SAP Install Media Detect - Prepare - Identify the sapcar program ansible.builtin.set_fact: - __sap_install_media_detect_fact_sapcar_path: "{{ sap_install_media_detect_target_directory }}/{{ item.line_item | basename }}" + __sap_install_media_detect_fact_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/{{ item.line_item | basename }}" loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" when: item.stdout.split(' ')[0] == 'sapcar' diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index ecd0e670a..d45e2830e 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -81,15 +81,15 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC IDES ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ (detect_directory_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_ides_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc_ides" @@ -107,21 +107,21 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ detect_directory_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ detect_directory_export_extracted.files[1].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_export_extracted.files[1].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_abap" From 3ad19b673a655b07bda375b2e20b2ad7591fc177 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 22:09:43 +0200 Subject: [PATCH 007/179] sap_install_media_detect: Update sapfile for oracledb_tools detection --- roles/sap_install_media_detect/files/tmp/sapfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index cbd75f61d..e8824026a 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -134,6 +134,7 @@ for _FILE in "$@"; do /MaxDB_7.9/{_sap_file_type="sapmaxdb"} /19cinstall.sh/{_sap_file_type="oracledb"} /OCL_LINUX_X86_64/{_sap_file_type="oracledb_client"} + /brtools/{_sap_file_type="oracledb_tools"} /db2setup/{_sap_file_type="ibmdb2"} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"} @@ -163,7 +164,7 @@ for _FILE in "$@"; do ;; sapmaxdb) ;; - oracledb|oracledb_client) + oracledb|oracledb_client|oracledb_tools) _DIRECTORY="oracledb" ;; ibmdb2|ibmdb2_client|ibmdb2_license) From 08e28896dd4a447d47a7bbe642681399f8241883 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 8 Aug 2023 23:41:30 +0200 Subject: [PATCH 008/179] sap_install_media_detect: Improve the handling of file renaming The files without endings can now be renamed in the source directory even in case of remote_dir, if the source directory is writable. If the files without endings are located on a source directory which is not writable, the role will fail and explain the reason for the failure. --- .../tasks/prepare/check_directories.yml | 20 +++++++++---------- .../prepare/create_file_list_phase_1.yml | 11 ++++++++++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index 813849f5a..647639d9d 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -1,5 +1,15 @@ --- +- name: SAP Install Media Detect - Prepare - Get info of 'sap_install_media_detect_source_directory' + ansible.builtin.stat: + path: "{{ sap_install_media_detect_source_directory }}" + register: __sap_install_media_detect_source_directory_stat + +- name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' exists + ansible.builtin.fail: + msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} does not exist!" + when: not __sap_install_media_detect_source_directory_stat.stat.exists + - name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_target_directory' when: - sap_install_media_detect_target_directory is defined @@ -34,16 +44,6 @@ sap_install_media_detect_target_directory | string | length == 0 block: - - name: SAP Install Media Detect - Prepare - Get info of 'sap_install_media_detect_source_directory' - ansible.builtin.stat: - path: "{{ sap_install_media_detect_source_directory }}" - register: __sap_install_media_detect_source_directory_stat - - - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' exists - ansible.builtin.fail: - msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} does not exist!" - when: not __sap_install_media_detect_source_directory_stat.stat.exists - - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' is writable ansible.builtin.assert: that: __sap_install_media_detect_source_directory_stat.stat.writeable diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index 0b9ee3c33..ab642ca92 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -71,3 +71,14 @@ __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension + [item] }}" when: item.file_type is search 'RAR archive data' loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" + +- name: SAP Install Media Detect - Prepare - Fail if there is a zip or rar file without extension on read-only file system + ansible.builtin.fail: + msg: "There is at least one zip or rar file without extension on a read-only file system. + The file(s) cannot be renamed on this system, and without ending, the extraction of the such files might fail." + when: + - sap_install_media_detect_source == 'remote_dir' + - not __sap_install_media_detect_source_directory_stat.stat.writeable + - (__sap_install_media_detect_fact_zip_files_without_extension | length > 0 or + __sap_install_media_detect_fact_exe_files_without_extension | length > 0 or + __sap_install_media_detect_fact_rar_files_without_extension | length > 0) From 7c50fc5f9cde3d065973d06c56dd652e82aa4c78 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 9 Aug 2023 14:00:51 +0200 Subject: [PATCH 009/179] sap_install_media_detect: Support user defined paths for lsar and sapcar in sapfile utility --- .../files/tmp/sapfile | 91 ++++++++++++++++--- 1 file changed, 79 insertions(+), 12 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index e8824026a..91d4c85b9 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -22,25 +22,86 @@ usage () { echo "sapfile: Determine and display SAP file type. If unknown, call the file command." echo "Usage: sapfile [OPTION...] [FILE...]" echo "Determine and display type of SAP FILEs, optionally followed by additional information." - echo " -h, --help display this help and exit" - echo " -l long listing: also display the file type, taken from the output of the file command" - echo " -d also display the directory where to move the archive files, for use with Ansible role" + echo " -h|--help display this help and exit" + echo " -l|--long long listing: also display the file type, taken from the output of the file command" + echo " -d|--directory also display the directory where to move the archive files, for use with Ansible role" echo " community.sap_install.sap_install_media_detect" - echo " -e also display if the SAP FILE should be extracted, for use with Ansible role" + echo " -e|--extract also display if the SAP FILE should be extracted, for use with Ansible role" echo " community.sap_install.sap_install_media_detect" + echo " --lsar_file= the name of the program to list the content of a RAR file, if different from 'lsar'," + echo " either as the name of a file in one of the PATH directories or as an FQPN." + echo " When specifying the 'unrar' program, it will be called with option 'lb'." + echo " --sapcar_file= the name of the sapcar program, if different from 'sapcar', either as the name of a file" + echo " in one of the PATH directories or as an FQPN." echo "" echo "Requires:" - echo "- lsar (contained in the unar package from the EPEL RHEL repo)" + echo "- lsar (program to list the content of a RAR package, e.g. as part of the 'unar' package from the EPEL RHEL repo)" echo "- zipinfo (contained in the unzip RHEL package)" echo "- sapcar (SAP program to handle sapcar files; typical filename: SAPCAR_1115-70006178.EXE)" } +# option defaults: _DISPLAY_FILE_TYPE="n" _DISPLAY_DIRECTORY="n" _DISPLAY_EXTRACT="n" +_SAPCAR_FILE='sapcar' +_LSAR_FILE='lsar' -while getopts ":ldeh" opt; do +if [[ ${#} == 0 ]]; then + usage + exit 1 +fi + +options=":ldeh-:" +while getopts "$options" opt; do case ${opt} in + -) + case "${OPTARG}" in + long) + _DISPLAY_FILE_TYPE="y" + ;; + directory) + _DISPLAY_DIRECTORY="y" + ;; + extract) + _DISPLAY_EXTRACT="y" + ;; + lsar_file) + if [[ ${!OPTIND-x} == x ]]; then + usage + exit 0 + fi + _LSAR_FILE="${!OPTIND}" + OPTIND=$(( ${OPTIND} + 1 )) + ;; + lsar_file=*) + _LSAR_FILE=${OPTARG#*=} + opt=${OPTARG%=${_LSAR_FILE}} + ;; + sapcar_file) + if [[ ${!OPTIND-x} == x ]]; then + usage + exit 0 + fi + _SAPCAR_FILE="${!OPTIND}" + OPTIND=$(( ${OPTIND} + 1 )) + ;; + sapcar_file=*) + _SAPCAR_FILE=${OPTARG#*=} + opt=${OPTARG%=${_SAPCAR_FILE}} + ;; + help) + usage + exit 0 + ;; + *) + if [[ "$OPTERR" = 1 ]] && [[ "${options:0:1}" != ":" ]]; then + echo "Invalid option -${OPTARG}" + usage + fi + exit 0 + ;; + esac;; l) _DISPLAY_FILE_TYPE="y" ;; @@ -52,24 +113,30 @@ while getopts ":ldeh" opt; do ;; h) usage - exit 1 + exit 0 ;; \?) echo "Invalid option -$OPTARG" usage - exit 1 + exit 0 ;; esac done shift "$((OPTIND-1))" +if [[ "${_LSAR_FILE}" == *"lsar"* ]]; then + _LSAR_COMMAND="${_LSAR_FILE}" +elif [[ "${_LSAR_FILE}" == *"unrar"* ]]; then + _LSAR_COMMAND="${_LSAR_FILE} lb" +fi + _ARCHIVE_TYPE="other" for _FILE in "$@"; do _FILE_OUTPUT=$(file "${_FILE}" | sed 's,'"${_FILE}"': ,,') if [[ ${_FILE_OUTPUT}. == "data." ]] && [[ (${_FILE##*.} == "SAR" || ${_FILE##*.} == "sar") ]]; then _ARCHIVE_TYPE="sapcar" - _list_content="sapcar -tvf" + _list_content="${_SAPCAR_FILE} -tvf" else _ARCHIVE_TYPE=$(echo "${_FILE_OUTPUT}" | awk ' BEGIN{_file_type="other"} @@ -80,13 +147,13 @@ for _FILE in "$@"; do /directory/{_file_type="dir"} END{print _file_type}') if [[ ${_ARCHIVE_TYPE}. == "rarexe." ]]; then - _list_content="lsar" + _list_content="${_LSAR_COMMAND}" elif [[ ${_ARCHIVE_TYPE}. == "rar." ]]; then - _list_content="lsar" + _list_content="${_LSAR_COMMAND}" elif [[ ${_ARCHIVE_TYPE}. == "zip." ]]; then _list_content="zipinfo -1" elif [[ ${_ARCHIVE_TYPE}. == "sapcar." ]]; then - _list_content="sapcar -tvf" + _list_content="${_SAPCAR_FILE} -tvf" elif [[ ${_ARCHIVE_TYPE}. == "dir." ]]; then _list_content="" fi From 26958b36eaab71d68b335bd66357c11e6212d193 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 9 Aug 2023 15:36:27 +0200 Subject: [PATCH 010/179] sap_install_media_detect: Increase RAR and SAPCAR tools flexibility --- .../defaults/main.yml | 24 +++++++++++++++++++ roles/sap_install_media_detect/tasks/main.yml | 5 ++++ .../tasks/organize_files.yml | 2 +- .../prepare/create_file_list_phase_2.yml | 2 +- .../tasks/prepare/enable_rar_handling.yml | 17 +++++-------- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index b9463eceb..b9d29f671 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -16,6 +16,30 @@ sap_install_media_detect_use_rpm_key_module_for_removing_the_key: true # If this role is running on a system on which the SAP software is to be installed, set the following to false. sap_install_media_detect_file_server_only: false +# Fully qualified path to the sapcar program. If not specified, the sapcar program (or a link with the name sapcar, pointing to +# the actual SAPCAR*EXE program) is expected to be located in one of the PATH directories. +#sap_install_media_detect_sapcar_path: '/usr/local/bin/sapcar' + +# Fully qualified path to the program for listing RAR files, including the argument for listing files. If not specified, +# the lsar program (or a link with the name lsar, pointing to the actual lsar program) is expected to be located in one of +# the PATH directories. +# If sap_install_media_detect_rar_package is set to 'EPEL', this variable is not used. +#sap_install_media_detect_rar_list: '/usr/bin/lsar' +sap_install_media_detect_rar_list: '/usr/bin/unrar lb' + +# Fully qualified path to the program for extracting RAR files, including the argument for extracting files. If not specified, +# the unar program (or a link with the name unar, pointing to the actual unar program) is expected to be located in one of +# the PATH directories. +# If sap_install_media_detect_rar_package is set to 'EPEL', this variable is not used. +#sap_install_media_detect_rar_extract: '/usr/bin/unar' +sap_install_media_detect_rar_extract: '/usr/bin/unrar x' + +# Fully qualified path to an additional argument to the program for extracting RAR files, for specifying the directory into +# which the archive is to be extracted. Needs to be empty or start with a space character. +# If sap_install_media_detect_rar_package is set to 'EPEL', this variable is not used. +#sap_install_media_detect_rar_extract_argument: ' -o' +sap_install_media_detect_rar_extract_directory_argument: '' + # Directory where the SAP software is located sap_install_media_detect_source_directory: /software diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index a05eaafab..a22599da5 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,5 +1,10 @@ --- +# The sapcar (SAPCAR.EXE) program is required for the detection of the SAP file types. +- name: SAP Install Media Detect - Prepare - Set fact for the sapcar program + ansible.builtin.set_fact: + __sap_install_media_detect_fact_sapcar_path_for_sapfile: "{{ sap_install_media_detect_sapcar_path | d('sapcar') }}" + - name: SAP Install Media Detect - Prepare - Provide sapfile utility ansible.builtin.include_tasks: file: prepare/provide_sapfile_utility.yml diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 3eb5468b9..2dd095009 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -72,7 +72,7 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract rar archive files - ansible.builtin.shell: "set -o pipefail && {{ sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ sap_install_media_detect_rar_extract_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ __sap_install_media_detect_rar_extract_directory_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index af765772c..5c6e10e88 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -23,7 +23,7 @@ loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" - name: SAP Install Media Detect - Prepare - Iterate over files and determine file type - ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -lde {{ line_item }} | awk '{print $(NF-3), $(NF-2), $(NF-1), $NF}' + ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -lde --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path_for_sapfile }} {{ line_item }} | awk '{print $(NF-3), $(NF-2), $(NF-1), $NF}' register: __sap_install_media_detect_register_files_phase_2 loop: "{{ __sap_install_media_detect_fact_find_result_phase_2 }}" loop_control: diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index 5b4e097ac..cf2810ef6 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -48,21 +48,16 @@ - name: SAP Install Media Detect - Prepare - EPEL - Set facts ansible.builtin.set_fact: - sap_install_media_detect_rar_list: '/usr/bin/lsar' - sap_install_media_detect_rar_extract: '/usr/bin/unar' - sap_install_media_detect_rar_extract_argument: ' -o' + __sap_install_media_detect_rar_list: '/usr/bin/lsar' + __sap_install_media_detect_rar_extract: '/usr/bin/unar' + __sap_install_media_detect_rar_extract_directory_argument: ' -o' - name: SAP Install Media Detect - Prepare - Install an unrar package when: sap_install_media_detect_rar_package != 'EPEL' block: - - name: SAP Install Media Detect - Prepare - unrar - Install the unrar package - ansible.builtin.package: - name: "{{ sap_install_media_detect_rar_package }}" - state: present - - name: SAP Install Media Detect - Prepare - unrar - Set facts ansible.builtin.set_fact: - sap_install_media_detect_rar_list: '/usr/bin/unrar lb' - sap_install_media_detect_rar_extract: '/usr/bin/unrar x' - sap_install_media_detect_rar_extract_argument: '' + __sap_install_media_detect_rar_list: "{{ sap_install_media_detect_rar_list }}" + __sap_install_media_detect_rar_extract: "{{ sap_install_media_detect_rar_extract }}" + __sap_install_media_detect_rar_extract_directory_argument: "{{ sap_install_media_detect_rar_extract_directory_argument }}" From ab1ac2eeab66b1425ab2ccad9060ebcd40d34028 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 10 Aug 2023 16:42:15 +0200 Subject: [PATCH 011/179] sap_install_media_detect: revert to sapecc and sapnwas names, set missing vars for swpm --- roles/sap_install_media_detect/files/tmp/sapfile | 8 ++++---- .../tasks/find_files_after_extraction.yml | 6 +++--- .../tasks/prepare/create_file_list_phase_2.yml | 8 ++++---- roles/sap_install_media_detect/tasks/set_global_vars.yml | 2 ++ 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 91d4c85b9..b9b5399fc 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -205,10 +205,10 @@ for _FILE in "$@"; do /db2setup/{_sap_file_type="ibmdb2"} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"} - /DATA_UNITS\/EXPORT/{_sap_file_type="sap_ecc_export"} - /EXP[0-9]/{_sap_file_type="sap_ecc_ides_export"} - /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_nwas_abap_export"} - /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_nwas_java_export"} + /DATA_UNITS\/EXPORT/{_sap_file_type="sapecc_export"} + /EXP[0-9]/{_sap_file_type="sapecc_ides_export"} + /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sapnwas_abap_export"} + /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sapnwas_java_export"} /format error in header/{_sap_file_type="format_error_in_header"} END{print _sap_file_type}') else diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index ec2803dab..50ab3e857 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -8,7 +8,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAPCAR ansible.builtin.shell: ls SAPCAR*.EXE args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_sapcar_file_name_get changed_when: false @@ -175,7 +175,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_abap_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' @@ -185,7 +185,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_nwas_java_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 5c6e10e88..30a1cf907 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -70,10 +70,10 @@ ) or (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(' ')[0] == 'sap_s4hana_export') or (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(' ')[0] == 'sap_bw4hana_export') or - (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(' ')[0] == 'sap_nwas_abap_export') or - (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(' ')[0] == 'sap_nwas_java_export') or - (sap_install_media_detect_export == 'sapecc' and item.stdout.split(' ')[0] == 'sap_ecc_export') or - (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(' ')[0] == 'sap_ecc_ides_export') + (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(' ')[0] == 'sapnwas_abap_export') or + (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(' ')[0] == 'sapnwas_java_export') or + (sap_install_media_detect_export == 'sapecc' and item.stdout.split(' ')[0] == 'sapecc_export') or + (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(' ')[0] == 'sapecc_ides_export') - name: SAP Install Media Detect - Prepare - Identify the sapcar program ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index d45e2830e..bd957c000 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -7,6 +7,8 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SWPM ansible.builtin.set_fact: # sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # now in identify_files_after_extraction.yml + sap_swpm_install_directory: "{{ sap_install_media_detect_directory }}/sap_swpm" + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_swpm From 986f0a8fbf5381ce6d1f74dbc1831bbf4387441b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 10 Aug 2023 18:47:41 +0200 Subject: [PATCH 012/179] sap_install_media_detect: Ensure sapcar is executable; fix missing/wrong vars --- .../tasks/prepare/create_file_list_phase_2.yml | 7 +++++++ roles/sap_install_media_detect/tasks/set_global_vars.yml | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 30a1cf907..ec3513631 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -81,6 +81,13 @@ loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" when: item.stdout.split(' ')[0] == 'sapcar' +- name: SAP Install Media Detect - Prepare - Ensure sapcar is executable + ansible.builtin.file: + path: "{{ __sap_install_media_detect_fact_sapcar_path }}" + owner: root + group: root + mode: '0755' + - name: SAP Install Media Detect - Prepare - Display the file dict, phase 2 ansible.builtin.debug: var: __sap_install_media_detect_fact_files_sapfile_results diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index bd957c000..d907b5116 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -7,8 +7,9 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SWPM ansible.builtin.set_fact: # sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # now in identify_files_after_extraction.yml - sap_swpm_install_directory: "{{ sap_install_media_detect_directory }}/sap_swpm" - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" + sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" + sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_swpm From f5438f4f0704f4b200bb80b76fc738fcdcd61bbc Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 17 Aug 2023 00:14:28 +0200 Subject: [PATCH 013/179] sap_install_media_detect: simplify the sapfile utility; bug fixes --- .../defaults/main.yml | 3 +- .../files/tmp/sapfile | 162 ++++++++++++------ .../tasks/find_files_after_extraction.yml | 30 ++-- roles/sap_install_media_detect/tasks/main.yml | 8 +- .../tasks/organize_files.yml | 68 ++++++-- .../prepare/create_file_list_phase_1.yml | 16 ++ .../prepare/create_file_list_phase_2.yml | 88 +++++----- .../tasks/set_global_vars.yml | 27 ++- 8 files changed, 255 insertions(+), 147 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index b9d29f671..d096b1ac1 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -56,7 +56,8 @@ sap_install_media_detect_rename_target_file_exists: 'skip' #sap_install_media_detect_source: local_dir # saphana, sapase, sapmaxdb, oracledb, ibmdb2 -sap_install_media_detect_db: "saphana" +#sap_install_media_detect_db: "saphana" +sap_install_media_detect_db: '' sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index b9b5399fc..4032ff7f9 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -23,11 +23,9 @@ usage () { echo "Usage: sapfile [OPTION...] [FILE...]" echo "Determine and display type of SAP FILEs, optionally followed by additional information." echo " -h|--help display this help and exit" + echo " -H|--header display a column header" echo " -l|--long long listing: also display the file type, taken from the output of the file command" - echo " -d|--directory also display the directory where to move the archive files, for use with Ansible role" - echo " community.sap_install.sap_install_media_detect" - echo " -e|--extract also display if the SAP FILE should be extracted, for use with Ansible role" - echo " community.sap_install.sap_install_media_detect" + echo " -e|--extra-long extra long listing: display all information required by role sap_install_media_detect" echo " --lsar_file= the name of the program to list the content of a RAR file, if different from 'lsar'," echo " either as the name of a file in one of the PATH directories or as an FQPN." echo " When specifying the 'unrar' program, it will be called with option 'lb'." @@ -40,10 +38,13 @@ usage () { echo "- sapcar (SAP program to handle sapcar files; typical filename: SAPCAR_1115-70006178.EXE)" } +# defaults: +_DELIMITER=";" + # option defaults: _DISPLAY_FILE_TYPE="n" -_DISPLAY_DIRECTORY="n" -_DISPLAY_EXTRACT="n" +_DISPLAY_ALL_INFO="n" +_DISPLAY_HEADER="n" _SAPCAR_FILE='sapcar' _LSAR_FILE='lsar' @@ -52,7 +53,7 @@ if [[ ${#} == 0 ]]; then exit 1 fi -options=":ldeh-:" +options=":leHh-:" while getopts "$options" opt; do case ${opt} in -) @@ -60,11 +61,11 @@ while getopts "$options" opt; do long) _DISPLAY_FILE_TYPE="y" ;; - directory) - _DISPLAY_DIRECTORY="y" + extra-long) + _DISPLAY_ALL_INFO="y" ;; - extract) - _DISPLAY_EXTRACT="y" + header) + _DISPLAY_HEADER="y" ;; lsar_file) if [[ ${!OPTIND-x} == x ]]; then @@ -72,11 +73,11 @@ while getopts "$options" opt; do exit 0 fi _LSAR_FILE="${!OPTIND}" - OPTIND=$(( ${OPTIND} + 1 )) + OPTIND=$(( OPTIND + 1 )) ;; lsar_file=*) _LSAR_FILE=${OPTARG#*=} - opt=${OPTARG%=${_LSAR_FILE}} + opt=${OPTARG%="${_LSAR_FILE}"} ;; sapcar_file) if [[ ${!OPTIND-x} == x ]]; then @@ -84,11 +85,11 @@ while getopts "$options" opt; do exit 0 fi _SAPCAR_FILE="${!OPTIND}" - OPTIND=$(( ${OPTIND} + 1 )) + OPTIND=$(( OPTIND + 1 )) ;; sapcar_file=*) _SAPCAR_FILE=${OPTARG#*=} - opt=${OPTARG%=${_SAPCAR_FILE}} + opt=${OPTARG%="${_SAPCAR_FILE}"} ;; help) usage @@ -105,11 +106,11 @@ while getopts "$options" opt; do l) _DISPLAY_FILE_TYPE="y" ;; - d) - _DISPLAY_DIRECTORY="y" - ;; e) - _DISPLAY_EXTRACT="y" + _DISPLAY_ALL_INFO="y" + ;; + H) + _DISPLAY_HEADER="y" ;; h) usage @@ -130,15 +131,27 @@ elif [[ "${_LSAR_FILE}" == *"unrar"* ]]; then _LSAR_COMMAND="${_LSAR_FILE} lb" fi -_ARCHIVE_TYPE="other" +_GENERIC_FILE_TYPE="other" + +if [[ ${_DISPLAY_HEADER}. == "y." ]]; then + if [[ ${_DISPLAY_ALL_INFO}. == "y." ]]; then + printf "%s;%s;%s;%s;%s;%s;%s\n" "filename" "sap_file_type" "target_dir" "extraction_dir" "file_type" "extract" "copy" + else + if [[ ${_DISPLAY_FILE_TYPE}. == "y." ]]; then + printf "%-40s %-24s %-6s\n" "filename:" "sap_file_type" "file_type" + else + printf "%-40s %-24s\n" "filename:" "sap_file_type" + fi + fi +fi for _FILE in "$@"; do _FILE_OUTPUT=$(file "${_FILE}" | sed 's,'"${_FILE}"': ,,') if [[ ${_FILE_OUTPUT}. == "data." ]] && [[ (${_FILE##*.} == "SAR" || ${_FILE##*.} == "sar") ]]; then - _ARCHIVE_TYPE="sapcar" + _GENERIC_FILE_TYPE="sapcar" _list_content="${_SAPCAR_FILE} -tvf" else - _ARCHIVE_TYPE=$(echo "${_FILE_OUTPUT}" | awk ' + _GENERIC_FILE_TYPE=$(echo "${_FILE_OUTPUT}" | awk ' BEGIN{_file_type="other"} /RAR self-extracting archive/{_file_type="rarexe"} /RAR archive data/{_file_type="rar"} @@ -146,19 +159,23 @@ for _FILE in "$@"; do /SAPCAR archive data/{_file_type="sapcar"} /directory/{_file_type="dir"} END{print _file_type}') - if [[ ${_ARCHIVE_TYPE}. == "rarexe." ]]; then + if [[ ${_GENERIC_FILE_TYPE}. == "rarexe." ]]; then _list_content="${_LSAR_COMMAND}" - elif [[ ${_ARCHIVE_TYPE}. == "rar." ]]; then + elif [[ ${_GENERIC_FILE_TYPE}. == "rar." ]]; then _list_content="${_LSAR_COMMAND}" - elif [[ ${_ARCHIVE_TYPE}. == "zip." ]]; then + elif [[ ${_GENERIC_FILE_TYPE}. == "zip." ]]; then _list_content="zipinfo -1" - elif [[ ${_ARCHIVE_TYPE}. == "sapcar." ]]; then + elif [[ ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then _list_content="${_SAPCAR_FILE} -tvf" - elif [[ ${_ARCHIVE_TYPE}. == "dir." ]]; then + elif [[ ${_GENERIC_FILE_TYPE}. == "dir." ]]; then _list_content="" fi fi - printf "%-40s " "${_FILE}": + if [[ ${_DISPLAY_ALL_INFO}. == "y." ]]; then + printf "%s%s" "${_FILE}" "${_DELIMITER}" + else + printf "%-40s " "${_FILE}": + fi if [[ ! -e "${_FILE}" ]]; then echo "No such file or directory." @@ -180,20 +197,20 @@ for _FILE in "$@"; do /ASEBC/{_sap_file_type="sapase_client"} /COMPLETE/{_sap_file_type="saphana_backup"} /S4/&&/HANA/&&/LANG/{_sap_file_type="sap_s4hana_lang"} - /S4/&&/EXPORT/{_sap_file_type="sap_s4hana_export"} - /BW4/&&/EXPORT/{_sap_file_type="sap_bw4hana_export"} + /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"} + /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} END{print _sap_file_type}') if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. != "look_inside." ]]; then _SAP_FILE_TYPE=${SAP_FILE_TYPE_FROM_FILENAME} else - if [[ ${_ARCHIVE_TYPE}. == "dir." ]]; then + if [[ ${_GENERIC_FILE_TYPE}. == "dir." ]]; then _SAP_FILE_TYPE=${_FILE_OUTPUT} - elif [[ ${_ARCHIVE_TYPE}. == "rarexe." || - ${_ARCHIVE_TYPE}. == "rar." || - ${_ARCHIVE_TYPE}. == "zip." || - ${_ARCHIVE_TYPE}. == "sapcar." ]]; then + elif [[ ${_GENERIC_FILE_TYPE}. == "rarexe." || + ${_GENERIC_FILE_TYPE}. == "rar." || + ${_GENERIC_FILE_TYPE}. == "zip." || + ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' BEGIN{_sap_file_type="sap_unknown"} /BD_SYBASE_ASE/{_sap_file_type="sapase"} @@ -205,10 +222,10 @@ for _FILE in "$@"; do /db2setup/{_sap_file_type="ibmdb2"} /db6_update_client.sh/{_sap_file_type="ibmdb2_client"} /db2aese_c.lic/{_sap_file_type="ibmdb2_license"} - /DATA_UNITS\/EXPORT/{_sap_file_type="sapecc_export"} - /EXP[0-9]/{_sap_file_type="sapecc_ides_export"} - /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sapnwas_abap_export"} - /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sapnwas_java_export"} + /DATA_UNITS\/EXPORT/{_sap_file_type="sap_export_ecc"} + /EXP[0-9]/{_sap_file_type="sap_export_ecc_ides"} + /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"} + /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} /format error in header/{_sap_file_type="format_error_in_header"} END{print _sap_file_type}') else @@ -216,45 +233,76 @@ for _FILE in "$@"; do fi fi - _DIRECTORY=${_SAP_FILE_TYPE} + _TARGET_DIRECTORY=${_SAP_FILE_TYPE} + _EXTRACTION_DIRECTORY=${_SAP_FILE_TYPE}_extracted _EXTRACT="y" + _COPY="n" case ${_SAP_FILE_TYPE} in directory) _EXTRACT="n" + _EXTRACTION_DIRECTORY="none" ;; sapcar) + _TARGET_DIRECTORY="auto" + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" + _COPY="y" + ;; + sap_hostagent) + _TARGET_DIRECTORY="auto" + _EXTRACTION_DIRECTORY="none" _EXTRACT="n" + _COPY="y" + ;; + saphana_client) + _TARGET_DIRECTORY="auto" + _EXTRACTION_DIRECTORY="sap_hana_client" + _EXTRACT="y" + _COPY="y" ;; sapase|sapase_client) - _DIRECTORY="sapase" + _TARGET_DIRECTORY="sapase" ;; sapmaxdb) ;; oracledb|oracledb_client|oracledb_tools) - _DIRECTORY="oracledb" + _TARGET_DIRECTORY="oracledb" ;; ibmdb2|ibmdb2_client|ibmdb2_license) - _DIRECTORY="ibmdb2" + _TARGET_DIRECTORY="ibmdb2" + ;; + saphana|saphana_other|sap_vch_afl) + _TARGET_DIRECTORY="sap_hana" + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" + ;; + sap_swpm) + _TARGET_DIRECTORY="sap_swpm" + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" + ;; + sap_kernel|sap_igs|sap_webdisp|sap_jvm) + _TARGET_DIRECTORY="sap_swpm_download_basket" + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" ;; - saphana|saphana_client|saphana_other) - _DIRECTORY="saphana" + sap_export*) ;; - sap_swpm|sap_kernel|sap_igs|sap_webdisp|sap_jvm) - _DIRECTORY="sap_swpm" + *) + _TARGET_DIRECTORY="sap_swpm_download_basket" + _EXTRACTION_DIRECTORY="none" _EXTRACT="n" ;; esac - printf "%-24s " "${_SAP_FILE_TYPE}" - if [[ ${_DISPLAY_DIRECTORY}. == "y." ]]; then - printf "%-24s" "${_DIRECTORY}" - fi - if [[ ${_DISPLAY_FILE_TYPE}. == "y." ]]; then - printf "%-6s " "${_ARCHIVE_TYPE}" - fi - if [[ ${_DISPLAY_EXTRACT}. == "y." ]]; then - printf "%-2s" "${_EXTRACT}" + if [[ ${_DISPLAY_ALL_INFO}. == "y." ]]; then + printf "%s%s%s%s%s%s%s%s%s%s%s\n" "${_SAP_FILE_TYPE}" "${_DELIMITER}" "${_TARGET_DIRECTORY}" "${_DELIMITER}" "${_EXTRACTION_DIRECTORY}" "${_DELIMITER}" "${_GENERIC_FILE_TYPE}" "${_DELIMITER}" "${_EXTRACT}" "${_DELIMITER}" "${_COPY}" + else + if [[ ${_DISPLAY_FILE_TYPE}. == "y." ]]; then + printf "%-24s %-6s\n" "${_SAP_FILE_TYPE}" "${_GENERIC_FILE_TYPE}" + else + printf "%-24s\n" "${_SAP_FILE_TYPE}" + fi fi - printf "\n" done diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 50ab3e857..52900866d 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -2,11 +2,11 @@ - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for setting consecutive vars + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for setting consecutive vars ignore_errors: true - name: SAP Install Media Detect - Find files after extraction - Find SAPCAR - ansible.builtin.shell: ls SAPCAR*.EXE + ansible.builtin.shell: ls SAPCAR*.EXE | tail -1 args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_sapcar_file_name_get @@ -93,40 +93,35 @@ when: sap_install_media_detect_db == "sapmaxdb" - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB - ansible.builtin.shell: | - ls SAPEXEDB_*.SAR + ansible.builtin.shell: ls SAPEXEDB_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_dependent_file_name_get when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Find files after extraction - Find SAPEXE - ansible.builtin.shell: | - ls SAPEXE_*.SAR + ansible.builtin.shell: ls SAPEXE_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_independent_file_name_get when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Find files after extraction - Find IGS - ansible.builtin.shell: | - ls igsexe*.sar + ansible.builtin.shell: ls igsexe*.sar args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find IGS Helper - ansible.builtin.shell: | - ls igshelper*.sar + ansible.builtin.shell: ls igshelper*.sar args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find WEBDISP - ansible.builtin.shell: | - ls SAPWEBDISP_*.SAR + ansible.builtin.shell: ls SAPWEBDISP_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_web_dispatcher_file_name_get @@ -135,7 +130,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_ecc_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' @@ -145,7 +140,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_ecc_ides_extracted" recurse: true file_type: directory patterns: '.*EXP.*' @@ -175,7 +170,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_nwas_abap_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' @@ -185,7 +180,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_nwas_java_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' @@ -195,7 +190,8 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export ansible.builtin.find: - paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" +# paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_solman_abap_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_nwas_abap_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index a22599da5..d461beb32 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,9 +1,9 @@ --- -# The sapcar (SAPCAR.EXE) program is required for the detection of the SAP file types. -- name: SAP Install Media Detect - Prepare - Set fact for the sapcar program - ansible.builtin.set_fact: - __sap_install_media_detect_fact_sapcar_path_for_sapfile: "{{ sap_install_media_detect_sapcar_path | d('sapcar') }}" +# The sapcar (SAPCAR.EXE) program is required for the detection of the SAP file types. It is detected in create_file_list_phase_1.yml +#- name: SAP Install Media Detect - Prepare - Set fact for the sapcar program +# ansible.builtin.set_fact: +# __sap_install_media_detect_fact_sapcar_path_for_sapfile: "{{ sap_install_media_detect_sapcar_path | d('sapcar') }}" - name: SAP Install Media Detect - Prepare - Provide sapfile utility ansible.builtin.include_tasks: diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 2dd095009..e29a3d5ce 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -15,7 +15,7 @@ - name: SAP Install Media Detect - Organize all files - Remove existing archive extraction directories ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" state: absent loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: @@ -29,7 +29,7 @@ - name: SAP Install Media Detect - Organize all files - Create archive extraction directories ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" state: directory owner: root group: root @@ -44,9 +44,9 @@ line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar') -- name: SAP Install Media Detect - Organize all files - Create archive directories +- name: SAP Install Media Detect - Organize all files - Create target directories for archive files ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.archive_dir }}" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.target_dir }}" state: directory owner: root group: root @@ -55,13 +55,14 @@ loop_control: loop_var: line_item when: - line_item.archive_type == 'zip' or - line_item.archive_type == 'rarexe' or - line_item.archive_type == 'rar' or - line_item.archive_type == 'sapcar' + line_item.target_dir != 'auto' and + (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') - name: SAP Install Media Detect - Organize all files - Extract zip archive files - ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -72,7 +73,7 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract rar archive files - ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ __sap_install_media_detect_rar_extract_directory_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ __sap_install_media_detect_rar_extract_directory_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -83,7 +84,7 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files - ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.sap_file_type }}_extracted" + ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" @@ -93,21 +94,54 @@ - line_item.archive_type == 'sapcar' - line_item.extract_archive == 'y' -- name: SAP Install Media Detect - Organize all files - Copy sapcar to sap_swpm directory +- name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: src: "{{ __sap_install_media_detect_fact_sapcar_path }}" - dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" + dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana/{{ line_item.file }}" remote_src: true owner: root group: root mode: '0755' + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - sap_install_media_detect_db == 'saphana' + - (line_item.sap_file_type == 'saphana_client' or + line_item.sap_file_type == 'sap_hostagent') + +- name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_swpm_download_basket' directory + ansible.builtin.copy: + src: "{{ __sap_install_media_detect_fact_sapcar_path }}" + dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket/{{ line_item.file }}" + remote_src: true + owner: root + group: root + mode: '0755' + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - sap_install_media_detect_swpm + - (line_item.sap_file_type == 'sapcar' or + line_item.sap_file_type == 'saphana_client' or + line_item.sap_file_type == 'sap_hostagent') + +- name: SAP Install Media Detect - Organize all files - Copy archive files into subdirectories + ansible.builtin.shell: "set -o pipefail && cp {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.target_dir }}/{{ line_item.file }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item when: - sap_install_media_detect_swpm + - line_item.copy_archive == 'y' + - line_item.sap_file_type != 'sapcar' + - line_item.sap_file_type != 'saphana_client' + - line_item.sap_file_type != 'sap_hostagent' -- name: SAP Install Media Detect - Organize all files - Move all archive files into subdirectories - ansible.builtin.shell: "set -o pipefail && mv {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.archive_dir }}/{{ line_item.file }}" +- name: SAP Install Media Detect - Organize all files - Move archive files into subdirectories + ansible.builtin.shell: "set -o pipefail && mv {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.target_dir }}/{{ line_item.file }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item when: - line_item.sap_file_type != 'sapcar' + - line_item.copy_archive == 'n' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index ab642ca92..daf351033 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -26,6 +26,22 @@ __sap_install_media_detect_fact_find_result_phase_1: "{{ __sap_install_media_detect_fact_find_result_phase_1 + [item.path] }}" loop: "{{ __sap_install_media_detect_register_find_result_phase_1.files }}" +# If more than one SAPCAR file is found, we will use the last one. +- name: SAP Install Media Detect - Prepare - Identify sapcar + ansible.builtin.set_fact: + __sap_install_media_detect_fact_sapcar_path: "{{ sap_install_media_detect_source_directory }}/{{ line_item | basename }}" + loop: "{{ __sap_install_media_detect_fact_find_result_phase_1 }}" + loop_control: + loop_var: line_item + when: line_item is search("SAPCAR") + +- name: SAP Install Media Detect - Prepare - Ensure sapcar is executable + ansible.builtin.file: + path: "{{ __sap_install_media_detect_fact_sapcar_path }}" + owner: root + group: root + mode: '0755' + - name: SAP Install Media Detect - Prepare - Set fact with any file names without extension ansible.builtin.set_fact: __sap_install_media_detect_fact_files_without_extension: "{{ __sap_install_media_detect_fact_files_without_extension + [item] }}" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index ec3513631..209139b04 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -23,7 +23,7 @@ loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" - name: SAP Install Media Detect - Prepare - Iterate over files and determine file type - ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -lde --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path_for_sapfile }} {{ line_item }} | awk '{print $(NF-3), $(NF-2), $(NF-1), $NF}' + ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -le --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} {{ line_item }} register: __sap_install_media_detect_register_files_phase_2 loop: "{{ __sap_install_media_detect_fact_find_result_phase_2 }}" loop_control: @@ -38,60 +38,64 @@ __new_dict: dir: "{{ item.line_item | dirname }}" file: "{{ item.line_item | basename }}" - sap_file_type: "{{ item.stdout.split(' ')[0] }}" - archive_dir: "{{ item.stdout.split(' ')[1] }}" - archive_type: "{{ item.stdout.split(' ')[2] }}" - extract_archive: "{{ item.stdout.split(' ')[3] }}" + sap_file_type: "{{ item.stdout.split(';')[1] }}" + target_dir: "{{ item.stdout.split(';')[2] }}" + extraction_dir: "{{ item.stdout.split(';')[3] }}" + archive_type: "{{ item.stdout.split(';')[4] }}" + extract_archive: "{{ item.stdout.split(';')[5] }}" + copy_archive: "{{ item.stdout.split(';')[6] }}" when: - (item.stdout.split(' ')[0] == 'sapcar') or - (sap_install_media_detect_swpm | d('false') and item.stdout.split(' ')[0] == 'sap_swpm') or - (sap_install_media_detect_hostagent | d('false') and item.stdout.split(' ')[0] == 'sap_hostagent') or - (sap_install_media_detect_igs | d('false') and item.stdout.split(' ')[0] == 'sap_igs') or - (sap_install_media_detect_kernel | d('false') and item.stdout.split(' ')[0] == 'sap_kernel') or - (sap_install_media_detect_webdisp | d('false') and item.stdout.split(' ')[0] == 'sap_webdisp') or + (item.stdout.split(';')[1] == 'sapcar') or + (item.stdout.split(';')[1] == 'sap_jvm') or + (item.stdout.split(';')[1] == 'sap_unknown') or + (sap_install_media_detect_swpm | d('false') and item.stdout.split(';')[1] == 'sap_swpm') or + (sap_install_media_detect_hostagent | d('false') and item.stdout.split(';')[1] == 'sap_hostagent') or + (sap_install_media_detect_igs | d('false') and item.stdout.split(';')[1] == 'sap_igs') or + (sap_install_media_detect_kernel | d('false') and item.stdout.split(';')[1] == 'sap_kernel') or + (sap_install_media_detect_webdisp | d('false') and item.stdout.split(';')[1] == 'sap_webdisp') or (sap_install_media_detect_db == 'saphana' and ( - item.stdout.split(' ')[0] == 'saphana' or - item.stdout.split(' ')[0] == 'saphana_client' or - item.stdout.split(' ')[0] == 'saphana_other') + item.stdout.split(';')[1] == 'saphana' or + item.stdout.split(';')[1] == 'saphana_client' or + item.stdout.split(';')[1] == 'saphana_other') ) or - (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(' ')[0] == 'sapmaxdb') or + (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or (sap_install_media_detect_db == 'sapase' and ( - item.stdout.split(' ')[0] == 'sapase' or - item.stdout.split(' ')[0] == 'sapase_client') + item.stdout.split(';')[1] == 'sapase' or + item.stdout.split(';')[1] == 'sapase_client') ) or (sap_install_media_detect_db == 'oracledb' and ( - item.stdout.split(' ')[0] == 'oracledb' or - item.stdout.split(' ')[0] == 'oracledb_client') + item.stdout.split(';')[1] == 'oracledb' or + item.stdout.split(';')[1] == 'oracledb_client') ) or (sap_install_media_detect_db == 'ibmdb2' and ( - item.stdout.split(' ')[0] == 'ibmdb2' or - item.stdout.split(' ')[0] == 'ibmdb2_client' or - item.stdout.split(' ')[0] == 'ibmdb2_license') + item.stdout.split(';')[1] == 'ibmdb2' or + item.stdout.split(';')[1] == 'ibmdb2_client' or + item.stdout.split(';')[1] == 'ibmdb2_license') ) or - (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(' ')[0] == 'sap_s4hana_export') or - (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(' ')[0] == 'sap_bw4hana_export') or - (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(' ')[0] == 'sapnwas_abap_export') or - (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(' ')[0] == 'sapnwas_java_export') or - (sap_install_media_detect_export == 'sapecc' and item.stdout.split(' ')[0] == 'sapecc_export') or - (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(' ')[0] == 'sapecc_ides_export') + (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(';')[1] == 'sap_export_s4hana') or + (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(';')[1] == 'sap_export_bw4hana') or + (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or + (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or + (sap_install_media_detect_export == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or + (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') -- name: SAP Install Media Detect - Prepare - Identify the sapcar program - ansible.builtin.set_fact: - __sap_install_media_detect_fact_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/{{ item.line_item | basename }}" - loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" - when: item.stdout.split(' ')[0] == 'sapcar' +#- name: SAP Install Media Detect - Prepare - Identify the sapcar program +# ansible.builtin.set_fact: +# __sap_install_media_detect_fact_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/{{ item.line_item | basename }}" +# loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" +# when: item.stdout.split(';')[1] == 'sapcar' -- name: SAP Install Media Detect - Prepare - Ensure sapcar is executable - ansible.builtin.file: - path: "{{ __sap_install_media_detect_fact_sapcar_path }}" - owner: root - group: root - mode: '0755' +#- name: SAP Install Media Detect - Prepare - Ensure sapcar is executable +# ansible.builtin.file: +# path: "{{ __sap_install_media_detect_fact_sapcar_path }}" +# owner: root +# group: root +# mode: '0755' - name: SAP Install Media Detect - Prepare - Display the file dict, phase 2 ansible.builtin.debug: var: __sap_install_media_detect_fact_files_sapfile_results -- name: SAP Install Media Detect - Prepare - Display the path to the sapcar program - ansible.builtin.debug: - var: __sap_install_media_detect_fact_sapcar_path +#- name: SAP Install Media Detect - Prepare - Display the path to the sapcar program +# ansible.builtin.debug: +# var: __sap_install_media_detect_fact_sapcar_path diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index d907b5116..7f1e2707e 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -7,18 +7,26 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SWPM ansible.builtin.set_fact: # sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # now in identify_files_after_extraction.yml - sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" - sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role - sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" + sap_swpm_install_directory: "{{ sap_swpm_software_path }}" +# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # set in find_files_after_extraction.yml +# sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role + sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role +# sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role + sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_swpm -- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install + ansible.builtin.set_fact: + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" + sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" # for sap_hana_install Ansible Role + sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role + ignore_errors: true + when: sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm ansible.builtin.set_fact: - sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" - sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana" # for sap_hana_install Ansible Role - sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/saphana_extracted" # for sap_hana_install Ansible Role sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "saphana" @@ -130,6 +138,7 @@ - name: SAP Install Media Detect - Detection completed - Set fact for displaying all variables ansible.builtin.set_fact: + __sap_install_media_detect_result: "{{ __sap_install_media_detect_result | d('') + item + ';' + lookup('vars', item, default='') + '\n' }}" __sap_install_media_detect_vars: "{{ __sap_install_media_detect_vars | d('') + item + ' = >' + lookup('vars', item, default='') + '<\n' }}" loop: - sap_hana_install_directory @@ -162,6 +171,6 @@ - sap_swpm_web_dispatcher_path - sap_swpm_web_dispatcher_file_name -- name: SAP Install Media Detect - Detection completed - Display all variables +- name: SAP Install Media Detect - Detection completed - Display result ansible.builtin.debug: msg: "{{ __sap_install_media_detect_vars.split('\n')[:-1] }}" From 300754573c7e23518490ac1fe36c8b8bcc3a1452 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 17 Aug 2023 12:39:02 +0200 Subject: [PATCH 014/179] sap_install_media_detect: implement file server only; optionally create target directory --- .../sap_install_media_detect/defaults/main.yml | 3 +++ roles/sap_install_media_detect/tasks/main.yml | 4 ++++ .../tasks/organize_files.yml | 13 +++++++++++++ .../tasks/prepare/check_directories.yml | 18 +++++++++++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index d096b1ac1..d41346361 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -46,6 +46,9 @@ sap_install_media_detect_source_directory: /software # Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory #sap_install_media_detect_target_directory: /software_local +# Create target directory if it does not yet exist. If set to false, perform a check only +sap_install_media_detect_create_target_directory: true + # If there are two files of the same RAR or ZIP type, one with and one without suffix, the following parameter will determine what # the role will do for such a file: skip the file renaming, fail, or overwrite the file with the suffix by the file without suffix sap_install_media_detect_rename_target_file_exists: 'skip' diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index d461beb32..f25074ff5 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -46,6 +46,7 @@ apply: tags: sap_install_media_detect_create_file_list_phase_2 tags: sap_install_media_detect_create_file_list_phase_2 + when: not sap_install_media_detect_file_server_only - name: SAP Install Media Detect - Organize files ansible.builtin.include_tasks: @@ -53,6 +54,7 @@ apply: tags: sap_install_media_detect_organize_files tags: sap_install_media_detect_organize_files + when: not sap_install_media_detect_file_server_only - name: SAP Install Media Detect - Find files after extraction ansible.builtin.include_tasks: @@ -60,6 +62,7 @@ apply: tags: sap_install_media_detect_find_files_after_extraction tags: sap_install_media_detect_find_files_after_extraction + when: not sap_install_media_detect_file_server_only - name: SAP Install Media Detection Completed - Set global vars for subsequent Ansible tasks or roles ansible.builtin.include_tasks: @@ -67,6 +70,7 @@ apply: tags: sap_install_media_detect_set_global_vars tags: sap_install_media_detect_set_global_vars + when: not sap_install_media_detect_file_server_only - name: SAP Install Media Detection Completed - Cleanup - Disable the EPEL repo if necessary ansible.builtin.include_tasks: diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index e29a3d5ce..270d7a94d 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -61,6 +61,19 @@ line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar') +- name: SAP Install Media Detect - Organize all files - Create target directory sap_swpm_download_basket archive files + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" + state: directory + owner: root + group: root + mode: '0755' + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + line_item.target_dir == 'auto' + - name: SAP Install Media Detect - Organize all files - Extract zip archive files ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" args: diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index 647639d9d..70bdb0f5c 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -17,21 +17,37 @@ - sap_install_media_detect_target_directory | string | length > 0 block: + - name: SAP Install Media Detect - Prepare - Create 'sap_install_media_detect_target_directory' + ansible.builtin.file: + path: "{{ sap_install_media_detect_target_directory }}" + state: directory + owner: 'root' + group: 'root' + mode: '0755' + when: + - sap_install_media_detect_create_target_directory + - name: SAP Install Media Detect - Prepare - Get info of 'sap_install_media_detect_target_directory' ansible.builtin.stat: path: "{{ sap_install_media_detect_target_directory }}" register: __sap_install_media_detect_target_directory_stat + when: + - not sap_install_media_detect_create_target_directory - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_target_directory' exists ansible.builtin.fail: msg: "FAIL: Directory {{ sap_install_media_detect_target_directory }} does not exist!" - when: not __sap_install_media_detect_target_directory_stat.stat.exists + when: + - not sap_install_media_detect_create_target_directory + - not __sap_install_media_detect_target_directory_stat.stat.exists - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_target_directory' is writable ansible.builtin.assert: that: __sap_install_media_detect_target_directory_stat.stat.writeable fail_msg: "FAIL: Directory {{ sap_install_media_detect_target_directory }} is not writable!" success_msg: "PASS: Directory {{ sap_install_media_detect_target_directory }} is writable." + when: + - not sap_install_media_detect_create_target_directory - name: SAP Install Media Detect - Prepare - Set facts in case of remote file system' ansible.builtin.set_fact: From 3783c55398512a3ce078794bbb8089beea2a8176 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 18 Aug 2023 00:03:47 +0200 Subject: [PATCH 015/179] sap_install_media_detect: extract export zip files into different subdirs; fail early if files are missing --- .../defaults/main.yml | 7 +- .../files/tmp/sapfile | 6 + .../tasks/find_files_after_extraction.yml | 17 +- .../tasks/organize_files.yml | 34 ++- .../prepare/create_file_list_phase_1.yml | 6 +- .../prepare/create_file_list_phase_2.yml | 232 +++++++++++++++++- .../tasks/set_global_vars.yml | 12 +- 7 files changed, 291 insertions(+), 23 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index d41346361..06a1077f9 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -55,8 +55,9 @@ sap_install_media_detect_rename_target_file_exists: 'skip' #sap_install_media_detect_rename_target_file_exists: 'fail' #sap_install_media_detect_rename_target_file_exists: 'overwrite' -# local_dir, remote_dir (e.g. NFS, s3fuse) -#sap_install_media_detect_source: local_dir +# By default, the presence of at least one file for each file type according to the configured role parameters is asserted. Set the +# following parameter to 'false' to skip this step. +#sap_install_media_detect_assert_after_sapfile: false # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_db: "saphana" @@ -68,7 +69,7 @@ sap_install_media_detect_igs: true sap_install_media_detect_kernel: true sap_install_media_detect_webdisp: false -# saps4hana, sapecc, sapecc_ides, sapbw4hana, sapnwas_abap, sapnwas_java +# saps4hana, sapbw4hana, sapecc, sapecc_ides, sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java sap_install_media_detect_export: # e.g. /db_backup diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 4032ff7f9..9d40b397b 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -226,8 +226,14 @@ for _FILE in "$@"; do /EXP[0-9]/{_sap_file_type="sap_export_ecc_ides"} /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"} /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} + /DATA_UNITS\/SOLMAN/&&/_JAVA_UT/{_sap_file_type="sap_export_solman_java"} /format error in header/{_sap_file_type="format_error_in_header"} END{print _sap_file_type}') + if [[ ${_SAP_FILE_TYPE}. == "sap_export_nwas_abap." && ${_GENERIC_FILE_TYPE}. == "zip." ]]; then + _SAP_FILE_TYPE=$(unzip -p "${_FILE}" LABEL.ASC | awk ' + /SAP SOLUTION MANAGER/{_sap_file_type="sap_export_solman_abap"} + END{print _sap_file_type}') + fi else _SAP_FILE_TYPE="sap_unknown" fi diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 52900866d..38fae9996 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -6,7 +6,7 @@ ignore_errors: true - name: SAP Install Media Detect - Find files after extraction - Find SAPCAR - ansible.builtin.shell: ls SAPCAR*.EXE | tail -1 + ansible.builtin.shell: set -o pipefail && ls SAPCAR*.EXE | tail -1 args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_sapcar_file_name_get @@ -190,11 +190,20 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export ansible.builtin.find: -# paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_solman_abap_extracted" - paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_nwas_abap_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_solman_abap_extracted" recurse: true file_type: directory patterns: '.*DATA_UNITS.*' use_regex: true - register: detect_directory_solgmr_export_extracted + register: detect_directory_solgmr_abap_export_extracted when: sap_install_media_detect_export == "sapsolman_abap" + +- name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (JAVA) platform only Export + ansible.builtin.find: + paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_solman_java_extracted" + recurse: true + file_type: directory + patterns: '.*DATA_UNITS.*' + use_regex: true + register: detect_directory_solgmr_java_export_extracted + when: sap_install_media_detect_export == "sapsolman_java" diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 270d7a94d..2cf79fc61 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -61,7 +61,21 @@ line_item.archive_type == 'rar' or line_item.archive_type == 'sapcar') -- name: SAP Install Media Detect - Organize all files - Create target directory sap_swpm_download_basket archive files +- name: SAP Install Media Detect - Organize all files - Create target directory 'sap_hana' + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" + state: directory + owner: root + group: root + mode: '0755' + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - sap_install_media_detect_db == 'saphana' + - line_item.target_dir == 'auto' + +- name: SAP Install Media Detect - Organize all files - Create target directory 'sap_swpm_download_basket' ansible.builtin.file: path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" state: directory @@ -72,9 +86,22 @@ loop_control: loop_var: line_item when: - line_item.target_dir == 'auto' + - sap_install_media_detect_swpm + - line_item.target_dir == 'auto' + +- name: SAP Install Media Detect - Organize all files - Extract zip export archive files to separate subdirectories + ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/{{ (line_item.file | splitext)[0] }}" + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - line_item.archive_type == 'zip' + - line_item.extract_archive == 'y' + - line_item.sap_file_type is search("export") -- name: SAP Install Media Detect - Organize all files - Extract zip archive files +- name: SAP Install Media Detect - Organize all files - Extract zip non-export archive files ansible.builtin.shell: "set -o pipefail && unzip {{ line_item.file }} -d {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" @@ -84,6 +111,7 @@ when: - line_item.archive_type == 'zip' - line_item.extract_archive == 'y' + - not line_item.sap_file_type is search("export") - name: SAP Install Media Detect - Organize all files - Extract rar archive files ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_rar_extract }} {{ line_item.file }}{{ __sap_install_media_detect_rar_extract_directory_argument }} {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index daf351033..15f6c24d6 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -73,19 +73,19 @@ - name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'Zip archive data' ansible.builtin.set_fact: __sap_install_media_detect_fact_zip_files_without_extension: "{{ __sap_install_media_detect_fact_zip_files_without_extension + [item] }}" - when: item.file_type is search 'Zip archive data' + when: item.file_type is search("Zip archive data") loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR self-extracting archive' ansible.builtin.set_fact: __sap_install_media_detect_fact_exe_files_without_extension: "{{ __sap_install_media_detect_fact_exe_files_without_extension + [item] }}" - when: item.file_type is search 'RAR self-extracting archive' + when: item.file_type is search("RAR self-extracting archive") loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR archive data' ansible.builtin.set_fact: __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension + [item] }}" - when: item.file_type is search 'RAR archive data' + when: item.file_type is search("RAR archive data") loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - name: SAP Install Media Detect - Prepare - Fail if there is a zip or rar file without extension on read-only file system diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 209139b04..815bd9382 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -36,8 +36,10 @@ loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" vars: __new_dict: - dir: "{{ item.line_item | dirname }}" - file: "{{ item.line_item | basename }}" +# dir: "{{ item.line_item | dirname }}" +# file: "{{ item.line_item | basename }}" + dir: "{{ item.stdout.split(';')[0] | dirname }}" + file: "{{ item.stdout.split(';')[0] | basename }}" sap_file_type: "{{ item.stdout.split(';')[1] }}" target_dir: "{{ item.stdout.split(';')[2] }}" extraction_dir: "{{ item.stdout.split(';')[3] }}" @@ -48,11 +50,11 @@ (item.stdout.split(';')[1] == 'sapcar') or (item.stdout.split(';')[1] == 'sap_jvm') or (item.stdout.split(';')[1] == 'sap_unknown') or - (sap_install_media_detect_swpm | d('false') and item.stdout.split(';')[1] == 'sap_swpm') or - (sap_install_media_detect_hostagent | d('false') and item.stdout.split(';')[1] == 'sap_hostagent') or - (sap_install_media_detect_igs | d('false') and item.stdout.split(';')[1] == 'sap_igs') or - (sap_install_media_detect_kernel | d('false') and item.stdout.split(';')[1] == 'sap_kernel') or - (sap_install_media_detect_webdisp | d('false') and item.stdout.split(';')[1] == 'sap_webdisp') or + (sap_install_media_detect_swpm | d(false) and item.stdout.split(';')[1] == 'sap_swpm') or + (sap_install_media_detect_hostagent | d(false) and item.stdout.split(';')[1] == 'sap_hostagent') or + (sap_install_media_detect_igs | d(false) and item.stdout.split(';')[1] == 'sap_igs') or + (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] == 'sap_kernel') or + (sap_install_media_detect_webdisp | d(false) and item.stdout.split(';')[1] == 'sap_webdisp') or (sap_install_media_detect_db == 'saphana' and ( item.stdout.split(';')[1] == 'saphana' or item.stdout.split(';')[1] == 'saphana_client' or @@ -75,10 +77,226 @@ (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(';')[1] == 'sap_export_s4hana') or (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(';')[1] == 'sap_export_bw4hana') or (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or + (sap_install_media_detect_export == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or + (sap_install_media_detect_export == 'sapsolman_java' and item.stdout.split(';')[1] == 'sap_export_solman_java') or (sap_install_media_detect_export == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') +- name: SAP Install Media Detect - Prepare - Asserts + when: + - sap_install_media_detect_assert_after_sapfile | d(true) + block: + - name: SAP Install Media Detect - Prepare - Assert sapcar is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapcar') | length > 0 + fail_msg: "No sapcar file found" + + - name: SAP Install Media Detect - Prepare - Assert swpm is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_swpm') | length > 0 + fail_msg: "No file found for sap_swpm" + when: + - sap_install_media_detect_swpm | d(false) + + - name: SAP Install Media Detect - Prepare - Assert SAP Kernel, DB independent, is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXE') | length > 0 + fail_msg: "No DB independent SAP Kernel file found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert SAP Kernel, DB dependent, is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB') | length > 0 + fail_msg: "No DB dependent SAP Kernel file found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert SAP Host Agent is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_hostagent') | length > 0 + fail_msg: "No SAP Host Agent file found" + when: + - sap_install_media_detect_hostagent | d(false) + + - name: SAP Install Media Detect - Prepare - Assert igsexe is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igsexe') | length > 0 + fail_msg: "No igsexe file found" + when: + - sap_install_media_detect_igs | d(false) + + - name: SAP Install Media Detect - Prepare - Assert igshelper is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igshelper') | length > 0 + fail_msg: "No igshelper file found" + when: + - sap_install_media_detect_igs | d(false) + + - name: SAP Install Media Detect - Prepare - Assert sap_webdisp is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_webdisp') | length > 0 + fail_msg: "No sap_webdisp file found" + when: + - sap_install_media_detect_webdisp | d(false) + + - name: SAP Install Media Detect - Prepare - Assert saphana is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana') | length > 0 + fail_msg: "No file found for saphana" + when: + - (sap_install_media_detect_db | d('')) == 'saphana' + + - name: SAP Install Media Detect - Prepare - Assert saphana_client is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana_client') | length > 0 + fail_msg: "No file found for saphana_client" + when: + - (sap_install_media_detect_db | d('')) == 'saphana' + + - name: SAP Install Media Detect - Prepare - Assert sapase is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase') | length > 0 + fail_msg: "No file found for sapase" + when: + - (sap_install_media_detect_db | d('')) == 'sapase' + + - name: SAP Install Media Detect - Prepare - Assert sapase_client is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase_client') | length > 0 + fail_msg: "No file found for sapase_client" + when: + - (sap_install_media_detect_db | d('')) == 'sapase' + + - name: SAP Install Media Detect - Prepare - Assert sapmaxdb is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapmaxdb') | length > 0 + fail_msg: "No file found for sapmaxdb" + when: + - (sap_install_media_detect_db | d('')) == 'sapmaxdb' + + - name: SAP Install Media Detect - Prepare - Assert oracledb is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb') | length > 0 + fail_msg: "No file found for oracledb" + when: + - (sap_install_media_detect_db | d('')) == 'oracledb' + + - name: SAP Install Media Detect - Prepare - Assert oracledb_client is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb_client') | length > 0 + fail_msg: "No file found for oracledb_client" + when: + - (sap_install_media_detect_db | d('')) == 'oracledb' + + - name: SAP Install Media Detect - Prepare - Assert ibmdb2 is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2') | length > 0 + fail_msg: "No file found for ibmdb2" + when: + - (sap_install_media_detect_db | d('')) == 'ibmdb2' + + - name: SAP Install Media Detect - Prepare - Assert ibmdb2_client is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_client') | length > 0 + fail_msg: "No file found for ibmdb2_client" + when: + - (sap_install_media_detect_db | d('')) == 'ibmdb2' + + - name: SAP Install Media Detect - Prepare - Assert ibmdb2_license is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_license') | length > 0 + fail_msg: "No file found for ibmdb2_license" + when: + - (sap_install_media_detect_db | d('')) == 'ibmdb2' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_s4hana is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_s4hana') | length > 0 + fail_msg: "No file found for sap_export_s4hana" + when: + - (sap_install_media_detect_export | d('')) == 'sapbw4hana' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_bw4hana is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_bw4hana') | length > 0 + fail_msg: "No file found for sap_export_bw4hana" + when: + - (sap_install_media_detect_export | d('')) == 'saps4hana' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_ecc is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc') | length > 0 + fail_msg: "No file found for sap_export_ecc" + when: + - (sap_install_media_detect_export | d('')) == 'sapecc' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_ecc_ides is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc_ides') | length > 0 + fail_msg: "No file found for sap_export_ecc_ides" + when: + - (sap_install_media_detect_export | d('')) == 'sapecc_ides' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_nwas_abap is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_abap') | length > 0 + fail_msg: "No file found for sap_export_nwas_abap" + when: + - (sap_install_media_detect_export | d('')) == 'sapnwas_abap' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_nwas_java is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_java') | length > 0 + fail_msg: "No file found for sap_export_nwas_java" + when: + - (sap_install_media_detect_export | d('')) == 'sapnwas_java' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_solman_abap is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_abap') | length > 0 + fail_msg: "No file found for sap_export_solman_abap" + when: + - (sap_install_media_detect_export | d('')) == 'sapsolman_abap' + + - name: SAP Install Media Detect - Prepare - Assert sap_export_solman_java is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_java') | length > 0 + fail_msg: "No file found for sap_export_solman_java" + when: + - (sap_install_media_detect_export | d('')) == 'sapsolman_java' + #- name: SAP Install Media Detect - Prepare - Identify the sapcar program # ansible.builtin.set_fact: # __sap_install_media_detect_fact_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/{{ item.line_item | basename }}" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 7f1e2707e..a92b735c6 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -130,12 +130,18 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_solgmr_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_export_extracted.files[1].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_abap" +- name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (JAVA) + ansible.builtin.set_fact: + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_export == "sapsolman_java" + - name: SAP Install Media Detect - Detection completed - Set fact for displaying all variables ansible.builtin.set_fact: __sap_install_media_detect_result: "{{ __sap_install_media_detect_result | d('') + item + ';' + lookup('vars', item, default='') + '\n' }}" From 98aabd5ec76e6eb6cae2610705c45c9a0aab929e Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 18 Aug 2023 01:03:24 +0200 Subject: [PATCH 016/179] sap_install_media_detect: swap saps4hana and sapbw4hana in assertions --- .../tasks/prepare/create_file_list_phase_2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 815bd9382..6d3f1dfa9 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -239,7 +239,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_s4hana') | length > 0 fail_msg: "No file found for sap_export_s4hana" when: - - (sap_install_media_detect_export | d('')) == 'sapbw4hana' + - (sap_install_media_detect_export | d('')) == 'saps4hana' - name: SAP Install Media Detect - Prepare - Assert sap_export_bw4hana is present ansible.builtin.assert: @@ -247,7 +247,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_bw4hana') | length > 0 fail_msg: "No file found for sap_export_bw4hana" when: - - (sap_install_media_detect_export | d('')) == 'saps4hana' + - (sap_install_media_detect_export | d('')) == 'sapbw4hana' - name: SAP Install Media Detect - Prepare - Assert sap_export_ecc is present ansible.builtin.assert: From 9aeeae7af80b2e8f9bdcbf3707855f9173bab918 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 18 Aug 2023 01:07:37 +0200 Subject: [PATCH 017/179] sap_install_media_detect: fix wrong detection of S4 language files in sapfile --- roles/sap_install_media_detect/files/tmp/sapfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 9d40b397b..15b556289 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -196,7 +196,7 @@ for _FILE in "$@"; do /SAPJVM/{_sap_file_type="sap_jvm"} /ASEBC/{_sap_file_type="sapase_client"} /COMPLETE/{_sap_file_type="saphana_backup"} - /S4/&&/HANA/&&/LANG/{_sap_file_type="sap_s4hana_lang"} + /S4/&&/LANG/{_sap_file_type="sap_s4hana_lang"} /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"} /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} From 5ccabbedabda8d16e7d4f8239705a7a690396509 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 21 Aug 2023 15:19:38 +0200 Subject: [PATCH 018/179] sap_install_media_detect: if multiple SAPCAR, use the file with the latest time stamp --- .../tasks/find_files_after_extraction.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 38fae9996..8bc889173 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -6,7 +6,7 @@ ignore_errors: true - name: SAP Install Media Detect - Find files after extraction - Find SAPCAR - ansible.builtin.shell: set -o pipefail && ls SAPCAR*.EXE | tail -1 + ansible.builtin.shell: set -o pipefail && ls -1tr SAPCAR*.EXE | tail -1 args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_sapcar_file_name_get From 3925e716abd581cdc7f68e15b505edcc79b06b48 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 21 Aug 2023 16:30:57 +0200 Subject: [PATCH 019/179] sap_install_media_detect: fail if multiple SAPEXE, SAPEXEDB, or SAPWEBDIS --- .../tasks/find_files_after_extraction.yml | 41 ++++++++++++++----- .../prepare/create_file_list_phase_2.yml | 17 ++++---- 2 files changed, 40 insertions(+), 18 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 8bc889173..e7b0935eb 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -92,29 +92,43 @@ register: detect_directory_sapmaxdb_extracted when: sap_install_media_detect_db == "sapmaxdb" -- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB - ansible.builtin.shell: ls SAPEXEDB_*.SAR +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXE + ansible.builtin.shell: ls SAPEXE_*.SAR args: chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_dependent_file_name_get + register: sap_swpm_kernel_independent_file_name_get when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - Find files after extraction - Find SAPEXE - ansible.builtin.shell: ls SAPEXE_*.SAR +- name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXE found + ansible.builtin.fail: + msg: "More than one SAPEXE file has been detected." + when: + - sap_install_media_detect_kernel + - sap_swpm_kernel_independent_file_name_get.stdout_lines | count > 1 + +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB + ansible.builtin.shell: ls SAPEXEDB_*.SAR args: chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_independent_file_name_get + register: sap_swpm_kernel_dependent_file_name_get when: sap_install_media_detect_kernel -- name: SAP Install Media Detect - Find files after extraction - Find IGS - ansible.builtin.shell: ls igsexe*.sar +- name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB found + ansible.builtin.fail: + msg: "More than one SAPEXEDB file has been detected." + when: + - sap_install_media_detect_kernel + - sap_swpm_kernel_dependent_file_name_get.stdout_lines | count > 1 + +- name: SAP Install Media Detect - Find files after extraction - Find IGS, latest version + ansible.builtin.shell: set -o pipefail && ls -1tr igsexe*.sar | tail -1 args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get when: sap_install_media_detect_igs -- name: SAP Install Media Detect - Find files after extraction - Find IGS Helper - ansible.builtin.shell: ls igshelper*.sar +- name: SAP Install Media Detect - Find files after extraction - Find IGS Helper, latest version + ansible.builtin.shell: set -o pipefail && ls -1tr igshelper*.sar | tail -1 args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get @@ -128,6 +142,13 @@ ignore_errors: true when: sap_install_media_detect_webdisp +- name: SAP Install Media Detect - Find files after extraction - Fail if more than one WEBDISP found + ansible.builtin.fail: + msg: "More than one SAPWEBDISP file has been detected." + when: + - sap_install_media_detect_webdisp + - sap_swpm_web_dispatcher_file_name_get.stdout_lines | count > 1 + - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_ecc_extracted" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 6d3f1dfa9..c07fa3985 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -101,21 +101,21 @@ when: - sap_install_media_detect_swpm | d(false) - - name: SAP Install Media Detect - Prepare - Assert SAP Kernel, DB independent, is present + - name: SAP Install Media Detect - Prepare - Assert exactly one SAP Kernel DB independent is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXE') | length > 0 - fail_msg: "No DB independent SAP Kernel file found" + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXE_') | length == 1 + fail_msg: "No, or more than one, DB independent SAP Kernel file found" when: - sap_install_media_detect_kernel | d(false) - - name: SAP Install Media Detect - Prepare - Assert SAP Kernel, DB dependent, is present + - name: SAP Install Media Detect - Prepare - Assert exactly one SAP Kernel DB dependent is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB') | length > 0 - fail_msg: "No DB dependent SAP Kernel file found" + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file found" when: - sap_install_media_detect_kernel | d(false) @@ -145,11 +145,12 @@ when: - sap_install_media_detect_igs | d(false) - - name: SAP Install Media Detect - Prepare - Assert sap_webdisp is present + - name: SAP Install Media Detect - Prepare - Assert exactly one SAP WEBDISP is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_webdisp') | length > 0 - fail_msg: "No sap_webdisp file found" + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPWEBDISP_') | length == 1 + fail_msg: "No, or more than one, SAPWEBDISP file found" when: - sap_install_media_detect_webdisp | d(false) From 1fb98a01db99fac85911133f04147e41d83eeb36 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 21 Aug 2023 17:01:18 +0200 Subject: [PATCH 020/179] sap_install_media_detect: fail if multiple SAPEXEDB for any database --- .../files/tmp/sapfile | 10 +++- .../prepare/create_file_list_phase_2.yml | 52 +++++++++++++++++-- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 15b556289..7409f9e5c 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -190,7 +190,8 @@ for _FILE in "$@"; do !/IMDB_SERVER/&&!/IMDB_CLIENT/&&/IMDB/&&/\.SAR/{_sap_file_type="saphana_other"} /SWPM/&&/\.SAR/{_sap_file_type="sap_swpm"} /SAPHOSTAGENT/&&/\.SAR/{_sap_file_type="sap_hostagent"} - /SAPEXE_/||/SAPEXEDB_/{_sap_file_type="sap_kernel"} + /SAPEXE_/{_sap_file_type="sap_kernel"} + /SAPEXEDB_/{_sap_file_type="sap_kernel_db"} /igsexe/||/igshelper/{_sap_file_type="sap_igs"} /SAPWEBDISP_/{_sap_file_type="sap_webdisp"} /SAPJVM/{_sap_file_type="sap_jvm"} @@ -201,6 +202,11 @@ for _FILE in "$@"; do /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} END{print _sap_file_type}') + if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. == "sap_kernel_db." ]]; then + SAP_FILE_TYPE_FROM_FILENAME=$(eval "${_list_content}" "${_FILE}" | awk ' + /exe_/&&/\.lst/{gsub ("exe_", ""); gsub ("\\.lst", ""); db_type=$NF} + END{printf ("sap_kernel_db_%s\n", db_type)}') + fi if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. != "look_inside." ]]; then _SAP_FILE_TYPE=${SAP_FILE_TYPE_FROM_FILENAME} @@ -288,7 +294,7 @@ for _FILE in "$@"; do _EXTRACTION_DIRECTORY="none" _EXTRACT="n" ;; - sap_kernel|sap_igs|sap_webdisp|sap_jvm) + sap_kernel*|sap_igs|sap_webdisp|sap_jvm) _TARGET_DIRECTORY="sap_swpm_download_basket" _EXTRACTION_DIRECTORY="none" _EXTRACT="n" diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index c07fa3985..43a29ed16 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -54,6 +54,7 @@ (sap_install_media_detect_hostagent | d(false) and item.stdout.split(';')[1] == 'sap_hostagent') or (sap_install_media_detect_igs | d(false) and item.stdout.split(';')[1] == 'sap_igs') or (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] == 'sap_kernel') or + (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] is search('sap_kernel_db_')) or (sap_install_media_detect_webdisp | d(false) and item.stdout.split(';')[1] == 'sap_webdisp') or (sap_install_media_detect_db == 'saphana' and ( item.stdout.split(';')[1] == 'saphana' or @@ -110,15 +111,60 @@ when: - sap_install_media_detect_kernel | d(false) - - name: SAP Install Media Detect - Prepare - Assert exactly one SAP Kernel DB dependent is present + - name: SAP Install Media Detect - Prepare - Assert at least one SAP Kernel DB dependent is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length > 0 fail_msg: "No, or more than one, DB dependent SAP Kernel file found" when: - sap_install_media_detect_kernel | d(false) + - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP HANA is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length <= 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "More than one DB dependent SAP Kernel file for SAP HANA found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP ASE is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length <= 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "More than one DB dependent SAP Kernel file for SAP ASE found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP MAXDB is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length <= 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "More than one DB dependent SAP Kernel file for SAP MAXDB found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for Oracle DB is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length <= 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "More than one DB dependent SAP Kernel file for Oracle DB found" + when: + - sap_install_media_detect_kernel | d(false) + + - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for IBM Db2 is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length <= 1 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 + fail_msg: "More than one DB dependent SAP Kernel file for IBM Db2 found" + when: + - sap_install_media_detect_kernel | d(false) + - name: SAP Install Media Detect - Prepare - Assert SAP Host Agent is present ansible.builtin.assert: that: From 56ebfc10c3a3397ecd4fa39fecce6f325bc4c5c3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 22 Aug 2023 12:23:20 +0200 Subject: [PATCH 021/179] sap_install_media_detect: add set_fact sap_swpm_sapcar_path for SAPCAR --- roles/sap_install_media_detect/tasks/set_global_vars.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index a92b735c6..bb5546241 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -2,6 +2,7 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SAPCAR ansible.builtin.set_fact: + sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}" sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" - name: SAP Install Media Detect - Detection completed - Set fact for SWPM @@ -13,7 +14,7 @@ # sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role # sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role - sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role +# sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_swpm From 021613608979cc3f4825a85d6d9193e1fd9bee0d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 22 Aug 2023 13:08:27 +0200 Subject: [PATCH 022/179] sap_install_media_detect: Use change_when when listing files in Find files after extraction --- .../tasks/find_files_after_extraction.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index e7b0935eb..b0e30250e 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -97,6 +97,7 @@ args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_independent_file_name_get + changed_when: false when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXE found @@ -111,6 +112,7 @@ args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_dependent_file_name_get + changed_when: false when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB found @@ -125,6 +127,7 @@ args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get + changed_when: false when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find IGS Helper, latest version @@ -132,6 +135,7 @@ args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get + changed_when: false when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find WEBDISP @@ -140,6 +144,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_web_dispatcher_file_name_get ignore_errors: true + changed_when: false when: sap_install_media_detect_webdisp - name: SAP Install Media Detect - Find files after extraction - Fail if more than one WEBDISP found From b503b9a22911b2c3e571c441ef684def347ccf8c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 23 Aug 2023 00:51:33 +0200 Subject: [PATCH 023/179] sap_install_media_detect: fix source file for "Copy certain files to" --- roles/sap_install_media_detect/tasks/organize_files.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 2cf79fc61..c4af50dd8 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -137,7 +137,7 @@ - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: - src: "{{ __sap_install_media_detect_fact_sapcar_path }}" + src: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }}" dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana/{{ line_item.file }}" remote_src: true owner: root @@ -148,12 +148,13 @@ loop_var: line_item when: - sap_install_media_detect_db == 'saphana' - - (line_item.sap_file_type == 'saphana_client' or + - (line_item.sap_file_type == 'sapcar' or + line_item.sap_file_type == 'saphana_client' or line_item.sap_file_type == 'sap_hostagent') - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_swpm_download_basket' directory ansible.builtin.copy: - src: "{{ __sap_install_media_detect_fact_sapcar_path }}" + src: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }}" dest: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket/{{ line_item.file }}" remote_src: true owner: root From 40dc8c17a38537f347edec7b404185a6873e29ff Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 23 Aug 2023 17:41:00 +0200 Subject: [PATCH 024/179] sap_ha_pacemaker_cluster: renamed AWS related vars --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 4 ++-- roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml | 6 +++--- .../construct_vars_vip_resources_cloud_aws_ec2_vs.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index ac0cb4696..a17921fb8 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -136,8 +136,8 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ # TODO: network interface name used for client access -sap_ha_pacemaker_cluster_vip_client_interface: eth0 -sap_ha_pacemaker_cluster_vip_update_rt: [] +sap_ha_pacemaker_cluster_aws_vip_client_interface: eth0 +sap_ha_pacemaker_cluster_aws_vip_update_rt: [] ## A custom stonith definition that takes precedence over platform defaults. # sap_ha_pacemaker_cluster_stonith_custom: diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index e7495ee9d..16bac360e 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -222,11 +222,11 @@ argument_specs: # required: false # type: str - sap_ha_pacemaker_cluster_vip_client_interface: + sap_ha_pacemaker_cluster_aws_vip_client_interface: default: eth0 description: - OS device name of the network interface to use for the Virtual IP configuration. - - This is used for VIP agents that require an interface name, for example in cloud platform environments. + - This is needed for `aws_vpc_move_ip` resources in AWS EC2 environments. required: false type: str @@ -237,7 +237,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_update_rt: + sap_ha_pacemaker_cluster_aws_vip_update_rt: description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. - Required for VIP configuration in AWS EC2 environments. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 6e99cef8f..005d67dfa 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -61,9 +61,9 @@ - name: ip value: "{{ vip_list_item.value }}" - name: interface - value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" + value: "{{ sap_ha_pacemaker_cluster_aws_vip_client_interface }}" - name: routing_table - value: "{{ sap_ha_pacemaker_cluster_vip_update_rt | join(',') }}" + value: "{{ sap_ha_pacemaker_cluster_aws_vip_update_rt | join(',') }}" when: - (sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' From c2dba916092628c72893f0b0d2db03f0bba7ad9e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 23 Aug 2023 18:24:17 +0200 Subject: [PATCH 025/179] sap_ha_pacemaker_cluster: fix: service disable task does not fail when service is absent --- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index e05a72ea4..d7615ae2c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -111,6 +111,7 @@ # for instance cloud-init services on cloud platforms - name: "SAP HA Install Pacemaker - Stop and disable services" when: sap_ha_pacemaker_cluster_disable_services is defined + register: __sap_ha_pacemaker_cluster_disable_services ansible.builtin.service: name: "{{ service_item }}" enabled: false @@ -119,6 +120,9 @@ loop_control: loop_var: service_item label: "{{ service_item }}" + failed_when: + - __sap_ha_pacemaker_cluster_disable_services.failed + - '"Could not find the requested service" not in __sap_ha_pacemaker_cluster_disable_services.msg' # Before we are ready to call the ha_cluster role, we want to validate # that the minimum required parameters are defined and not empty. From 7ab6f5d18ce6a3de6ec2c546968fa3055b21f56e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 23 Aug 2023 19:19:36 +0200 Subject: [PATCH 026/179] sap_ha_pacemaker_cluster: fix: ascs and ers resource definition fixes --- .../defaults/main.yml | 15 +++++++++++-- ...construct_vars_netweaver_abap_ascs_ers.yml | 22 +++++++++++-------- .../tasks/construct_vars_netweaver_common.yml | 2 +- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index a17921fb8..5b9c24dde 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -21,11 +21,13 @@ sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_ha_cluster_nodes | default(sap_h sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('00') }}" +# TODO: document filesystem definitions sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" -sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs4 -sap_ha_pacemaker_cluster_storage_nfs_mount_options: hard,acl +sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs +sap_ha_pacemaker_cluster_storage_nfs_mount_options: '' sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" +# TODO: document the nw parameters sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" @@ -110,12 +112,21 @@ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWA # SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/ASCS<> # - /usr/sap/<>/ERS<> +# +# TODO: document parameters +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: '' +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: '' sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: false + +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: '' +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: '' sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: false # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/D<> diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 714ba306a..bdd5f64f0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -168,7 +168,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" options: - name: symmetrical value: "false" @@ -235,7 +235,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" options: - name: symmetrical value: "false" @@ -250,12 +250,14 @@ # - ASCS filesystem # - ASCS instance # - ASCS VIP +# The order of the resources in the group define the order in which they are +# started - resources are stopped in reverse order. - name: "SAP HA Prepare Pacemaker - Add resource group for ASCS resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ascs_group] }}" vars: __ascs_group: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" resource_ids: - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" @@ -271,12 +273,14 @@ # - ERS filesystem # - ERS instance # - ERS VIP +# The order of the resources in the group define the order in which they are +# started - resources are stopped in reverse order. - name: "SAP HA Prepare Pacemaker - Add resource group for ERS resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ers_group] }}" vars: __ers_group: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" resource_ids: - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" @@ -290,16 +294,16 @@ ################################################# # ERS and ASCS resource groups should try to avoid running on the same node -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: NetWeaver ERS and ASCS avoid on the same node" +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: ERS avoids to run on the ASCS node" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_ers] }}" vars: __constraint_colo_ers: resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" role: started resource_follower: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" options: - name: score value: -5000 @@ -313,10 +317,10 @@ vars: __constraint_order_ascs_ers: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" options: - name: symmetrical value: "false" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index b1d41f4fb..8bbf804a1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -37,7 +37,7 @@ - name: options value: "{{ __mount_opts }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_resource_filesystem_force_unmount }}" + value: safe operations: - action: start attrs: From f3867bd8083dd7792da4c90ad0809d51edf155bb Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 24 Aug 2023 10:11:48 +0200 Subject: [PATCH 027/179] sap_ha_pacemaker_cluster: fix: vars defaults and NW adjustments --- .../defaults/main.yml | 53 ++++++++++++++----- ...construct_vars_netweaver_abap_ascs_ers.yml | 18 ++----- .../vars/nwas_abap_ascs_ers.yml | 2 +- 3 files changed, 45 insertions(+), 28 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 5b9c24dde..c6ba2968d 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -27,6 +27,10 @@ sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs sap_ha_pacemaker_cluster_storage_nfs_mount_options: '' sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" +################################################################################ +# NetWeaver generic definitions +################################################################################ + # TODO: document the nw parameters sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" @@ -89,15 +93,15 @@ sap_ha_pacemaker_cluster_fence_options: ### Resource default patterns sap_ha_pacemaker_cluster_vip_address: "{{ sap_hana_vip | default(sap_cluster_vip) }}" sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" -sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" # SAP HANA - Resource IDs (names) as convenience parameters. -sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" -sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" - +# NFS filesystem resource requirement sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe @@ -109,23 +113,44 @@ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" -# SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. -# - /usr/sap/<>/ASCS<> -# - /usr/sap/<>/ERS<> -# # TODO: document parameters + +################################################################################ +# ASCS resource defaults +################################################################################ + +# Name of the instance profile sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: '' +# Full path with instance profile name sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: '' -sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" + +# SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. +# - /usr/sap/<>/ASCS<> +# - /usr/sap/<>/ERS<> + +sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: false +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: 5000 +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_migration_threshold: 1 +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_failure_timeout: 60 +# Stickiness of the ASCS group +sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: 3000 + +################################################################################ +# ERS resource defaults +################################################################################ + +# Name of the instance profile sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: '' +# Full path with instance profile name sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: '' -sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" + +sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: false # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index bdd5f64f0..c6bc7eeeb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -168,7 +168,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" options: - name: symmetrical value: "false" @@ -193,14 +193,6 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" - name: IS_ERS value: "true" - meta_attrs: - - attrs: - - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_stickiness }}" - - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_migration_threshold }}" - - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_failure_timeout }}" operations: - action: start attrs: @@ -235,7 +227,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" options: - name: symmetrical value: "false" @@ -265,7 +257,7 @@ meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness }}" when: - __ascs_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) @@ -300,10 +292,10 @@ vars: __constraint_colo_ers: resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" role: started resource_follower: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" options: - name: score value: -5000 diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml index a4118f6f7..d75ee86be 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml @@ -1,2 +1,2 @@ --- -sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" From 34758f395282f931aa43e40fbc909657a6e93325 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 24 Aug 2023 14:33:50 +0200 Subject: [PATCH 028/179] sap_install_media_detect: support skipping extraction and copying/moving --- .../defaults/main.yml | 6 +++ .../tasks/find_files_after_extraction.yml | 11 ++++- .../tasks/organize_files.yml | 43 ++++++++++++------- .../prepare/create_file_list_phase_2.yml | 10 ++++- .../tasks/set_global_vars.yml | 25 ++++++++--- 5 files changed, 71 insertions(+), 24 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 06a1077f9..4a866db28 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -55,6 +55,12 @@ sap_install_media_detect_rename_target_file_exists: 'skip' #sap_install_media_detect_rename_target_file_exists: 'fail' #sap_install_media_detect_rename_target_file_exists: 'overwrite' +# If you want the role to not extract archives which have the extract flag set, set the following parameter to `false`. +sap_install_media_detect_extract_archives: true + +# If you want the role to not move or copy archive files to the `target_dir` subdirectories, set the following parameter to `false`. +sap_install_media_detect_move_or_copy_archives: true + # By default, the presence of at least one file for each file type according to the configured role parameters is asserted. Set the # following parameter to 'false' to skip this step. #sap_install_media_detect_assert_after_sapfile: false diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index b0e30250e..14a70d110 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -1,9 +1,18 @@ --- -- name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files +- name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter set ansible.builtin.set_fact: sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for setting consecutive vars ignore_errors: true + when: + - sap_install_media_detect_move_or_copy_archives + +- name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter not set + ansible.builtin.set_fact: + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" # for setting consecutive vars + ignore_errors: true + when: + - not sap_install_media_detect_move_or_copy_archives - name: SAP Install Media Detect - Find files after extraction - Find SAPCAR ansible.builtin.shell: set -o pipefail && ls -1tr SAPCAR*.EXE | tail -1 diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index c4af50dd8..ea7075029 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -21,11 +21,12 @@ loop_control: loop_var: line_item when: - line_item.extract_archive == 'y' and - (line_item.archive_type == 'zip' or - line_item.archive_type == 'rarexe' or - line_item.archive_type == 'rar' or - line_item.archive_type == 'sapcar') + - sap_install_media_detect_extract_archives + - line_item.extract_archive == 'y' + - (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') - name: SAP Install Media Detect - Organize all files - Create archive extraction directories ansible.builtin.file: @@ -38,11 +39,12 @@ loop_control: loop_var: line_item when: - line_item.extract_archive == 'y' and - (line_item.archive_type == 'zip' or - line_item.archive_type == 'rarexe' or - line_item.archive_type == 'rar' or - line_item.archive_type == 'sapcar') + - sap_install_media_detect_extract_archives + - line_item.extract_archive == 'y' + - (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') - name: SAP Install Media Detect - Organize all files - Create target directories for archive files ansible.builtin.file: @@ -55,11 +57,12 @@ loop_control: loop_var: line_item when: - line_item.target_dir != 'auto' and - (line_item.archive_type == 'zip' or - line_item.archive_type == 'rarexe' or - line_item.archive_type == 'rar' or - line_item.archive_type == 'sapcar') + - sap_install_media_detect_move_or_copy_archives + - line_item.target_dir != 'auto' + - (line_item.archive_type == 'zip' or + line_item.archive_type == 'rarexe' or + line_item.archive_type == 'rar' or + line_item.archive_type == 'sapcar') - name: SAP Install Media Detect - Organize all files - Create target directory 'sap_hana' ansible.builtin.file: @@ -72,6 +75,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_db == 'saphana' - line_item.target_dir == 'auto' @@ -86,6 +90,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_swpm - line_item.target_dir == 'auto' @@ -97,6 +102,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_extract_archives - line_item.archive_type == 'zip' - line_item.extract_archive == 'y' - line_item.sap_file_type is search("export") @@ -109,6 +115,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_extract_archives - line_item.archive_type == 'zip' - line_item.extract_archive == 'y' - not line_item.sap_file_type is search("export") @@ -121,6 +128,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_extract_archives - line_item.archive_type == 'rarexe' - line_item.extract_archive == 'y' @@ -132,6 +140,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_extract_archives - line_item.archive_type == 'sapcar' - line_item.extract_archive == 'y' @@ -147,6 +156,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_db == 'saphana' - (line_item.sap_file_type == 'sapcar' or line_item.sap_file_type == 'saphana_client' or @@ -164,6 +174,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_swpm - (line_item.sap_file_type == 'sapcar' or line_item.sap_file_type == 'saphana_client' or @@ -175,6 +186,7 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - line_item.copy_archive == 'y' - line_item.sap_file_type != 'sapcar' - line_item.sap_file_type != 'saphana_client' @@ -186,4 +198,5 @@ loop_control: loop_var: line_item when: + - sap_install_media_detect_move_or_copy_archives - line_item.copy_archive == 'n' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 43a29ed16..9ab30c40c 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -75,8 +75,14 @@ item.stdout.split(';')[1] == 'ibmdb2_client' or item.stdout.split(';')[1] == 'ibmdb2_license') ) or - (sap_install_media_detect_export == 'saps4hana' and item.stdout.split(';')[1] == 'sap_export_s4hana') or - (sap_install_media_detect_export == 'sapbw4hana' and item.stdout.split(';')[1] == 'sap_export_bw4hana') or + (sap_install_media_detect_export == 'saps4hana' and ( + item.stdout.split(';')[1] == 'sap_export_s4hana' or + item.stdout.split(';')[1] == 'sap_s4hana_lang') + ) or + (sap_install_media_detect_export == 'sapbw4hana' and ( + item.stdout.split(';')[1] == 'sap_export_bw4hana' or + item.stdout.split(';')[1] == 'sap_s4hana_lang') + ) or (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or (sap_install_media_detect_export == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index bb5546241..ba3664e7f 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -7,10 +7,9 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SWPM ansible.builtin.set_fact: -# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # now in identify_files_after_extraction.yml +# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # set in find_files_after_extraction.yml # sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" sap_swpm_install_directory: "{{ sap_swpm_software_path }}" -# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # set in find_files_after_extraction.yml # sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role # sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role @@ -18,19 +17,33 @@ ignore_errors: true when: sap_install_media_detect_swpm -- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter set ansible.builtin.set_fact: sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" # for sap_hana_install Ansible Role - sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role +# sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role + ignore_errors: true + when: + - sap_install_media_detect_move_or_copy_archives + - sap_install_media_detect_db == "saphana" + +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter not set + ansible.builtin.set_fact: + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}" + sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}" # for sap_hana_install Ansible Role +# sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "saphana" + when: + - not sap_install_media_detect_move_or_copy_archives + - sap_install_media_detect_db == "saphana" - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm ansible.builtin.set_fact: sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "saphana" + when: + - sap_install_media_detect_move_or_copy_archives + - sap_install_media_detect_db == "saphana" - name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: From 3a6be9ed3c01da05045c35b02dee0c082ea77665 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 12:05:29 +0200 Subject: [PATCH 029/179] sap_install_media_detect: fix wrong search path for finding S/4HANA and BW/4HANA export files --- .../tasks/find_files_after_extraction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 14a70d110..1b5ac56dc 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -185,7 +185,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export ansible.builtin.find: - paths: "{{ sap_install_media_detect_source_directory }}" + paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: true file_type: file patterns: '.*S4.*EXPORT.*' @@ -195,7 +195,7 @@ - name: SAP Install Media Detect - Find files after extraction - Find SAP BW/4HANA Export ansible.builtin.find: - paths: "{{ sap_install_media_detect_target_directory }}" + paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: true file_type: file patterns: '.*BW4.*EXPORT.*' From 618dd10e2d111513ce33a20598b382fa45ec6869 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 12:09:50 +0200 Subject: [PATCH 030/179] sap_install_media_detect: no longer extract S/4HANA and BW/4HANA export zip files --- roles/sap_install_media_detect/files/tmp/sapfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 7409f9e5c..906070266 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -299,6 +299,10 @@ for _FILE in "$@"; do _EXTRACTION_DIRECTORY="none" _EXTRACT="n" ;; + sap_export_s4hana|sap_export_bw4hana) + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" + ;; sap_export*) ;; *) From ecc84aa9bb4d1c23fe44cc7c770fb70d50cb73f2 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 22:43:23 +0200 Subject: [PATCH 031/179] sap_install_media_detect: also detect SAPCAR in current directory --- .../files/tmp/sapfile | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 906070266..0a5a23bc4 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -131,6 +131,27 @@ elif [[ "${_LSAR_FILE}" == *"unrar"* ]]; then _LSAR_COMMAND="${_LSAR_FILE} lb" fi +# Identify sapcar: Try using sapcar in PATH or SAPCAR*EXE in current directory +if [[ ${_SAPCAR_FILE}. == "sapcar." ]]; then + which sapcar >/dev/null 2>&1 + RC1=$? + if [[ ${RC1} -eq 0 ]]; then + _SAPCAR_FILE=$(which sapcar) + else + _SAPCAR_TEST=$(set -o pipefail && ls -1tr ./SAPCAR*EXE 2>/dev/null | tail -1) + RC2=$? + if [[ ${RC2}. != 0 ]]; then + echo "No file with name SAPCAR*EXE in current directory found." + echo "Note: sapfile needs sapcar in PATH or SAPCAR*EXE in current directory to function properly." + echo + usage + exit 1 + else + _SAPCAR_FILE=${_SAPCAR_TEST} + fi + fi +fi + _GENERIC_FILE_TYPE="other" if [[ ${_DISPLAY_HEADER}. == "y." ]]; then From a3f70dce08fb6e83a1d67106babd26db19417e54 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 22:50:44 +0200 Subject: [PATCH 032/179] sap_install_media_detect: sapfile: fix inner if condition for SAPCAR detection --- roles/sap_install_media_detect/files/tmp/sapfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 0a5a23bc4..63d0d9f65 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -140,7 +140,7 @@ if [[ ${_SAPCAR_FILE}. == "sapcar." ]]; then else _SAPCAR_TEST=$(set -o pipefail && ls -1tr ./SAPCAR*EXE 2>/dev/null | tail -1) RC2=$? - if [[ ${RC2}. != 0 ]]; then + if [[ ${RC2} != 0 ]]; then echo "No file with name SAPCAR*EXE in current directory found." echo "Note: sapfile needs sapcar in PATH or SAPCAR*EXE in current directory to function properly." echo From 92d2edfa775c4970ec36d0729b5dedfeea096edb Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 23:13:27 +0200 Subject: [PATCH 033/179] sap_install_media_detect: sapfile: choose the SAPCAR EXE file which matches the CPU architecture --- .../files/tmp/sapfile | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 63d0d9f65..c52e84dad 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -138,16 +138,35 @@ if [[ ${_SAPCAR_FILE}. == "sapcar." ]]; then if [[ ${RC1} -eq 0 ]]; then _SAPCAR_FILE=$(which sapcar) else - _SAPCAR_TEST=$(set -o pipefail && ls -1tr ./SAPCAR*EXE 2>/dev/null | tail -1) + _SAPCAR_TEST=$(set -o pipefail && ls -1tr ./SAPCAR*EXE 2>/dev/null) RC2=$? if [[ ${RC2} != 0 ]]; then echo "No file with name SAPCAR*EXE in current directory found." - echo "Note: sapfile needs sapcar in PATH or SAPCAR*EXE in current directory to function properly." + echo "Note: sapfile needs sapcar in PATH or SAPCAR*EXE in current directory - matching the system's CPU architecture - to function properly." echo usage exit 1 else - _SAPCAR_FILE=${_SAPCAR_TEST} + _SAPCAR_ARCH=$(for sapcar_any in ${_SAPCAR_TEST}; do + file ${sapcar_any} | awk '{ + split ($0, a, ":"); split (a[2], b, ","); sub ("^ ", "", b[2]); + sub ("x86-64", "x86_64", b[2]); + if (index (b[2], "64-bit PowerPC") > 0) { + if ((index (b[3], "GNU/Linux") > 0)||(index (b[4], "GNU/Linux") > 0)) {sub ("64-bit PowerPC", "ppc64le", b[2])}; + if ((index (b[3], "SYSV") > 0)||(index (b[4], "SYSV") > 0)) {sub ("64-bit PowerPC", "ppc64", b[2])}; + } + sub ("IBM S/390", "s390x", b[2]); + printf ("%s %s %s\n", a[1], b[2], b[3])}'; + done | awk '/'$(uname -m)'/{print $1}' | tail -1) + if [[ ${_SAPCAR_ARCH}. == . ]]; then + echo "No file SAPCAR*EXE for the CPU architecture '$(uname -m)' in current directory found." + echo "Note: sapfile needs sapcar in PATH or SAPCAR*EXE in current directory - matching the system's CPU architecture - to function properly." + echo + usage + exit 1 + else + _SAPCAR_FILE=${_SAPCAR_TEST} + fi fi fi fi From e0cea4a5c15c8ac80f04bed33abcfc8cc941707f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 25 Aug 2023 23:19:42 +0200 Subject: [PATCH 034/179] sap_install_media_detect: sapfile: fix wrong assignment for SAPCAR file name --- roles/sap_install_media_detect/files/tmp/sapfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index c52e84dad..b8a6b5999 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -165,7 +165,7 @@ if [[ ${_SAPCAR_FILE}. == "sapcar." ]]; then usage exit 1 else - _SAPCAR_FILE=${_SAPCAR_TEST} + _SAPCAR_FILE=${_SAPCAR_ARCH} fi fi fi From 482cd6e9201d7f7d35aae1d55f4781874e4c9fa3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 28 Aug 2023 10:08:45 +0200 Subject: [PATCH 035/179] sap_install_media_detect: Initialize more variables --- roles/sap_install_media_detect/tasks/set_global_vars.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index ba3664e7f..9c6f4db7e 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -1,5 +1,10 @@ --- +- name: SAP Install Media Detect - Detection completed - Initialize variables for collecting and displaying all variables + ansible.builtin.set_fact: + __sap_install_media_detect_result: '' + __sap_install_media_detect_vars: '' + - name: SAP Install Media Detect - Detection completed - Set fact for SAPCAR ansible.builtin.set_fact: sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}" From 49cafdfffe273f3e4fd676301501730ec89d5cdf Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 10:24:03 +0200 Subject: [PATCH 036/179] sap_ha_pacemaker_cluster: default host-type is a list, increases compatibility by avoiding conversion --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index c6ba2968d..6594e5e58 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -32,6 +32,10 @@ sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | defaul ################################################################################ # TODO: document the nw parameters + +# Default will be ENSA2. To configure HA resources for ENSA1, enable this parameter: +sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false + sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" @@ -73,7 +77,7 @@ sap_ha_pacemaker_cluster_resource_defaults: # nwas_abap_ascs_ers # nwas_abap_pas_aas # nwas_java_scs_ers (maybe) -sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default('hana_scaleup_perf') }}" +sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" sap_ha_pacemaker_cluster_replication_type: none # Optional parameters to customize HANA resources From 4399c674139ba431d38fe5600427b40914859845 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 12:56:34 +0200 Subject: [PATCH 037/179] sap_ha_pacemaker_cluster: fix: default hacluster pw definition and arg check --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 4 ++++ roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 6594e5e58..fe8a7193a 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -11,8 +11,12 @@ sap_ha_pacemaker_cluster_system_roles_collection: 'fedora.linux_system_roles' # Do NOT USE ANSIBLE FACTS for defaults to be compatible with # playbooks that disable generic fact gathering! +# Inherit from ha_cluster Linux System Role sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" +sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" +# Optional: write all cluster configuration (including credentials!) into a yaml +# config file for review or re-use. sap_ha_pacemaker_cluster_create_config_varfile: false sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 16bac360e..e82816d8a 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -49,7 +49,7 @@ argument_specs: required: false type: str - ha_cluster_hacluster_password: + sap_ha_pacemaker_cluster_hacluster_password: description: - The password of the `hacluster` user which is created during pacemaker installation. no_log: true @@ -289,8 +289,8 @@ argument_specs: sap_hana_instance_number: description: - - The instance number of the SAP HANA database which is role will configure in the cluster. - required: true + - The instance number of the SAP HANA database which this role will configure in the cluster. + required: false type: str sap_hana_sid: From e5a3c5fd8ca7a551c461be5e37050aaad724d0a8 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 12:59:34 +0200 Subject: [PATCH 038/179] sap_ha_pacemaker_cluster: fix: vip constraints obsolete due to group config --- ...construct_vars_netweaver_abap_ascs_ers.yml | 79 +++++++++++-------- ...nstruct_vars_vip_constraints_netweaver.yml | 78 ------------------ .../tasks/include_construct_vip_resources.yml | 13 --- 3 files changed, 44 insertions(+), 126 deletions(-) delete mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index c6bc7eeeb..2cd1812f3 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -9,6 +9,11 @@ # TODO: add conditionals to verify that the same resource agent is not already # defined in user input variables. Conflicting user input should take precedence. +- name: "SAP HA Prepare Pacemaker - Set ERS resource option for ENSA1" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_netweaver_is_ers: true + when: + - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 - name: "SAP HA Prepare Pacemaker - Add filesystem resources for ASCS/ERS to resource definition" ansible.builtin.set_fact: @@ -158,22 +163,22 @@ when: - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) -# Order Constraint: ASCS filesystem should start before instance -- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ASCS filesystem, then ASCS instance" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ascs_fs] }}" - vars: - __constraint_order_ascs_fs: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" - role: started - resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - options: - - name: symmetrical - value: "false" - when: - - __constraint_order_ascs_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) +## Order Constraint: ASCS filesystem should start before instance +#- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ASCS filesystem, then ASCS instance" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ascs_fs] }}" +# vars: +# __constraint_order_ascs_fs: +# resource_first: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" +# role: started +# resource_then: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" +# options: +# - name: symmetrical +# value: "false" +# when: +# - __constraint_order_ascs_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) # ERS instance resource definition - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" @@ -192,7 +197,7 @@ - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" - name: IS_ERS - value: "true" + value: "{{ __sap_ha_pacemaker_cluster_netweaver_is_ers | default() }}" operations: - action: start attrs: @@ -217,22 +222,22 @@ when: - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) -# Order Constraint: ERS filesystem should start before instance -- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ERS filesystem, then ERS instance" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ers_fs] }}" - vars: - __constraint_order_ers_fs: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - role: started - resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - options: - - name: symmetrical - value: "false" - when: - - __constraint_order_ers_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) +## Order Constraint: ERS filesystem should start before instance +#- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ERS filesystem, then ERS instance" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ers_fs] }}" +# vars: +# __constraint_order_ers_fs: +# resource_first: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" +# role: started +# resource_then: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" +# options: +# - name: symmetrical +# value: "false" +# when: +# - __constraint_order_ers_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) ################################################# # Group resources that belong together @@ -292,10 +297,10 @@ vars: __constraint_colo_ers: resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" role: started resource_follower: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" options: - name: score value: -5000 @@ -320,3 +325,7 @@ value: Optional when: - __constraint_order_ascs_ers.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + +# TODO: add ENSA1 location constraint here +# when +# __sap_ha_pacemaker_cluster_is_ers is defined and __sap_ha_pacemaker_cluster_is_ers diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml deleted file mode 100644 index 4a0636797..000000000 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -# Reminder: This file is included in a loop over a dictionary. - -################################################## -# NetWeaver ASCS -################################################## - -# Start the VIP only after the ASCS resource has been started -- name: "SAP HA Prepare Pacemaker - Add order constraint: ASCS VIP starts after NetWeaver ASCS is started" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" - vars: - __constraint_order_vip: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - action: start - resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" - action: start - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms - -# The VIP only runs where the ASCS resource is running -- the VIP in the the group -#- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ASCS is running" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" -# vars: -# __constraint_colo_vip: -# resource_leader: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" -# role: started -# resource_follower: -# id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" -# options: -# - name: score -# value: 2000 -# when: -# - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) -# - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms - -################################################## -# NetWeaver ERS -################################################## - -# Start the VIP only after the ERS resource has been started -- name: "SAP HA Prepare Pacemaker - Add order constraint: ERS VIP starts after NetWeaver ERS is started" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" - vars: - __constraint_order_vip: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - action: start - resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" - action: start - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms - -# The VIP only runs where the ERS resource is running -#- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ERS is running" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" -# vars: -# __constraint_colo_vip: -# resource_leader: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" -# role: started -# resource_follower: -# id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" -# options: -# - name: score -# value: 2000 -# when: -# - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) -# - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index bb768bdd4..2f3bc1569 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -36,16 +36,3 @@ when: - (vip_list_item.value is defined) and (vip_list_item.value != '') - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 - -- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver VIP constraints" - ansible.builtin.include_tasks: - file: construct_vars_vip_constraints_netweaver.yml - loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" - loop_control: - index_var: loop_index - loop_var: vip_list_item - vars: - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - when: - - (vip_list_item.value is defined) and (vip_list_item.value != '') - - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 From 3a88733435ace60becba481c5e8f4584acbc1a41 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 28 Aug 2023 13:31:27 +0200 Subject: [PATCH 039/179] sap_install_media_detect: Handle oracledb_tools separately --- .../tasks/prepare/create_file_list_phase_2.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 9ab30c40c..b3d6b42ac 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -68,7 +68,8 @@ ) or (sap_install_media_detect_db == 'oracledb' and ( item.stdout.split(';')[1] == 'oracledb' or - item.stdout.split(';')[1] == 'oracledb_client') + item.stdout.split(';')[1] == 'oracledb_client' or + item.stdout.split(';')[1] == 'oracledb_tools') ) or (sap_install_media_detect_db == 'ibmdb2' and ( item.stdout.split(';')[1] == 'ibmdb2' or From f479df7261db7ffc486d3e0dd9ea510ca8f54a27 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 28 Aug 2023 14:02:03 +0200 Subject: [PATCH 040/179] sap_install_media_detect: Use the same paths for those anydb vars for which there was contains: in the find module --- .../tasks/set_global_vars.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 9c6f4db7e..3cde0fa4d 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -50,25 +50,32 @@ - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_db == "saphana" +# In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64' but for the role sap_swpm, we need +# to set the path which contains this directory, not the directory itself. - name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: - sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "ibmdb2" +# In 'find_files_after_extraction.yml', we search for a directory name which contains 'LINUX_X86_64' but for the role sap_swpm, we need +# to set the path which contains this directory, not the directory itself. For the Oracle client, we search for a directory name which +# contains 'OCL_LINUX_X86_64' but we also need the path which contains this directory. - name: SAP Install Media Detect - Detection completed - Set facts for Oracle DB ansible.builtin.set_fact: - sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_anydb_install_oracle Ansible Role - sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}" # for sap_anydb_install_oracle Ansible Role + sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "oracledb" +# In 'find_files_after_extraction.yml', we search for a directory which contains 'sybodbc' for the SAP ASE Client, but for the role +# sap_swpm, we need to set the path which contains this directory, not the directory itself. - name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapase" From 368c07a9479c0f4e7d9e604076ecb589725a6ff3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 19:47:15 +0200 Subject: [PATCH 041/179] sap_ha_pacemaker_cluster: fix: stonith disabled when no resource defined --- .../tasks/construct_vars_stonith.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index 0c87c43bf..deeed69a9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -2,20 +2,20 @@ # The following variables are constructed here in order to be provided as # input for the included 'ha_cluster' system role. + +# Block for disabling stonith when no stonith resource definition is found - name: "SAP HA Prepare Pacemaker - Block when no STONITH resource is defined" when: - sap_ha_pacemaker_cluster_stonith_default is not defined or sap_ha_pacemaker_cluster_stonith_default | length == 0 - - sap_ha_pacemaker_cluster_stonith_custom is not defined + or sap_ha_pacemaker_cluster_stonith_custom is not defined or sap_ha_pacemaker_cluster_stonith_custom | length == 0 block: - name: "SAP HA Prepare Pacemaker - Set STONITH to disabled when no fencing resource is defined" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_properties: - - attrs: - - name: stonith-enabled - value: false + sap_ha_pacemaker_cluster_cluster_properties: + "{{ sap_ha_pacemaker_cluster_cluster_properties | combine({ 'stonith-enabled': false }) }}" - name: "SAP HA Prepare Pacemaker - Warn that there is no STONITH configured" ansible.builtin.pause: @@ -27,7 +27,9 @@ Recommendation: Add a STONITH resource and set cluster property "stonith-enabled=true" before using this cluster for production services. -# END of block + +# END of block for disabling stonith + - name: "SAP HA Prepare Pacemaker - Define cluster stonith properties" when: From 5adfa13a068c2b54e0d590223f4849bf13181e9e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 19:50:02 +0200 Subject: [PATCH 042/179] sap_ha_pacemaker_cluster: enh: resource defaults handling and optionally manage shared filesystems --- .../tasks/construct_vars_hana_common.yml | 9 ++ ...construct_vars_netweaver_abap_ascs_ers.yml | 97 ++++++++++--------- .../tasks/construct_vars_netweaver_common.yml | 15 ++- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 9 +- 4 files changed, 78 insertions(+), 52 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index 06def49c8..b884af055 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -9,6 +9,15 @@ # TODO: add conditionals to verify that the same resource agent is not already # defined in user input variables. Conflicting user input should take precedence. +- name: "SAP HA Prepare Pacemaker - Define resource defaults for HANA clusters" + when: + - sap_ha_pacemaker_cluster_resource_defaults is not defined + or sap_ha_pacemaker_cluster_resource_defaults | length == 0 + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_defaults: + resource-stickiness: 1000 + migration-threshold: 5000 + - name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA Topology" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana_topology] }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 2cd1812f3..8ed856aab 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -2,19 +2,9 @@ # Variables containing variables must be constructed with values # to be fed into the included ha_cluster role -# - put here all scale-up and scale-out common resources -# - certain differences like ra agent names are provided through -# type specific variables - # TODO: add conditionals to verify that the same resource agent is not already # defined in user input variables. Conflicting user input should take precedence. -- name: "SAP HA Prepare Pacemaker - Set ERS resource option for ENSA1" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_netweaver_is_ers: true - when: - - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 - - name: "SAP HA Prepare Pacemaker - Add filesystem resources for ASCS/ERS to resource definition" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" @@ -163,22 +153,6 @@ when: - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) -## Order Constraint: ASCS filesystem should start before instance -#- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ASCS filesystem, then ASCS instance" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ascs_fs] }}" -# vars: -# __constraint_order_ascs_fs: -# resource_first: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" -# role: started -# resource_then: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" -# options: -# - name: symmetrical -# value: "false" -# when: -# - __constraint_order_ascs_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) # ERS instance resource definition - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" @@ -197,7 +171,7 @@ - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" - name: IS_ERS - value: "{{ __sap_ha_pacemaker_cluster_netweaver_is_ers | default() }}" + value: true operations: - action: start attrs: @@ -222,22 +196,6 @@ when: - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) -## Order Constraint: ERS filesystem should start before instance -#- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ERS filesystem, then ERS instance" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ers_fs] }}" -# vars: -# __constraint_order_ers_fs: -# resource_first: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" -# role: started -# resource_then: -# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" -# options: -# - name: symmetrical -# value: "false" -# when: -# - __constraint_order_ers_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) ################################################# # Group resources that belong together @@ -249,6 +207,7 @@ # - ASCS VIP # The order of the resources in the group define the order in which they are # started - resources are stopped in reverse order. + - name: "SAP HA Prepare Pacemaker - Add resource group for ASCS resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ascs_group] }}" @@ -272,6 +231,7 @@ # - ERS VIP # The order of the resources in the group define the order in which they are # started - resources are stopped in reverse order. + - name: "SAP HA Prepare Pacemaker - Add resource group for ERS resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ers_group] }}" @@ -287,7 +247,7 @@ ################################################# -# Constraints between the groups +# Constraints ################################################# # ERS and ASCS resource groups should try to avoid running on the same node @@ -326,6 +286,49 @@ when: - __constraint_order_ascs_ers.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) -# TODO: add ENSA1 location constraint here -# when -# __sap_ha_pacemaker_cluster_is_ers is defined and __sap_ha_pacemaker_cluster_is_ers +# ENSA1 only: location rule for ASCS to follow ERS +- name: "SAP HA Prepare Pacemaker - Add location constraint: ASCS follows ERS in ENSA1 setup" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location + [__constraint_location_ascs_ers] }}" + vars: + __constraint_location_ascs_ers: + resource: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ascs{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + rule: "runs_ers_{{ sap_ha_pacemaker_cluster_netweaver_sid }} eq 1" + options: + - name: score + value: 2000 + when: + - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 is defined + - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + + +# When /sapmnt is managed by the cluster, +# start instance groups only after the SAPMNT resource is running. +- name: "SAP HA Prepare Pacemaker - Add order constraint: first start /sapmnt, then start ASCS group" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_sapmnt_order: "{{ __sap_ha_pacemaker_cluster_constraints_sapmnt_order + [__constraint_order_sapmnt] }}" + vars: + __constraint_order_sapmnt: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" + role: started + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + when: + - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - __constraint_order_sapmnt.resource_then not in (__sap_ha_pacemaker_cluster_constraints_sapmnt_order | map(attribute='resource_then')) + +- name: "SAP HA Prepare Pacemaker - Add order constraint: first start /sapmnt, then start ERS group" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_sapmnt_order: "{{ __sap_ha_pacemaker_cluster_constraints_sapmnt_order + [__constraint_order_sapmnt] }}" + vars: + __constraint_order_sapmnt: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" + role: started + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + when: + - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - __constraint_order_sapmnt.resource_then not in (__sap_ha_pacemaker_cluster_constraints_sapmnt_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index 8bbf804a1..e96bb24e5 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -3,12 +3,19 @@ # to be fed into the included ha_cluster role # - put here all NetWeaver common resources -# - certain differences like ra agent names are provided through -# type specific variables # TODO: add conditionals to verify that the same resource agent is not already # defined in user input variables. Conflicting user input should take precedence. +- name: "SAP HA Prepare Pacemaker - Define resource defaults for NetWeaver clusters" + when: + - sap_ha_pacemaker_cluster_resource_defaults is not defined + or sap_ha_pacemaker_cluster_resource_defaults | length == 0 + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_defaults: + resource-stickiness: 1 + migration-threshold: 3 + - name: "SAP HA Prepare Pacemaker - Add NetWeaver common filesystem resources to resource definition" ansible.builtin.set_fact: @@ -80,12 +87,15 @@ loop_var: commonfs_item label: "{{ commonfs_item.name }}" when: + - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed - commonfs_item.mountpoint is defined - commonfs_item.nfs_path is defined - "'/usr/sap' in commonfs_item.mountpoint or '/sapmnt' in commonfs_item.mountpoint" - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) +# End of shared filesystems resource definition task + # The shared/common filesystems are clones. - name: "SAP HA Prepare Pacemaker - Add resource clones for NetWeaver common shared filesystems" @@ -119,6 +129,7 @@ loop_var: commonfsclone_item label: "{{ commonfsclone_item.name }}" when: + - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed - commonfsclone_item.mountpoint is defined - commonfsclone_item.nfs_path is defined - "'/usr/sap' in commonfsclone_item.mountpoint diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index d7615ae2c..1257e91cd 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -182,8 +182,9 @@ ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" tags: ha_cluster - # Resource defaults can currently not be updated through ha_cluster - # role parameters, and thus need to be added. + # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) + # https://github.com/linux-system-roles/ha_cluster#ha_cluster_resource_defaults + # Keeping separate for compatibility with older versions of the ha_cluster role. - name: "SAP HA Install Pacemaker - Check resource defaults" ansible.builtin.command: cmd: | @@ -196,10 +197,12 @@ - name: "SAP HA Install Pacemaker - Update resource default attributes" when: - item.key ~ '=' ~ item.value not in __sap_ha_pacemaker_cluster_check_resource_defaults.stdout + - __sap_ha_pacemaker_cluster_resource_defaults is defined + - __sap_ha_pacemaker_cluster_resource_defaults | length > 0 ansible.builtin.command: cmd: | pcs resource defaults update {{ item.key }}={{ item.value }} - loop: "{{ sap_ha_pacemaker_cluster_resource_defaults | dict2items }}" + loop: "{{ __sap_ha_pacemaker_cluster_resource_defaults | dict2items }}" loop_control: label: "{{ item.key }}={{ item.value }}" run_once: true From 7ff2677a193807f961555281ea02b12a1e5437a8 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 28 Aug 2023 19:50:29 +0200 Subject: [PATCH 043/179] sap_install_media_detect: Allow the presence of more than one DB dependent file during phase 2 --- .../tasks/prepare/create_file_list_phase_2.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index b3d6b42ac..ba4b1b47a 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -131,46 +131,46 @@ ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length <= 1 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "More than one DB dependent SAP Kernel file for SAP HANA found" when: - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_db == 'saphana' - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP ASE is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length <= 1 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "More than one DB dependent SAP Kernel file for SAP ASE found" when: - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_db == 'sapase' - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP MAXDB is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length <= 1 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "More than one DB dependent SAP Kernel file for SAP MAXDB found" when: - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_db == 'sapmaxdb' - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for Oracle DB is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length <= 1 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "More than one DB dependent SAP Kernel file for Oracle DB found" when: - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_db == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for IBM Db2 is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length <= 1 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "More than one DB dependent SAP Kernel file for IBM Db2 found" when: - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_db == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert SAP Host Agent is present ansible.builtin.assert: From f08af3ea0b5c9d24e645ea2e2cf3b9996b9603d5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 19:50:02 +0200 Subject: [PATCH 044/179] sap_ha_pacemaker_cluster: fix: stonith disable conditionals --- .../defaults/main.yml | 11 +++--- .../tasks/construct_vars_stonith.yml | 34 +++++++++++++++---- .../vars/platform_cloud_aws_ec2_vs.yml | 6 +--- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index fe8a7193a..68ad24a6b 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -28,7 +28,7 @@ sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | de # TODO: document filesystem definitions sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs -sap_ha_pacemaker_cluster_storage_nfs_mount_options: '' +sap_ha_pacemaker_cluster_storage_nfs_mount_options: 'defaults' sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" ################################################################################ @@ -66,10 +66,8 @@ sap_ha_pacemaker_cluster_fence_agent_packages: sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" -# Adjusting resource defaults -sap_ha_pacemaker_cluster_resource_defaults: - resource-stickiness: 1000 - migration-threshold: 5000 +## Resource defaults are defined differently by cluster type, if not custom defined. +sap_ha_pacemaker_cluster_resource_defaults: {} # The type of SAP landscape and multi-node replication # TODO: Type definitions and feature support @@ -121,6 +119,9 @@ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +# Enable to manage the SYS, transport and sapmnt filesystems in the cluster +sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false + # TODO: document parameters ################################################################################ diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index deeed69a9..9859b979a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -2,14 +2,36 @@ # The following variables are constructed here in order to be provided as # input for the included 'ha_cluster' system role. - -# Block for disabling stonith when no stonith resource definition is found +### Block for disabling stonith when no stonith resource definition is found +# +# This block is entered when +# - no default stonith resource is defined and no custom is defined either +# - an empty custom is defined to override any default (defined or not) - name: "SAP HA Prepare Pacemaker - Block when no STONITH resource is defined" when: - - sap_ha_pacemaker_cluster_stonith_default is not defined - or sap_ha_pacemaker_cluster_stonith_default | length == 0 - or sap_ha_pacemaker_cluster_stonith_custom is not defined - or sap_ha_pacemaker_cluster_stonith_custom | length == 0 + - ( + sap_ha_pacemaker_cluster_stonith_custom is defined + and + ( + sap_ha_pacemaker_cluster_stonith_custom == '' + or sap_ha_pacemaker_cluster_stonith_custom | length == 0 + ) + ) + or + ( + sap_ha_pacemaker_cluster_stonith_custom is not defined + and sap_ha_pacemaker_cluster_stonith_default is defined + and + ( + sap_ha_pacemaker_cluster_stonith_default == '' + or sap_ha_pacemaker_cluster_stonith_default | length == 0 + ) + ) + or + ( + sap_ha_pacemaker_cluster_stonith_custom is not defined + and sap_ha_pacemaker_cluster_stonith_default is not defined + ) block: - name: "SAP HA Prepare Pacemaker - Set STONITH to disabled when no fencing resource is defined" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index e4b555b9b..e448ba638 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -18,14 +18,10 @@ __sap_ha_pacemaker_cluster_aws_instances: [] # When aws credentials and region are not defined it will # default to using the aws cli configuration. -# aws cli is configured by default for the VIP resource. +# aws cli is configured anyway for the standard AWS VIP resource. sap_ha_pacemaker_cluster_stonith_default: id: "res_fence_aws" agent: "stonith:fence_aws" -# options: -# access_key: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}" -# secret_key: "{{ sap_ha_pacemaker_cluster_aws_secret_access_key }}" -# region: "{{ sap_ha_pacemaker_cluster_aws_region }}" # Platform specific VIP handling sap_ha_pacemaker_cluster_vip_method: aws_vpc_move_ip From b4a3c8060dac40037db23232f4c53e919435e67e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 28 Aug 2023 21:05:11 +0200 Subject: [PATCH 045/179] sap_ha_pacemaker_cluster: fix: variables adjusted for consistency --- roles/sap_ha_pacemaker_cluster/README.md | 64 +++++++++---------- .../meta/argument_specs.yml | 3 +- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index fa336e05c..be9a157db 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -133,8 +133,7 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions Minimum required parameters: -- [ha_cluster_hacluster_password](#ha_cluster_hacluster_password) -- [sap_hana_instance_number](#sap_hana_instance_number) +- [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) ### ha_cluster @@ -155,19 +154,6 @@ ha_cluster: node_name: nodeA ``` -### ha_cluster_cluster_name - -- _Type:_ `str` -- _Default:_ `my-cluster` - -The name of the pacemaker cluster.
- -### ha_cluster_hacluster_password required - -- _Type:_ `str` - -The password of the `hacluster` user which is created during pacemaker installation.
- ### sap_ha_pacemaker_cluster_aws_access_key_id - _Type:_ `str` @@ -189,6 +175,29 @@ Required for cluster nodes setup on Amazon cloud.
AWS secret key, paired with the access key for instance control.
Required for cluster nodes setup on Amazon cloud.
+### sap_ha_pacemaker_cluster_aws_vip_client_interface + +- _Type:_ `str` +- _Default:_ `eth0` + +OS device name of the network interface to use for the Virtual IP configuration.
+This is needed for `aws_vpc_move_ip` resources in AWS EC2 environments.
+ +### sap_ha_pacemaker_cluster_aws_vip_update_rt + +- _Type:_ `list` + +List one more routing table IDs for managing Virtual IP failover through routing table changes.
+Required for VIP configuration in AWS EC2 environments.
+ +### sap_ha_pacemaker_cluster_cluster_name + +- _Type:_ `str` +- _Default:_ `my-cluster` + +The name of the pacemaker cluster.
+Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined.
+ ### sap_ha_pacemaker_cluster_cluster_properties - _Type:_ `dict` @@ -243,6 +252,12 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ``` +### sap_ha_pacemaker_cluster_hacluster_password required + +- _Type:_ `str` + +The password of the `hacluster` user which is created during pacemaker installation.
+ ### sap_ha_pacemaker_cluster_hana_automated_register - _Type:_ `bool` @@ -321,14 +336,6 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` -### sap_ha_pacemaker_cluster_vip_client_interface - -- _Type:_ `str` -- _Default:_ `eth0` - -OS device name of the network interface to use for the Virtual IP configuration.
-This is used for VIP agents that require an interface name, for example in cloud platform environments.
- ### sap_ha_pacemaker_cluster_vip_resource_name - _Type:_ `str` @@ -336,13 +343,6 @@ This is used for VIP agents that require an interface name, for example in cloud Customize the name of the resource managing the Virtual IP.
-### sap_ha_pacemaker_cluster_vip_update_rt - -- _Type:_ `list` - -List one more routing table IDs for managing Virtual IP failover through routing table changes.
-Required for VIP configuration in AWS EC2 environments.
- ### sap_hana_cluster_nodes - _Type:_ `list` @@ -373,11 +373,11 @@ sap_hana_cluster_nodes: node_role: secondary ``` -### sap_hana_instance_number required +### sap_hana_instance_number - _Type:_ `str` -The instance number of the SAP HANA database which is role will configure in the cluster.
+The instance number of the SAP HANA database which this role will configure in the cluster.
### sap_hana_sid diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index e82816d8a..761a5c111 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -42,10 +42,11 @@ argument_specs: required: false type: dict - ha_cluster_cluster_name: + sap_ha_pacemaker_cluster_cluster_name: default: my-cluster description: - The name of the pacemaker cluster. + - Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined. required: false type: str From 5d6a7aa45bb6b52e065c01edefb41414d0e631a9 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 29 Aug 2023 00:16:23 +0200 Subject: [PATCH 046/179] sap_install_media_detect: Allow the presence of more than one DB dependent file during all processing --- .../defaults/main.yml | 4 +- .../tasks/find_files_after_extraction.yml | 127 +++++++++++++-- .../prepare/create_file_list_phase_2.yml | 150 +++++++++--------- .../tasks/set_global_vars.yml | 40 +++-- 4 files changed, 221 insertions(+), 100 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 4a866db28..7a118b4fd 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -66,13 +66,15 @@ sap_install_media_detect_move_or_copy_archives: true #sap_install_media_detect_assert_after_sapfile: false # saphana, sapase, sapmaxdb, oracledb, ibmdb2 -#sap_install_media_detect_db: "saphana" +#sap_install_media_detect_db: 'saphana' sap_install_media_detect_db: '' sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true sap_install_media_detect_igs: true sap_install_media_detect_kernel: true +# saphana, sapase, sapmaxdb, oracledb, ibmdb2 +#sap_install_media_detect_kernel_db: 'sapmaxdb' sap_install_media_detect_webdisp: false # saps4hana, sapbw4hana, sapecc, sapecc_ides, sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 1b5ac56dc..04e0b86f5 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -1,5 +1,9 @@ --- +- name: SAP Install Media Detect - Find files after extraction - Initialize fact variables + ansible.builtin.set_fact: + __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results: [] + - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter set ansible.builtin.set_fact: sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for setting consecutive vars @@ -116,20 +120,117 @@ - sap_install_media_detect_kernel - sap_swpm_kernel_independent_file_name_get.stdout_lines | count > 1 -- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB - ansible.builtin.shell: ls SAPEXEDB_*.SAR - args: - chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_dependent_file_name_get - changed_when: false - when: sap_install_media_detect_kernel +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, unspecific + when: sap_install_media_detect_kernel_db is not defined + block: -- name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB found - ansible.builtin.fail: - msg: "More than one SAPEXEDB file has been detected." - when: - - sap_install_media_detect_kernel - - sap_swpm_kernel_dependent_file_name_get.stdout_lines | count > 1 + - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB + ansible.builtin.shell: ls SAPEXEDB_*.SAR + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_kernel_dependent_file_name_get + changed_when: false + when: sap_install_media_detect_kernel + + - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found + ansible.builtin.fail: + msg: "No, or more than one, SAPEXEDB file has been detected." + when: + - sap_install_media_detect_kernel + - sap_swpm_kernel_dependent_file_name_get.stdout_lines | count != 1 + +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific + when: sap_install_media_detect_kernel_db is defined + block: + + - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB + ansible.builtin.shell: "{{ __sap_install_media_detect_sapfile_path }} -e --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} SAPEXEDB_*.SAR" + args: + chdir: "{{ sap_swpm_software_path }}" + register: __sap_install_media_detect_register_db_dependent_kernel_files + changed_when: false + when: + - sap_install_media_detect_kernel + - sap_install_media_detect_kernel_db is defined + + - name: SAP Install Media Detect - Find files after extraction - Set fact with the results of the sapfile command + ansible.builtin.set_fact: + __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results: "{{ __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results + [__new_dict] }}" + loop: "{{ __sap_install_media_detect_register_db_dependent_kernel_files.stdout_lines }}" + vars: + __new_dict: + file: "{{ item.split(';')[0] }}" + sap_file_type: "{{ item.split(';')[1] }}" + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for SAP HANA is present + ansible.builtin.fail: + msg: "No, or more than one, DB dependent SAP Kernel file for SAP HANA found" + when: + - sap_install_media_detect_kernel_db == 'saphana' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length != 1 + + - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP HANA + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | first).file }}" + when: + - sap_install_media_detect_kernel_db == 'saphana' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length == 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for SAP ASE is present + ansible.builtin.fail: + msg: "No, or more than one, DB dependent SAP Kernel file for SAP ASE found" + when: + - sap_install_media_detect_kernel_db == 'sapase' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length != 1 + + - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP ASE + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | first).file }}" + when: + - sap_install_media_detect_kernel_db == 'sapase' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length == 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for SAP MAXDB is present + ansible.builtin.fail: + msg: "No, or more than one, DB dependent SAP Kernel file for SAP MAXDB found" + when: + - sap_install_media_detect_kernel_db == 'sapmaxdb' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length != 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for SAP MAXDB is present + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}" + when: + - sap_install_media_detect_kernel_db == 'sapmaxdb' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length == 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for Oracle DB is present + ansible.builtin.fail: + msg: "No, or more than one, DB dependent SAP Kernel file for Oracle DB found" + when: + - sap_install_media_detect_kernel_db == 'oracledb' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length != 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for Oracle DB is present + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}" + when: + - sap_install_media_detect_kernel_db == 'oracledb' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length == 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for IBM Db2 is present + ansible.builtin.fail: + msg: "No, or more than one, DB dependent SAP Kernel file for IBM Db2 found" + when: + - sap_install_media_detect_kernel_db == 'ibmdb2' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length != 1 + + - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for IBM Db2 is present + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}" + when: + - sap_install_media_detect_kernel_db == 'ibmdb2' + - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length == 1 - name: SAP Install Media Detect - Find files after extraction - Find IGS, latest version ansible.builtin.shell: set -o pipefail && ls -1tr igsexe*.sar | tail -1 diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index ba4b1b47a..a42df58e3 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -23,7 +23,7 @@ loop: "{{ __sap_install_media_detect_register_find_result_phase_2.files }}" - name: SAP Install Media Detect - Prepare - Iterate over files and determine file type - ansible.builtin.shell: set -o pipefail && {{ __sap_install_media_detect_sapfile_path }} -le --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} {{ line_item }} + ansible.builtin.command: "{{ __sap_install_media_detect_sapfile_path }} -e --lsar_file={{ __sap_install_media_detect_rar_list.split(' ')[0] }} --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} {{ line_item }}" register: __sap_install_media_detect_register_files_phase_2 loop: "{{ __sap_install_media_detect_fact_find_result_phase_2 }}" loop_control: @@ -36,8 +36,6 @@ loop: "{{ __sap_install_media_detect_register_files_phase_2.results }}" vars: __new_dict: -# dir: "{{ item.line_item | dirname }}" -# file: "{{ item.line_item | basename }}" dir: "{{ item.stdout.split(';')[0] | dirname }}" file: "{{ item.stdout.split(';')[0] | basename }}" sap_file_type: "{{ item.stdout.split(';')[1] }}" @@ -95,13 +93,13 @@ when: - sap_install_media_detect_assert_after_sapfile | d(true) block: - - name: SAP Install Media Detect - Prepare - Assert sapcar is present + - name: SAP Install Media Detect - Prepare - Assert that sapcar is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapcar') | length > 0 fail_msg: "No sapcar file found" - - name: SAP Install Media Detect - Prepare - Assert swpm is present + - name: SAP Install Media Detect - Prepare - Assert that swpm is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_swpm') | length > 0 @@ -109,7 +107,7 @@ when: - sap_install_media_detect_swpm | d(false) - - name: SAP Install Media Detect - Prepare - Assert exactly one SAP Kernel DB independent is present + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB independent is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 @@ -118,61 +116,61 @@ when: - sap_install_media_detect_kernel | d(false) - - name: SAP Install Media Detect - Prepare - Assert at least one SAP Kernel DB dependent is present + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_') | length > 0 - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "No, or more than one, DB dependent SAP Kernel file found" when: - sap_install_media_detect_kernel | d(false) - - - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP HANA is present - ansible.builtin.assert: - that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length <= 1 - fail_msg: "More than one DB dependent SAP Kernel file for SAP HANA found" - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_db == 'saphana' - - - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP ASE is present - ansible.builtin.assert: - that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length <= 1 - fail_msg: "More than one DB dependent SAP Kernel file for SAP ASE found" - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_db == 'sapase' - - - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for SAP MAXDB is present - ansible.builtin.assert: - that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length <= 1 - fail_msg: "More than one DB dependent SAP Kernel file for SAP MAXDB found" - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_db == 'sapmaxdb' - - - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for Oracle DB is present - ansible.builtin.assert: - that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length <= 1 - fail_msg: "More than one DB dependent SAP Kernel file for Oracle DB found" - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_db == 'oracledb' - - - name: SAP Install Media Detect - Prepare - Assert not more than one SAP Kernel DB dependent for IBM Db2 is present - ansible.builtin.assert: - that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length <= 1 - fail_msg: "More than one DB dependent SAP Kernel file for IBM Db2 found" - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_db == 'ibmdb2' - - - name: SAP Install Media Detect - Prepare - Assert SAP Host Agent is present + - sap_install_media_detect_kernel_db is not defined + + - name: SAP Install Media Detect - Prepare - Assert that exactly one matching SAP Kernel DB dependent is present + when: sap_install_media_detect_kernel_db is defined + block: + + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent for SAP HANA is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file for SAP HANA found" + when: + - sap_install_media_detect_kernel_db == 'saphana' + + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent for SAP ASE is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file for SAP ASE found" + when: + - sap_install_media_detect_kernel_db == 'sapase' + + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent for SAP MAXDB is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file for SAP MAXDB found" + when: + - sap_install_media_detect_kernel_db == 'sapmaxdb' + + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent for Oracle DB is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file for Oracle DB found" + when: + - sap_install_media_detect_kernel_db == 'oracledb' + + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent for IBM Db2 is present + ansible.builtin.assert: + that: + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length == 1 + fail_msg: "No, or more than one, DB dependent SAP Kernel file for IBM Db2 found" + when: + - sap_install_media_detect_kernel_db == 'ibmdb2' + + - name: SAP Install Media Detect - Prepare - Assert that SAP Host Agent is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_hostagent') | length > 0 @@ -180,7 +178,7 @@ when: - sap_install_media_detect_hostagent | d(false) - - name: SAP Install Media Detect - Prepare - Assert igsexe is present + - name: SAP Install Media Detect - Prepare - Assert that igsexe is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 @@ -189,7 +187,7 @@ when: - sap_install_media_detect_igs | d(false) - - name: SAP Install Media Detect - Prepare - Assert igshelper is present + - name: SAP Install Media Detect - Prepare - Assert that igshelper is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 @@ -198,7 +196,7 @@ when: - sap_install_media_detect_igs | d(false) - - name: SAP Install Media Detect - Prepare - Assert exactly one SAP WEBDISP is present + - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP WEBDISP is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_webdisp') | length > 0 @@ -207,7 +205,7 @@ when: - sap_install_media_detect_webdisp | d(false) - - name: SAP Install Media Detect - Prepare - Assert saphana is present + - name: SAP Install Media Detect - Prepare - Assert that saphana is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana') | length > 0 @@ -215,7 +213,7 @@ when: - (sap_install_media_detect_db | d('')) == 'saphana' - - name: SAP Install Media Detect - Prepare - Assert saphana_client is present + - name: SAP Install Media Detect - Prepare - Assert that saphana_client is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana_client') | length > 0 @@ -223,7 +221,7 @@ when: - (sap_install_media_detect_db | d('')) == 'saphana' - - name: SAP Install Media Detect - Prepare - Assert sapase is present + - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase') | length > 0 @@ -231,7 +229,7 @@ when: - (sap_install_media_detect_db | d('')) == 'sapase' - - name: SAP Install Media Detect - Prepare - Assert sapase_client is present + - name: SAP Install Media Detect - Prepare - Assert that sapase_client is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase_client') | length > 0 @@ -239,7 +237,7 @@ when: - (sap_install_media_detect_db | d('')) == 'sapase' - - name: SAP Install Media Detect - Prepare - Assert sapmaxdb is present + - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapmaxdb') | length > 0 @@ -247,7 +245,7 @@ when: - (sap_install_media_detect_db | d('')) == 'sapmaxdb' - - name: SAP Install Media Detect - Prepare - Assert oracledb is present + - name: SAP Install Media Detect - Prepare - Assert that oracledb is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb') | length > 0 @@ -255,7 +253,7 @@ when: - (sap_install_media_detect_db | d('')) == 'oracledb' - - name: SAP Install Media Detect - Prepare - Assert oracledb_client is present + - name: SAP Install Media Detect - Prepare - Assert that oracledb_client is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb_client') | length > 0 @@ -263,7 +261,7 @@ when: - (sap_install_media_detect_db | d('')) == 'oracledb' - - name: SAP Install Media Detect - Prepare - Assert ibmdb2 is present + - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2') | length > 0 @@ -271,7 +269,7 @@ when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' - - name: SAP Install Media Detect - Prepare - Assert ibmdb2_client is present + - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_client is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_client') | length > 0 @@ -279,7 +277,7 @@ when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' - - name: SAP Install Media Detect - Prepare - Assert ibmdb2_license is present + - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_license') | length > 0 @@ -287,7 +285,7 @@ when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' - - name: SAP Install Media Detect - Prepare - Assert sap_export_s4hana is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_s4hana is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_s4hana') | length > 0 @@ -295,7 +293,7 @@ when: - (sap_install_media_detect_export | d('')) == 'saps4hana' - - name: SAP Install Media Detect - Prepare - Assert sap_export_bw4hana is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_bw4hana is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_bw4hana') | length > 0 @@ -303,7 +301,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapbw4hana' - - name: SAP Install Media Detect - Prepare - Assert sap_export_ecc is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc') | length > 0 @@ -311,7 +309,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapecc' - - name: SAP Install Media Detect - Prepare - Assert sap_export_ecc_ides is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc_ides is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc_ides') | length > 0 @@ -319,7 +317,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapecc_ides' - - name: SAP Install Media Detect - Prepare - Assert sap_export_nwas_abap is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_abap is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_abap') | length > 0 @@ -327,7 +325,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapnwas_abap' - - name: SAP Install Media Detect - Prepare - Assert sap_export_nwas_java is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_java is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_java') | length > 0 @@ -335,7 +333,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapnwas_java' - - name: SAP Install Media Detect - Prepare - Assert sap_export_solman_abap is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_abap is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_abap') | length > 0 @@ -343,7 +341,7 @@ when: - (sap_install_media_detect_export | d('')) == 'sapsolman_abap' - - name: SAP Install Media Detect - Prepare - Assert sap_export_solman_java is present + - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_java is present ansible.builtin.assert: that: - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_java') | length > 0 diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 3cde0fa4d..073449c89 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -10,17 +10,28 @@ sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}" sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" -- name: SAP Install Media Detect - Detection completed - Set fact for SWPM +- name: SAP Install Media Detect - Detection completed - Set fact for SWPM, move_or_copy_archives parameter set ansible.builtin.set_fact: # sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # set in find_files_after_extraction.yml # sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for sap_swpm Ansible Role sap_swpm_install_directory: "{{ sap_swpm_software_path }}" -# sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role - sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role + sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role # sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role # sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_swpm + when: + - sap_install_media_detect_move_or_copy_archives + - sap_install_media_detect_swpm + +- name: SAP Install Media Detect - Detection completed - Set fact for SWPM, move_or_copy_archives parameter not set + ansible.builtin.set_fact: +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}" # for sap_swpm Ansible Role + sap_swpm_install_directory: "{{ sap_swpm_software_path }}" + sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role + when: + - not sap_install_media_detect_move_or_copy_archives + - sap_install_media_detect_swpm - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter set ansible.builtin.set_fact: @@ -85,18 +96,27 @@ ignore_errors: true when: sap_install_media_detect_db == "sapmaxdb" -- name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB - ansible.builtin.set_fact: - sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" - sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" - when: sap_install_media_detect_kernel - - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXE ansible.builtin.set_fact: sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" when: sap_install_media_detect_kernel +- name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, unspecific + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" + when: + - sap_install_media_detect_kernel_db is not defined + - sap_install_media_detect_kernel + +- name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, specific + ansible.builtin.set_fact: + sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get }}" + when: + - sap_install_media_detect_kernel_db is defined + - name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS ansible.builtin.set_fact: sap_swpm_igs_path: "{{ sap_swpm_software_path }}" From fe4de286683de002462c9c17698fbf92511637aa Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 29 Aug 2023 01:25:02 +0200 Subject: [PATCH 047/179] sap_install_media_detect: set sap_swpm_cd_export_path one level higher for SAP ECC Export --- roles/sap_install_media_detect/tasks/set_global_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 073449c89..c9d3e4e2b 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -138,7 +138,7 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc" From 4f85af6f3a37cf2ce2b324d0f93fd38d12394f73 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 29 Aug 2023 11:48:08 +0200 Subject: [PATCH 048/179] sap_ha_pacemaker_cluster: enh: optional sapmnt and ensa1 handling --- ...construct_vars_netweaver_abap_ascs_ers.yml | 99 ++++++++++++++----- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 1 + 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 8ed856aab..5913ad60d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -5,6 +5,62 @@ # TODO: add conditionals to verify that the same resource agent is not already # defined in user input variables. Conflicting user input should take precedence. +# Several parameters are pre-defined from potentially inherited ha_cluster LSR definitions. +# They are necessary to be used for combining all cluster setup definitions. +# +# See tasks/ascertain_ha_cluster_in_inventory.yml: +# +# __sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" +# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" +# __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" +# __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" +# __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" +# __sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" +# __sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" +# __sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" +# __sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" + + +### Different SAPInstance resource attributes for ENSA1 and ENSA2 +- name: "SAP HA Prepare Pacemaker - Define default ASCS/ERS instance attributes (ENSA2)" + when: not sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs: + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" + + __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + + +- name: "SAP HA Prepare Pacemaker - Define ASCS/ERS instance attributes (ENSA1)" + when: sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs: + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout }}" + + __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + - name: IS_ERS + value: true + + +### ASCS/ERS instance filesystems - name: "SAP HA Prepare Pacemaker - Add filesystem resources for ASCS/ERS to resource definition" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" @@ -122,13 +178,7 @@ - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool | string }}" meta_attrs: - - attrs: - - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" - - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_migration_threshold }}" - - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_failure_timeout }}" + - attrs: "{{ __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs }}" operations: - action: start attrs: @@ -163,15 +213,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - - attrs: - - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" - - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" - - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" - - name: IS_ERS - value: true + - attrs: "{{ __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs }}" operations: - action: start attrs: @@ -250,6 +292,14 @@ # Constraints ################################################# +# Constraint parameters are pre-defined from potentially inherited ha_cluster LSR definitions. +# Constraint definitions are combined into these parameters. +# See tasks/ascertain_ha_cluster_in_inventory.yml: +# +# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" +# __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" +# __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" + # ERS and ASCS resource groups should try to avoid running on the same node - name: "SAP HA Prepare Pacemaker - Add colocation constraint: ERS avoids to run on the ASCS node" ansible.builtin.set_fact: @@ -283,8 +333,8 @@ value: "false" - name: kind value: Optional - when: - - __constraint_order_ascs_ers.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) +# when: +# - __constraint_order_ascs_ers.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) # ENSA1 only: location rule for ASCS to follow ERS - name: "SAP HA Prepare Pacemaker - Add location constraint: ASCS follows ERS in ENSA1 setup" @@ -293,13 +343,12 @@ vars: __constraint_location_ascs_ers: resource: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ascs{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" rule: "runs_ers_{{ sap_ha_pacemaker_cluster_netweaver_sid }} eq 1" options: - name: score value: 2000 when: - - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 is defined - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 @@ -307,28 +356,26 @@ # start instance groups only after the SAPMNT resource is running. - name: "SAP HA Prepare Pacemaker - Add order constraint: first start /sapmnt, then start ASCS group" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_sapmnt_order: "{{ __sap_ha_pacemaker_cluster_constraints_sapmnt_order + [__constraint_order_sapmnt] }}" + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_sapmnt] }}" vars: __constraint_order_sapmnt: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}-clone" role: started resource_then: id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" when: - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed - - __constraint_order_sapmnt.resource_then not in (__sap_ha_pacemaker_cluster_constraints_sapmnt_order | map(attribute='resource_then')) - name: "SAP HA Prepare Pacemaker - Add order constraint: first start /sapmnt, then start ERS group" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_sapmnt_order: "{{ __sap_ha_pacemaker_cluster_constraints_sapmnt_order + [__constraint_order_sapmnt] }}" + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_sapmnt] }}" vars: __constraint_order_sapmnt: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}-clone" role: started resource_then: id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" when: - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed - - __constraint_order_sapmnt.resource_then not in (__sap_ha_pacemaker_cluster_constraints_sapmnt_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 1257e91cd..87dfb650f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -172,6 +172,7 @@ ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" + ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" From 1948fe0f307946cf35e47908b4bbcb208e38dc3d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 29 Aug 2023 11:51:18 +0200 Subject: [PATCH 049/179] sap_ha_pacemaker_cluster: enh: more parameter documentation --- roles/sap_ha_pacemaker_cluster/README.md | 96 +++++++++++++++++ .../defaults/main.yml | 20 ++-- .../meta/argument_specs.yml | 101 ++++++++++++++++++ 3 files changed, 211 insertions(+), 6 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index be9a157db..9020aa51b 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -313,6 +313,102 @@ Required for cluster nodes setup in IBM Cloud.
The cloud region key in which the instances are running.
Required for cluster nodes setup in IBM Cloud.
+### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name + +- _Type:_ `str` + +Name of the filesystem resource for the ASCS instance.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness + +- _Type:_ `str` +- _Default:_ `3000` + +NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool + +- _Type:_ `bool` +- _Default:_ `False` + +NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout + +- _Type:_ `str` +- _Default:_ `60` + +NetWeaver ASCS instance failure-timeout attribute.
+Only used for ENSA1 setups. Default is ENSA2.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold + +- _Type:_ `str` +- _Default:_ `1` + +NetWeaver ASCS instance migration-threshold setting attribute.
+Only used for ENSA1 setups. Default is ENSA2.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name + +- _Type:_ `str` + +The name of the ASCS instance, typically the profile name.
+Required for the NetWeaver ASCS resource.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name + +- _Type:_ `str` + +Name of the ASCS instance resource.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness + +- _Type:_ `str` +- _Default:_ `5000` + +NetWeaver ASCS instance resource stickiness attribute.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string + +- _Type:_ `str` + +The full path and name of the ASCS instance profile.
+Required for the NetWeaver ASCS resource.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name + +- _Type:_ `str` + +Name of the filesystem resource for the ERS instance.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool + +- _Type:_ `bool` +- _Default:_ `False` + +NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name + +- _Type:_ `str` + +The name of the ERS instance, typically the profile name.
+Required for the NetWeaver ERS resource.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name + +- _Type:_ `str` + +Name of the ERS instance resource.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string + +- _Type:_ `str` + +The full path and name of the ERS instance profile.
+Required for the NetWeaver ERS resource.
+ ### sap_ha_pacemaker_cluster_replication_type - _Type:_ `str` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 68ad24a6b..8b58ff313 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -128,9 +128,9 @@ sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false # ASCS resource defaults ################################################################################ -# Name of the instance profile +# Name of the instance profile - mandatory to be user-defined sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: '' -# Full path with instance profile name +# Full path with instance profile name - mandatory to be user-defined sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: '' # SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. @@ -142,8 +142,8 @@ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInst #sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: false sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: 5000 -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_migration_threshold: 1 -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_failure_timeout: 60 +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: 1 +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: 60 # Stickiness of the ASCS group sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: 3000 @@ -152,9 +152,10 @@ sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: 3000 # ERS resource defaults ################################################################################ -# Name of the instance profile +# Name of the instance profile - mandatory to be user-defined sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: '' -# Full path with instance profile name + +# Full path with instance profile name - mandatory to be user-defined sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: '' sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" @@ -162,6 +163,10 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInsta #sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: false + +################################################################################ +# PAS/AAS resource defaults +################################################################################ # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/D<> #sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}" @@ -169,6 +174,9 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: #sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" +################################################################################ +# JAVA SCS/ERS resource defaults +################################################################################ # SAP NetWeaver JAVA SCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/SCS<> # - /usr/sap/<>/ERS<> diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 761a5c111..b8524bddf 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -185,6 +185,107 @@ argument_specs: required: false type: str + ### ASCS parameters + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + description: + - The name of the ASCS instance, typically the profile name. + - Required for the NetWeaver ASCS resource. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: + description: + - The full path and name of the ASCS instance profile. + - Required for the NetWeaver ASCS resource. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + description: + - Name of the filesystem resource for the ASCS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + description: + - Name of the ASCS instance resource. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + description: + - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". + default: false + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + description: + - NetWeaver ASCS instance resource stickiness attribute. + default: 5000 + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + description: + - NetWeaver ASCS instance migration-threshold setting attribute. + - Only used for ENSA1 setups. Default is ENSA2. + default: 1 + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + description: + - NetWeaver ASCS instance failure-timeout attribute. + - Only used for ENSA1 setups. Default is ENSA2. + default: 60 + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + description: + - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. + default: 3000 + required: false + type: str + + ### ERS parameters + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: + description: + - The name of the ERS instance, typically the profile name. + - Required for the NetWeaver ERS resource. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: + description: + - The full path and name of the ERS instance profile. + - Required for the NetWeaver ERS resource. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + description: + - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". + default: false + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + description: + - Name of the filesystem resource for the ERS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + description: + - Name of the ERS instance resource. + required: false + type: str + + + ### HANA sap_ha_pacemaker_cluster_replication_type: choices: - mtr From d32f73f9ffeff21db8f0518342d460cdf2949e17 Mon Sep 17 00:00:00 2001 From: surajsbharadwaj <101711050+surajsbharadwaj@users.noreply.github.com> Date: Tue, 29 Aug 2023 16:56:13 +0200 Subject: [PATCH 050/179] fix: update the hdbuserstore with correct host name --- roles/sap_swpm/tasks/post_install.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/roles/sap_swpm/tasks/post_install.yml b/roles/sap_swpm/tasks/post_install.yml index 916249c3e..d26dbee2f 100644 --- a/roles/sap_swpm/tasks/post_install.yml +++ b/roles/sap_swpm/tasks/post_install.yml @@ -33,3 +33,17 @@ - ' IP - {{ ansible_default_ipv4.address | d(ansible_all_ipv4_addresses[0]) }} ' # - ' Master Password - {{ sap_swpm_master_password }} ' # - ' DDIC 000 Password - {{ sap_swpm_ddic_000_password }} ' + +- name: SAP SWPM Post Install - Enforce Connection Info in hdbuserstore + ansible.builtin.shell: | + /usr/sap/{{ sap_swpm_sid }}/hdbclient/hdbuserstore \ + SET DEFAULT \ + {{ sap_swpm_db_host }}:3{{ sap_swpm_db_instance_nr }}13@{{ sap_swpm_db_sid }} \ + {{ sap_swpm_db_schema_abap }} '{{ sap_swpm_db_system_password }}' + args: + executable: /bin/bash + become: true + become_user: "{{ sap_swpm_sid | lower }}adm" + when: sap_swpm_install_saphostagent is defined and sap_swpm_install_saphostagent + register: __sap_swpm_post_install_register_hdbuserstore_connection + changed_when: __sap_swpm_post_install_register_hdbuserstore_connection is succeeded From 65f049765121b780007380d561c979d1028c5a7e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 29 Aug 2023 17:44:12 +0200 Subject: [PATCH 051/179] sap_ha_pacemaker_cluster: change: simpler VIP definition with individual parameters --- roles/sap_ha_pacemaker_cluster/README.md | 77 ++++++++++++++++++- .../defaults/main.yml | 33 +++++--- .../meta/argument_specs.yml | 77 ++++++++++++++++++- ...construct_vars_netweaver_abap_ascs_ers.yml | 4 +- .../construct_vars_vip_constraints_hana.yml | 13 ++-- .../construct_vars_vip_resources_default.yml | 2 +- .../tasks/include_construct_vip_resources.yml | 47 ++++++++--- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 23 +++--- ...uct_vars_vip_resources_cloud_gcp_ce_vm.yml | 10 +-- ...s_vip_resources_cloud_ibmcloud_powervs.yml | 5 +- ...ct_vars_vip_resources_cloud_msazure_vm.yml | 15 ++-- ...uct_vars_vip_resources_hyp_ibmpower_vm.yml | 5 +- .../vars/nwas_abap_ascs_ers.yml | 2 +- 13 files changed, 242 insertions(+), 71 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 9020aa51b..3d660ee8c 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -432,12 +432,83 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` -### sap_ha_pacemaker_cluster_vip_resource_name +### sap_ha_pacemaker_cluster_vip_hana_primary_ip - _Type:_ `str` -- _Default:_ `vip__` -Customize the name of the resource managing the Virtual IP.
+The virtual IP of the primary HANA instance.
+ +### sap_ha_pacemaker_cluster_vip_hana_primary_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of the primary HANA instance.
+ +### sap_ha_pacemaker_cluster_vip_hana_secondary_ip + +- _Type:_ `str` + +The virtual IP for read-only access to the secondary HANA instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip + +- _Type:_ `str` + +The virtual IP of the NetWeaver AAS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip + +- _Type:_ `str` + +The virtual IP of the NetWeaver ASCS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip + +- _Type:_ `str` + +The virtual IP of the NetWeaver ERS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip + +- _Type:_ `str` + +The virtual IP of the NetWeaver PAS instance.
+ +### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance.
+ +### sap_ha_pacemaker_cluster_vip_secondary_resource_name + +- _Type:_ `str` +- _Default:_ `vip_` + +Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance.
### sap_hana_cluster_nodes diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 8b58ff313..f9e7c8f6a 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -23,7 +23,7 @@ sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluste # Inherit SAP common (global synonyms) parameters sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_ha_cluster_nodes | default(sap_hana_cluster_nodes) }}" sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" -sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('00') }}" +sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" # TODO: document filesystem definitions sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" @@ -41,12 +41,12 @@ sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | defaul sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" -sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr }}" -sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr }}" -sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr }}" -sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" #sap_ha_pacemaker_cluster_netweaver_common_filesystems: # - /sapmnt @@ -96,10 +96,23 @@ sap_ha_pacemaker_cluster_fence_options: pcmk_reboot_timeout: 400 power_timeout: 240 -### Resource default patterns -sap_ha_pacemaker_cluster_vip_address: "{{ sap_hana_vip | default(sap_cluster_vip) }}" +### VIP resource default patterns sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" -sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" + +# Multiple VIP parameters can be defined and will be combined. +# See tasks/include_construct_vip_resources.yml +sap_ha_pacemaker_cluster_vip_hana_primary_ip: '' +sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" +sap_ha_pacemaker_cluster_vip_hana_secondary_ip: '' +sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" +sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" +sap_ha_pacemaker_cluster_vip_netweaver_ers_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_ers" +sap_ha_pacemaker_cluster_vip_netweaver_pas_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}_pas" +sap_ha_pacemaker_cluster_vip_netweaver_aas_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" # SAP HANA - Resource IDs (names) as convenience parameters. sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index b8524bddf..3a4e7ce08 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -332,10 +332,81 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_resource_name: - default: "vip__" + sap_ha_pacemaker_cluster_vip_hana_primary_ip: description: - - Customize the name of the resource managing the Virtual IP. + - The virtual IP of the primary HANA instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of the primary HANA instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_hana_secondary_ip: + description: + - The virtual IP for read-only access to the secondary HANA instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_secondary_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip: + description: + - The virtual IP of the NetWeaver ASCS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_ers_ip: + description: + - The virtual IP of the NetWeaver ERS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_pas_ip: + description: + - The virtual IP of the NetWeaver PAS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_aas_ip: + description: + - The virtual IP of the NetWeaver AAS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: + default: "vip_" + description: + - Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance. required: false type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 5913ad60d..3672eaf0d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -259,7 +259,7 @@ resource_ids: - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ sap_ha_pacemaker_cluster_vip_address | select('search', 'ascs') | join('') }}" + - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" meta_attrs: - attrs: - name: resource-stickiness @@ -283,7 +283,7 @@ resource_ids: - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ sap_ha_pacemaker_cluster_vip_address | select('search', 'ers') | join('') }}" + - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" when: - __ers_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml index e632bbaec..729d9e2ac 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -2,7 +2,7 @@ # Reminder: This file is included in a loop over a dictionary. # Start the VIP(s) only after the HANA resource has been promoted -- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after DB is promoted" +- name: "SAP HA Prepare Pacemaker - Add order constraint: Primary VIP starts after DB is promoted" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -11,11 +11,10 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: promote resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" + id: "{{ vip_list_item.key }}" action: start when: - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_primary_synonyms # The primary VIP only runs where HANA is promoted - name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" @@ -27,13 +26,12 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" role: promoted resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" + id: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" options: - name: score value: 2000 when: - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_primary_synonyms # The secondary VIP only runs where HANA is UNpromoted - name: "SAP HA Prepare Pacemaker - Add colocation constraint: Read-only VIP runs where HANA is not promoted" @@ -45,10 +43,11 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" role: unpromoted resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" + id: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" options: - name: score value: 2000 when: - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_secondary_synonyms + - sap_ha_pacemaker_cluster_vip_hana_secondary_ip is defined + - sap_ha_pacemaker_cluster_vip_hana_secondary_ip != '' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 3e2b16235..5217de9e8 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -7,7 +7,7 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: __resource_vip: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" + id: "{{ vip_list_item.key }}" agent: "{{ sap_ha_pacemaker_cluster_vip_resource_agent }}" instance_attrs: - attrs: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 2f3bc1569..d57009262 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -2,37 +2,64 @@ # The VIP resource construction files are included in a loop to allow # for multiple IPs to be configured in cluster resources +- name: "SAP HA Prepare Pacemaker - Make a list of potential VIP definitions" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_all_vip_fact: + - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip }}" + - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip }}" + - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip }}" + - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip }}" + - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip }}" + - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip }}" + +- name: "SAP HA Prepare Pacemaker - Combine VIP parameters" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_vip_resource_definition: + "{{ __sap_ha_pacemaker_cluster_vip_resource_definition | default({}) + | combine ({ vip_item.key : vip_item.value }) }}" + loop: "{{ __sap_ha_pacemaker_cluster_all_vip_fact }}" + loop_control: + loop_var: vip_item + label: "{{ vip_item.key }}: {{ vip_item.value }}" + when: + - vip_item.key is defined + - vip_item.key != '' + - vip_item.value is defined + - vip_item.value != '' + +# Repeat the VIP resource definition in a loop over the above combined possible parameters. - name: "SAP HA Prepare Pacemaker - Include variable construction for standard VIP resources" ansible.builtin.include_tasks: construct_vars_vip_resources_default.yml - loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" + loop: "{{ query('dict', __sap_ha_pacemaker_cluster_vip_resource_definition) }}" loop_control: index_var: loop_index loop_var: vip_list_item - vars: - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - - (vip_list_item.value is defined) and (vip_list_item.value != '') - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" ansible.builtin.include_tasks: "platform/construct_vars_vip_resources_{{ __sap_ha_pacemaker_cluster_platform }}.yml" - loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" + loop: "{{ query('dict', __sap_ha_pacemaker_cluster_vip_resource_definition) }}" loop_control: index_var: loop_index loop_var: vip_list_item when: - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms - - (vip_list_item.value is defined) and (vip_list_item.value != '') - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" ansible.builtin.include_tasks: file: construct_vars_vip_constraints_hana.yml - loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" + loop: "{{ query('dict', __sap_ha_pacemaker_cluster_vip_resource_definition) }}" loop_control: index_var: loop_index loop_var: vip_list_item - vars: - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - - (vip_list_item.value is defined) and (vip_list_item.value != '') + - sap_ha_pacemaker_cluster_vip_hana_primary_ip is defined + - sap_ha_pacemaker_cluster_vip_hana_primary_ip != '' - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 005d67dfa..91dcad871 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -4,17 +4,16 @@ - name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) @@ -24,37 +23,35 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: __resource_vip: - id: "pri{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "pri_{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" instance_attrs: - attrs: - name: secondary_private_ip value: "{{ vip_list_item.value }}" when: - - ('pri' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('pri_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'awsvip' -- name: "SAP HA Prepare Pacemaker - awsvip resource agent - Add resource group for VIP resources" +- name: "SAP HA Prepare Pacemaker - awsvip resource agent - Add resource group for VIP resources (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__vip_group] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" vars: __vip_group: id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" resource_ids: - - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - - "pri{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + - "{{ vip_list_item.key }}" + - "pri_{{ vip_list_item.key }}" when: - __vip_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method in ['awsvip'] -- name: "SAP HA Prepare Pacemaker - aws_vpc_move_ip resource agent - Add resource: AWS VIP routing" +- name: "SAP HA Prepare Pacemaker - aws_vpc_move_ip resource agent - Add resource: AWS VIP OverlayIP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" instance_attrs: - attrs: @@ -65,5 +62,5 @@ - name: routing_table value: "{{ sap_ha_pacemaker_cluster_aws_vip_update_rt | join(',') }}" when: - - (sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 5434e770b..7a873a7c0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -4,17 +4,16 @@ - name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) @@ -22,10 +21,9 @@ - name: "SAP HA Prepare Pacemaker - haproxy resource agent - Add resource: Google Cloud Load Balancing Internal passthrough Network Load Balancer (NLB L-4) for VIP routing when SAP HANA scale-up HA" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __health_check: - id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "hc_{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" operations: - action: monitor @@ -36,6 +34,6 @@ value: 20 when: - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' + vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'gcp_nlb_reserved_ip_haproxy' - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml index 306036c53..da995eae2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml @@ -4,17 +4,16 @@ - name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index de0a728ed..34982f29b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -4,17 +4,16 @@ - name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) @@ -34,10 +33,9 @@ - name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Add resource: Azure Load Balancer (NLB L-4) for VIP routing when SAP HANA scale-up HA" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __health_check: - id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "hc_{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" instance_attrs: - attrs: @@ -47,7 +45,7 @@ value: "{{ __sap_ha_pacemaker_cluster_register_socat_path.stdout }}" when: - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'azure_lb' - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list @@ -55,10 +53,9 @@ - name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Add resource: Azure Load Balancer (NLB L-4) for VIP routing when SAP NetWeaver HA - ASCS and ERS" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __health_check: - id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "hc_{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" instance_attrs: - attrs: @@ -73,6 +70,6 @@ label: "{{ lb_port_for_hc }}" when: - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'azure_lb' - "'nwas_abap_ascs_ers' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml index 306036c53..da995eae2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml @@ -4,17 +4,16 @@ - name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml index d75ee86be..04197d622 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml @@ -1,2 +1,2 @@ --- -sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +#sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" From 2e2e0549fd7ea295fe29433f963f7179d1471cd5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 29 Aug 2023 18:43:45 +0200 Subject: [PATCH 052/179] sap_ha_pacemaker_cluster: fix: ERS vip in the ERS group --- .../tasks/construct_vars_netweaver_abap_ascs_ers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 3672eaf0d..2f3b687fc 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -283,7 +283,7 @@ resource_ids: - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" when: - __ers_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) From ba2a4b4d59847e4cc300626700cc5823745d9b53 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 30 Aug 2023 17:31:29 +0200 Subject: [PATCH 053/179] sap_install_media_detect: modify the paths for SAPASE --- .../tasks/find_files_after_extraction.yml | 2 +- roles/sap_install_media_detect/tasks/set_global_vars.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 04e0b86f5..2e3e72480 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -90,7 +90,7 @@ paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" recurse: true file_type: file - patterns: ".*sybodbc.*" + patterns: ".*sybjdbc.*" use_regex: true register: detect_directory_sapase_client_extracted when: sap_install_media_detect_db == "sapase" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index c9d3e4e2b..14ada03be 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -85,7 +85,7 @@ # sap_swpm, we need to set the path which contains this directory, not the directory itself. - name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: - sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapase" From 6f3194abda92bc433594e96116936f0c99996fe1 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 30 Aug 2023 18:48:36 +0200 Subject: [PATCH 054/179] sap_install_media_detect: in phase 2, use "equalto" instead of "match" for correct results --- .../prepare/create_file_list_phase_2.yml | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index a42df58e3..cfd1daaa5 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -96,13 +96,13 @@ - name: SAP Install Media Detect - Prepare - Assert that sapcar is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapcar') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapcar') | length > 0 fail_msg: "No sapcar file found" - name: SAP Install Media Detect - Prepare - Assert that swpm is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_swpm') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_swpm') | length > 0 fail_msg: "No file found for sap_swpm" when: - sap_install_media_detect_swpm | d(false) @@ -110,7 +110,7 @@ - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB independent is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_kernel') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_kernel') | length > 0 - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXE_') | length == 1 fail_msg: "No, or more than one, DB independent SAP Kernel file found" when: @@ -173,7 +173,7 @@ - name: SAP Install Media Detect - Prepare - Assert that SAP Host Agent is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_hostagent') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_hostagent') | length > 0 fail_msg: "No SAP Host Agent file found" when: - sap_install_media_detect_hostagent | d(false) @@ -181,7 +181,7 @@ - name: SAP Install Media Detect - Prepare - Assert that igsexe is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_igs') | length > 0 - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igsexe') | length > 0 fail_msg: "No igsexe file found" when: @@ -190,7 +190,7 @@ - name: SAP Install Media Detect - Prepare - Assert that igshelper is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_igs') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_igs') | length > 0 - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igshelper') | length > 0 fail_msg: "No igshelper file found" when: @@ -199,7 +199,7 @@ - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP WEBDISP is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_webdisp') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_webdisp') | length > 0 - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPWEBDISP_') | length == 1 fail_msg: "No, or more than one, SAPWEBDISP file found" when: @@ -208,7 +208,7 @@ - name: SAP Install Media Detect - Prepare - Assert that saphana is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana') | length > 0 fail_msg: "No file found for saphana" when: - (sap_install_media_detect_db | d('')) == 'saphana' @@ -216,15 +216,23 @@ - name: SAP Install Media Detect - Prepare - Assert that saphana_client is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'saphana_client') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana_client') | length > 0 fail_msg: "No file found for saphana_client" when: - (sap_install_media_detect_db | d('')) == 'saphana' + - name: debug 1 + debug: + msg: "{{ __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') }}" + + - name: debug 2 + debug: + msg: "{{ __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') | length }}" + - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') | length > 0 fail_msg: "No file found for sapase" when: - (sap_install_media_detect_db | d('')) == 'sapase' @@ -232,7 +240,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sapase_client is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapase_client') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase_client') | length > 0 fail_msg: "No file found for sapase_client" when: - (sap_install_media_detect_db | d('')) == 'sapase' @@ -240,7 +248,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sapmaxdb') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapmaxdb') | length > 0 fail_msg: "No file found for sapmaxdb" when: - (sap_install_media_detect_db | d('')) == 'sapmaxdb' @@ -248,7 +256,7 @@ - name: SAP Install Media Detect - Prepare - Assert that oracledb is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb') | length > 0 fail_msg: "No file found for oracledb" when: - (sap_install_media_detect_db | d('')) == 'oracledb' @@ -256,7 +264,7 @@ - name: SAP Install Media Detect - Prepare - Assert that oracledb_client is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'oracledb_client') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb_client') | length > 0 fail_msg: "No file found for oracledb_client" when: - (sap_install_media_detect_db | d('')) == 'oracledb' @@ -264,7 +272,7 @@ - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2') | length > 0 fail_msg: "No file found for ibmdb2" when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' @@ -272,7 +280,7 @@ - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_client is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_client') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_client') | length > 0 fail_msg: "No file found for ibmdb2_client" when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' @@ -280,7 +288,7 @@ - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'ibmdb2_license') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_license') | length > 0 fail_msg: "No file found for ibmdb2_license" when: - (sap_install_media_detect_db | d('')) == 'ibmdb2' @@ -288,7 +296,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_s4hana is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_s4hana') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_s4hana') | length > 0 fail_msg: "No file found for sap_export_s4hana" when: - (sap_install_media_detect_export | d('')) == 'saps4hana' @@ -296,7 +304,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_bw4hana is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_bw4hana') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_bw4hana') | length > 0 fail_msg: "No file found for sap_export_bw4hana" when: - (sap_install_media_detect_export | d('')) == 'sapbw4hana' @@ -304,7 +312,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc') | length > 0 fail_msg: "No file found for sap_export_ecc" when: - (sap_install_media_detect_export | d('')) == 'sapecc' @@ -312,7 +320,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc_ides is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_ecc_ides') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc_ides') | length > 0 fail_msg: "No file found for sap_export_ecc_ides" when: - (sap_install_media_detect_export | d('')) == 'sapecc_ides' @@ -320,7 +328,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_abap is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_abap') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_abap') | length > 0 fail_msg: "No file found for sap_export_nwas_abap" when: - (sap_install_media_detect_export | d('')) == 'sapnwas_abap' @@ -328,7 +336,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_java is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_nwas_java') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_java') | length > 0 fail_msg: "No file found for sap_export_nwas_java" when: - (sap_install_media_detect_export | d('')) == 'sapnwas_java' @@ -336,7 +344,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_abap is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_abap') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_abap') | length > 0 fail_msg: "No file found for sap_export_solman_abap" when: - (sap_install_media_detect_export | d('')) == 'sapsolman_abap' @@ -344,7 +352,7 @@ - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_java is present ansible.builtin.assert: that: - - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'match', 'sap_export_solman_java') | length > 0 + - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_java') | length > 0 fail_msg: "No file found for sap_export_solman_java" when: - (sap_install_media_detect_export | d('')) == 'sapsolman_java' From 9e80d79635b14c908f1538b4b7fdee65db533e22 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 30 Aug 2023 18:49:23 +0200 Subject: [PATCH 055/179] sap_install_media_detect: ... and remove the two debug tasks --- .../tasks/prepare/create_file_list_phase_2.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index cfd1daaa5..aab5000c2 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -221,14 +221,6 @@ when: - (sap_install_media_detect_db | d('')) == 'saphana' - - name: debug 1 - debug: - msg: "{{ __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') }}" - - - name: debug 2 - debug: - msg: "{{ __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') | length }}" - - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: that: From 219833f95c218d4c5c5f7946810b3f55da32d362 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 30 Aug 2023 19:15:06 +0200 Subject: [PATCH 056/179] sap_install_media_detect: Use one directory level above for Export of SAP Solution Manager (JAVA) --- roles/sap_install_media_detect/tasks/set_global_vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 14ada03be..a868e9e8b 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -184,7 +184,7 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (JAVA) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_java" From fc34c3d21a48d99ad2b6a83709efb81bf380ad13 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 31 Aug 2023 12:33:45 +0200 Subject: [PATCH 057/179] sap_install_media_detect: modify SAP HANA extraction behavior and directories --- roles/sap_install_media_detect/files/tmp/sapfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index b8a6b5999..16c660912 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -309,7 +309,7 @@ for _FILE in "$@"; do ;; saphana_client) _TARGET_DIRECTORY="auto" - _EXTRACTION_DIRECTORY="sap_hana_client" + _EXTRACTION_DIRECTORY="sap_hana_client_extracted" _EXTRACT="y" _COPY="y" ;; @@ -326,8 +326,8 @@ for _FILE in "$@"; do ;; saphana|saphana_other|sap_vch_afl) _TARGET_DIRECTORY="sap_hana" - _EXTRACTION_DIRECTORY="none" - _EXTRACT="n" + _EXTRACTION_DIRECTORY="sap_hana_extracted" + _EXTRACT="y" ;; sap_swpm) _TARGET_DIRECTORY="sap_swpm" From 75cf15bb21bf96f8c7c79c576fc8cec73ca4f783 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 31 Aug 2023 16:15:31 +0200 Subject: [PATCH 058/179] sap_install_media_detect: populate HANA extracted directory variable --- .../tasks/find_files_after_extraction.yml | 10 +++++----- .../sap_install_media_detect/tasks/set_global_vars.yml | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 2e3e72480..56ef9f1bd 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -120,11 +120,11 @@ - sap_install_media_detect_kernel - sap_swpm_kernel_independent_file_name_get.stdout_lines | count > 1 -- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, unspecific +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific - block when: sap_install_media_detect_kernel_db is not defined block: - - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB + - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific ansible.builtin.shell: ls SAPEXEDB_*.SAR args: chdir: "{{ sap_swpm_software_path }}" @@ -132,18 +132,18 @@ changed_when: false when: sap_install_media_detect_kernel - - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found + - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found, database unspecific ansible.builtin.fail: msg: "No, or more than one, SAPEXEDB file has been detected." when: - sap_install_media_detect_kernel - sap_swpm_kernel_dependent_file_name_get.stdout_lines | count != 1 -- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific +- name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific - block when: sap_install_media_detect_kernel_db is defined block: - - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB + - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific ansible.builtin.shell: "{{ __sap_install_media_detect_sapfile_path }} -e --sapcar_file={{ __sap_install_media_detect_fact_sapcar_path }} SAPEXEDB_*.SAR" args: chdir: "{{ sap_swpm_software_path }}" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index a868e9e8b..c644024c6 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -37,7 +37,7 @@ ansible.builtin.set_fact: sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" # for sap_hana_install Ansible Role -# sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role + sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives @@ -138,7 +138,7 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc" From 403fc6950946c07afa599ff3f97506fe4c221341 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 31 Aug 2023 17:13:08 +0200 Subject: [PATCH 059/179] sap_ha_pacemaker_cluster: enh: AWS instance type pattern matching more flexible --- .../tasks/platform/ascertain_platform_type.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 b35399f91..8e545c36b 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 @@ -46,7 +46,8 @@ - name: "SAP HA Prepare Pacemaker - Check if platform is Amazon Web Services EC2 Virtual Server" when: - - ansible_system_vendor == 'Amazon EC2' + - '"amazon" in ansible_system_vendor | lower + or "amazon" in ansible_product_name | lower' ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_platform: cloud_aws_ec2_vs From 87827986c30f9cb76dfe59e489fd3d263ccf6988 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 10:07:54 +0200 Subject: [PATCH 060/179] sap_install_media_detect: add a trailing slash to all directory and path variables --- .../tasks/set_global_vars.yml | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index c644024c6..8e9fdb593 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -7,18 +7,18 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SAPCAR ansible.builtin.set_fact: - sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}" + sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/" sap_swpm_sapcar_file_name: "{{ sap_swpm_sapcar_file_name_get.stdout }}" - name: SAP Install Media Detect - Detection completed - Set fact for SWPM, move_or_copy_archives parameter set ansible.builtin.set_fact: -# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # set in find_files_after_extraction.yml -# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" -# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for sap_swpm Ansible Role - sap_swpm_install_directory: "{{ sap_swpm_software_path }}" - sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role -# sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role -# sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role +# sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" # set in find_files_after_extraction.yml +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket/" # for sap_swpm Ansible Role + sap_swpm_install_directory: "{{ sap_swpm_software_path }}/" + sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" # for sap_swpm Ansible Role +# sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm/" # for sap_swpm Ansible Role +# sap_swpm_sapcar_path: "{{ sap_swpm_software_path }}/" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives @@ -26,18 +26,18 @@ - name: SAP Install Media Detect - Detection completed - Set fact for SWPM, move_or_copy_archives parameter not set ansible.builtin.set_fact: -# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}" # for sap_swpm Ansible Role - sap_swpm_install_directory: "{{ sap_swpm_software_path }}" - sap_swpm_swpm_path: "{{ sap_swpm_software_path }}" # for sap_swpm Ansible Role +# sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/" # for sap_swpm Ansible Role + sap_swpm_install_directory: "{{ sap_swpm_software_path }}/" + sap_swpm_swpm_path: "{{ sap_swpm_software_path }}/" # for sap_swpm Ansible Role when: - not sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_swpm - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter set ansible.builtin.set_fact: - sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" - sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" # for sap_hana_install Ansible Role - sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana/" + sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana/" # for sap_hana_install Ansible Role + sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted/" # for sap_hana_install Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives @@ -45,9 +45,9 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter not set ansible.builtin.set_fact: - sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}" - sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}" # for sap_hana_install Ansible Role -# sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted" # for sap_hana_install Ansible Role + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/" + sap_hana_install_software_directory: "{{ __sap_install_media_detect_software_main_directory }}/" # for sap_hana_install Ansible Role +# sap_hana_install_software_extract_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana_extracted/" # for sap_hana_install Ansible Role ignore_errors: true when: - not sap_install_media_detect_move_or_copy_archives @@ -55,7 +55,7 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm ansible.builtin.set_fact: - sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives @@ -65,8 +65,8 @@ # to set the path which contains this directory, not the directory itself. - name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: - sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "ibmdb2" @@ -75,9 +75,9 @@ # contains 'OCL_LINUX_X86_64' but we also need the path which contains this directory. - name: SAP Install Media Detect - Detection completed - Set facts for Oracle DB ansible.builtin.set_fact: - sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}" # for sap_anydb_install_oracle Ansible Role - sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_anydb_install_oracle Ansible Role + sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "oracledb" @@ -85,26 +85,26 @@ # sap_swpm, we need to set the path which contains this directory, not the directory itself. - name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: - sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapase" - name: SAP Install Media Detect - Detection completed - Set facts for SAP MaxDB ansible.builtin.set_fact: - sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapmaxdb" - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXE ansible.builtin.set_fact: - sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}/" sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, unspecific ansible.builtin.set_fact: - sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}/" sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" when: - sap_install_media_detect_kernel_db is not defined @@ -112,79 +112,79 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, specific ansible.builtin.set_fact: - sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" + sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}/" sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get }}" when: - sap_install_media_detect_kernel_db is defined - name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS ansible.builtin.set_fact: - sap_swpm_igs_path: "{{ sap_swpm_software_path }}" + sap_swpm_igs_path: "{{ sap_swpm_software_path }}/" sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}" when: sap_install_media_detect_igs - name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS Helper ansible.builtin.set_fact: - sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" + sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}/" sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" when: sap_install_media_detect_igs - name: SAP Install Media Detect - Detection completed - Set facts for WebDisp ansible.builtin.set_fact: - sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" + sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}/" sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" ignore_errors: true when: sap_install_media_detect_webdisp - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC IDES ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_ecc_ides_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_ecc_ides_export_extracted.files[0].path | dirname | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapecc_ides" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "saps4hana" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapbw4hana" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path | dirname | dirname }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path | dirname | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_abap" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (JAVA) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path | dirname }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_java" From 84dc1e85e6bdb65ccd545190e7b6b00119fca667 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 10:17:43 +0200 Subject: [PATCH 061/179] sap_install_media_detect: add a trailing slash to path variables also in find_files_after_extraction.yml --- .../tasks/find_files_after_extraction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 56ef9f1bd..052b1b5cb 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -6,14 +6,14 @@ - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter set ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for setting consecutive vars + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket/" # for setting consecutive vars ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter not set ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" # for setting consecutive vars + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/" # for setting consecutive vars ignore_errors: true when: - not sap_install_media_detect_move_or_copy_archives From b50876ba05fc06e387f40ac4e5c073f0e4301a05 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 11:05:56 +0200 Subject: [PATCH 062/179] sap_install_media_detect: modify the location and extraction of the Oracle DB tools --- roles/sap_install_media_detect/files/tmp/sapfile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 16c660912..4967ece31 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -318,9 +318,14 @@ for _FILE in "$@"; do ;; sapmaxdb) ;; - oracledb|oracledb_client|oracledb_tools) + oracledb|oracledb_client) _TARGET_DIRECTORY="oracledb" ;; + oracledb_tools) + _TARGET_DIRECTORY="sap_swpm_download_basket" + _EXTRACTION_DIRECTORY="none" + _EXTRACT="n" + ;; ibmdb2|ibmdb2_client|ibmdb2_license) _TARGET_DIRECTORY="ibmdb2" ;; From a9348986d7495f9dfa95cb60cf58a74a1da54a1b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 11:45:49 +0200 Subject: [PATCH 063/179] sap_install_media_detect: do not add a trailing slash for S/4HANA and BW/4HANA export file --- roles/sap_install_media_detect/tasks/set_global_vars.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 8e9fdb593..1f108642e 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -152,13 +152,13 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "saps4hana" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapbw4hana" From 787f958473b35e054ca45cdcceba9bc5ecdb5184 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 11:48:54 +0200 Subject: [PATCH 064/179] sap_install_media_detect: do not add a trailing slash for sap_swpm_software_path --- .../tasks/find_files_after_extraction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 052b1b5cb..56ef9f1bd 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -6,14 +6,14 @@ - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter set ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket/" # for setting consecutive vars + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm_download_basket" # for setting consecutive vars ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - name: SAP Install Media Detect - Find files after extraction - Set fact for SAP kernel files, move_or_copy_archives parameter not set ansible.builtin.set_fact: - sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}/" # for setting consecutive vars + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" # for setting consecutive vars ignore_errors: true when: - not sap_install_media_detect_move_or_copy_archives From baa89d2f7fcc7b3a4532924f5cb23bb054c513e1 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 13:46:46 +0200 Subject: [PATCH 065/179] sap_install_media_detect: use "sybodbc" instead of "sybjdbc" for searching the SAP ASE client directory --- .../tasks/find_files_after_extraction.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 56ef9f1bd..d1d977ca2 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -90,7 +90,7 @@ paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" recurse: true file_type: file - patterns: ".*sybjdbc.*" + patterns: ".*sybodbc.*" use_regex: true register: detect_directory_sapase_client_extracted when: sap_install_media_detect_db == "sapase" From 464e8234d6d271c1432c93185462bcffc2331a3c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 1 Sep 2023 16:31:06 +0200 Subject: [PATCH 066/179] sap_ha_pacemaker_cluster: make vip nic parameter generic again --- roles/sap_ha_pacemaker_cluster/README.md | 15 +++++++-------- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 6 ++++-- .../meta/argument_specs.yml | 3 +-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 3d660ee8c..6efde6124 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -175,14 +175,6 @@ Required for cluster nodes setup on Amazon cloud.
AWS secret key, paired with the access key for instance control.
Required for cluster nodes setup on Amazon cloud.
-### sap_ha_pacemaker_cluster_aws_vip_client_interface - -- _Type:_ `str` -- _Default:_ `eth0` - -OS device name of the network interface to use for the Virtual IP configuration.
-This is needed for `aws_vpc_move_ip` resources in AWS EC2 environments.
- ### sap_ha_pacemaker_cluster_aws_vip_update_rt - _Type:_ `list` @@ -432,6 +424,13 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` +### sap_ha_pacemaker_cluster_vip_client_interface + +- _Type:_ `str` +- _Default:_ `eth0` + +OS device name of the network interface to use for the Virtual IP configuration.
+ ### sap_ha_pacemaker_cluster_vip_hana_primary_ip - _Type:_ `str` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index f9e7c8f6a..330286d2f 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -98,6 +98,7 @@ sap_ha_pacemaker_cluster_fence_options: ### VIP resource default patterns sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" +sap_ha_pacemaker_cluster_vip_client_interface: eth0 # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml @@ -201,8 +202,9 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: #sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" -# TODO: network interface name used for client access -sap_ha_pacemaker_cluster_aws_vip_client_interface: eth0 +################################################################################ +# Platform specific +################################################################################ sap_ha_pacemaker_cluster_aws_vip_update_rt: [] ## A custom stonith definition that takes precedence over platform defaults. diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 3a4e7ce08..62e152543 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -324,11 +324,10 @@ argument_specs: # required: false # type: str - sap_ha_pacemaker_cluster_aws_vip_client_interface: + sap_ha_pacemaker_cluster_vip_client_interface: default: eth0 description: - OS device name of the network interface to use for the Virtual IP configuration. - - This is needed for `aws_vpc_move_ip` resources in AWS EC2 environments. required: false type: str From cb919f515c855bdf5d632a0c3916a1230c6f2a47 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 1 Sep 2023 17:20:06 +0200 Subject: [PATCH 067/179] sap_ha_pacemaker_cluster: added separator back between SID and instance number in default names --- .../defaults/main.yml | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 330286d2f..6336ae0b1 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -103,22 +103,22 @@ sap_ha_pacemaker_cluster_vip_client_interface: eth0 # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml sap_ha_pacemaker_cluster_vip_hana_primary_ip: '' -sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" +sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" sap_ha_pacemaker_cluster_vip_hana_secondary_ip: '' -sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" +sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip: '' -sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" +sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" sap_ha_pacemaker_cluster_vip_netweaver_ers_ip: '' -sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_ers" +sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_ers" sap_ha_pacemaker_cluster_vip_netweaver_pas_ip: '' -sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}_pas" +sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}_pas" sap_ha_pacemaker_cluster_vip_netweaver_aas_ip: '' -sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" +sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" # SAP HANA - Resource IDs (names) as convenience parameters. -sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" -sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" # NFS filesystem resource requirement @@ -151,8 +151,8 @@ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: ' # - /usr/sap/<>/ASCS<> # - /usr/sap/<>/ERS<> -sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: false sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: 5000 @@ -172,8 +172,8 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: '' # Full path with instance profile name - mandatory to be user-defined sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: '' -sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: false From 3d9d709ec6e5f5d7108e1ef3a3c3ec5377943a43 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 1 Sep 2023 17:25:02 +0200 Subject: [PATCH 068/179] sap_ha_pacemaker_cluster: cosmetical comment in AWS vars --- .../vars/platform_cloud_aws_ec2_vs.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index e448ba638..9153f6591 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -18,10 +18,14 @@ __sap_ha_pacemaker_cluster_aws_instances: [] # When aws credentials and region are not defined it will # default to using the aws cli configuration. -# aws cli is configured anyway for the standard AWS VIP resource. +# The aws cli is currently configured anyway for the standard AWS VIP resource. sap_ha_pacemaker_cluster_stonith_default: id: "res_fence_aws" agent: "stonith:fence_aws" +# options: +# access_key: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}" +# secret_key: "{{ sap_ha_pacemaker_cluster_aws_secret_access_key }}" +# region: "{{ sap_ha_pacemaker_cluster_aws_region }}" # Platform specific VIP handling sap_ha_pacemaker_cluster_vip_method: aws_vpc_move_ip From 9ed2a03f4a316cd9f5e748ef2e2039346ca3c0ac Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 1 Sep 2023 17:52:24 +0200 Subject: [PATCH 069/179] sap_ha_pacemaker_cluster: change suffix _ip to _ip_address for clarity --- roles/sap_ha_pacemaker_cluster/README.md | 12 ++++++------ roles/sap_ha_pacemaker_cluster/defaults/main.yml | 12 ++++++------ .../meta/argument_specs.yml | 12 ++++++------ .../tasks/construct_vars_netweaver_common.yml | 2 +- .../construct_vars_vip_constraints_hana.yml | 4 ++-- .../tasks/include_construct_vip_resources.yml | 16 ++++++++-------- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 6efde6124..6cf0c731a 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -431,7 +431,7 @@ sap_ha_pacemaker_cluster_resource_defaults: OS device name of the network interface to use for the Virtual IP configuration.
-### sap_ha_pacemaker_cluster_vip_hana_primary_ip +### sap_ha_pacemaker_cluster_vip_hana_primary_ip_address - _Type:_ `str` @@ -444,13 +444,13 @@ The virtual IP of the primary HANA instance.
Customize the name of the resource managing the Virtual IP of the primary HANA instance.
-### sap_ha_pacemaker_cluster_vip_hana_secondary_ip +### sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address - _Type:_ `str` The virtual IP for read-only access to the secondary HANA instance.
-### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip +### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address - _Type:_ `str` @@ -463,7 +463,7 @@ The virtual IP of the NetWeaver AAS instance.
Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance.
-### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip +### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address - _Type:_ `str` @@ -476,7 +476,7 @@ The virtual IP of the NetWeaver ASCS instance.
Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance.
-### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip +### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address - _Type:_ `str` @@ -489,7 +489,7 @@ The virtual IP of the NetWeaver ERS instance.
Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance.
-### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip +### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address - _Type:_ `str` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 6336ae0b1..9b208d45a 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -102,17 +102,17 @@ sap_ha_pacemaker_cluster_vip_client_interface: eth0 # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml -sap_ha_pacemaker_cluster_vip_hana_primary_ip: '' +sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" -sap_ha_pacemaker_cluster_vip_hana_secondary_ip: '' +sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" -sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" -sap_ha_pacemaker_cluster_vip_netweaver_ers_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_ers" -sap_ha_pacemaker_cluster_vip_netweaver_pas_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}_pas" -sap_ha_pacemaker_cluster_vip_netweaver_aas_ip: '' +sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" # SAP HANA - Resource IDs (names) as convenience parameters. diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 62e152543..a2035e47a 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -331,7 +331,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_hana_primary_ip: + sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: description: - The virtual IP of the primary HANA instance. required: false @@ -344,7 +344,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_hana_secondary_ip: + sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: description: - The virtual IP for read-only access to the secondary HANA instance. required: false @@ -357,7 +357,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip: + sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: description: - The virtual IP of the NetWeaver ASCS instance. required: false @@ -370,7 +370,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip: + sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: description: - The virtual IP of the NetWeaver ERS instance. required: false @@ -383,7 +383,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip: + sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: description: - The virtual IP of the NetWeaver PAS instance. required: false @@ -396,7 +396,7 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip: + sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: description: - The virtual IP of the NetWeaver AAS instance. required: false diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index e96bb24e5..06a4b806a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -44,7 +44,7 @@ - name: options value: "{{ __mount_opts }}" - name: force_unmount - value: safe + value: "{{ sap_ha_pacemaker_cluster_resource_filesystem_force_unmount }}" operations: - action: start attrs: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml index 729d9e2ac..8049ef7ec 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -49,5 +49,5 @@ value: 2000 when: - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - sap_ha_pacemaker_cluster_vip_hana_secondary_ip is defined - - sap_ha_pacemaker_cluster_vip_hana_secondary_ip != '' + - sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address is defined + - sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address != '' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index d57009262..b269c4826 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -6,17 +6,17 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_all_vip_fact: - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address }}" - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" ansible.builtin.set_fact: @@ -60,6 +60,6 @@ index_var: loop_index loop_var: vip_list_item when: - - sap_ha_pacemaker_cluster_vip_hana_primary_ip is defined - - sap_ha_pacemaker_cluster_vip_hana_primary_ip != '' + - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address is defined + - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address != '' - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 From 4959da67dd07f18939b62e2922365561950a5916 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 1 Sep 2023 23:50:54 +0200 Subject: [PATCH 070/179] sap_install_media_detect: sapfile: added missing default for sap_export_nwas_abap --- roles/sap_install_media_detect/files/tmp/sapfile | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 4967ece31..82e1c8ec4 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -277,6 +277,7 @@ for _FILE in "$@"; do END{print _sap_file_type}') if [[ ${_SAP_FILE_TYPE}. == "sap_export_nwas_abap." && ${_GENERIC_FILE_TYPE}. == "zip." ]]; then _SAP_FILE_TYPE=$(unzip -p "${_FILE}" LABEL.ASC | awk ' + BEGIN{_sap_file_type="sap_export_nwas_abap"} /SAP SOLUTION MANAGER/{_sap_file_type="sap_export_solman_abap"} END{print _sap_file_type}') fi From d256825fe9bdfe3fd8691a5bcdfbef4123acae81 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 4 Sep 2023 16:42:11 +0200 Subject: [PATCH 071/179] sap_install_media_detect: use DATA_UNITS as last directory for sap_export_solman_java_extracted --- .../sap_install_media_detect/tasks/set_global_vars.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 1f108642e..2430ca5c4 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -164,27 +164,27 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path | dirname | dirname }}/" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role - sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role + sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_abap" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (JAVA) ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapsolman_java" From b364b16f54bf6ae6ee7e46eea6b25b33ae6df12e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 4 Sep 2023 14:59:16 +0200 Subject: [PATCH 072/179] sap_storage_setup: enh: multipath introduction --- roles/sap_storage_setup/defaults/main.yml | 8 +++++++- roles/sap_storage_setup/meta/argument_specs.yml | 8 ++++++++ roles/sap_storage_setup/tasks/main.yml | 5 +++++ roles/sap_storage_setup/vars/RedHat.yml | 8 ++++++-- roles/sap_storage_setup/vars/Suse.yml | 8 ++++++-- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index 5dbd54980..c67ad5200 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -4,6 +4,12 @@ sap_storage_setup_host_type: "{{ sap_host_type }}" sap_storage_setup_sid: "{{ sap_system_sid }}" +# By default look for multipath devices. +# This includes +# - installation of necessary packages +# - enabling of related services +sap_storage_setup_multipath_enable_and_detect: true + # The instance_nr parameters are required for references at the bottom. sap_storage_setup_nwas_abap_ascs_instance_nr: '00' sap_storage_setup_nwas_abap_ers_instance_nr: '10' @@ -29,7 +35,7 @@ sap_storage_setup_nwas_java_ci_instance_nr: '21' #----------------------------------------------------------# sap_storage_setup_nfs_filesystem_type: nfs4 -sap_storage_setup_nfs_mount_options: 'hard,acl' +sap_storage_setup_nfs_mount_options: defaults sap_storage_setup_local_filesystem_type: xfs # subdirectories as per SAP requirements diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index aac9c9aa1..317716921 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -143,6 +143,14 @@ argument_specs: required: true # type can be list or string, the code will convert it to a list + + sap_storage_setup_multipath_enable_and_detect: + default: true + description: + - Define if multipathing should be enabled and dynamic multipath devices detected and used for the filesystem setup. + required: false + type: bool + sap_storage_setup_sid: description: - SID of the SAP service. diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 237d67467..dd7e43760 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -25,6 +25,11 @@ loop_control: loop_var: service_item +- name: SAP Storage Setup - Configure multipathing + when: + - sap_storage_setup_multipath_enable_and_detect + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_multipathing.yml" ################ # Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml diff --git a/roles/sap_storage_setup/vars/RedHat.yml b/roles/sap_storage_setup/vars/RedHat.yml index 0ecc0616d..e98c1383f 100644 --- a/roles/sap_storage_setup/vars/RedHat.yml +++ b/roles/sap_storage_setup/vars/RedHat.yml @@ -2,13 +2,17 @@ # RHEL specific variables __sap_storage_setup_extra_packages: - - device-mapper-multipath - lvm2 - lvm2-dbusd - lvm2-libs - lvm2-lockd - nfs-utils +__sap_storage_setup_extra_packages_multipath: + - device-mapper-multipath + __sap_storage_setup_extra_services: - - multipathd - lvm2-lvmdbusd + +__sap_storage_setup_extra_services_multipath: + - multipathd diff --git a/roles/sap_storage_setup/vars/Suse.yml b/roles/sap_storage_setup/vars/Suse.yml index 47d3bf422..d4c0dbc1b 100644 --- a/roles/sap_storage_setup/vars/Suse.yml +++ b/roles/sap_storage_setup/vars/Suse.yml @@ -2,10 +2,14 @@ # SLES specific variables __sap_storage_setup_extra_packages: - - multipath-tools - lvm2 - nfs-client +__sap_storage_setup_extra_packages_multipath: + - multipath-tools + __sap_storage_setup_extra_services: - - multipathd - lvm2-lvmdbusd + +__sap_storage_setup_extra_services_multipath: + - multipathd From b8b8a58007e197ea894bc6e53d5975a01023e611 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 4 Sep 2023 16:46:49 +0200 Subject: [PATCH 073/179] sap_storage_setup: enh: wwn mapping for filesystems --- .../tasks/configure_multipathing.yml | 121 ++++++++++++++++++ roles/sap_storage_setup/tasks/main.yml | 12 +- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 roles/sap_storage_setup/tasks/configure_multipathing.yml diff --git a/roles/sap_storage_setup/tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/configure_multipathing.yml new file mode 100644 index 000000000..b24aa3416 --- /dev/null +++ b/roles/sap_storage_setup/tasks/configure_multipathing.yml @@ -0,0 +1,121 @@ +--- +- name: SAP Storage Setup - Install OS packages for multipathing + ansible.builtin.package: + name: "{{ mp_package_item }}" + state: present + loop: "{{ __sap_storage_setup_extra_packages_multipath }}" + loop_control: + loop_var: mp_package_item + +- name: SAP Storage Setup - Make sure multipath services are running + ansible.builtin.service: + name: "{{ mp_service_item }}" + state: started + loop: "{{ __sap_storage_setup_extra_services_multipath }}" + loop_control: + loop_var: mp_service_item + +# Scan the SCSI bus to make sure devices have been refreshed after multipath was enabled. +# Create /etc/multipath.conf if it does not exist yet. +- name: SAP Storage Setup - Scan SCSI bus and create/refresh multipath config + register: __sap_storage_setup_register_refresh + ansible.builtin.shell: | + rescan-scsi-bus.sh \ + && sleep 10 \ + && { + multipathd reconfigure || /sbin/mpathconf --enable + } + failed_when: false + changed_when: __sap_storage_setup_register_refresh.rc == 0 + +- name: SAP Storage Setup - Refresh ansible device facts + ansible.builtin.setup: + gather_subset: + - "hardware" + +# Similar to generic device discovery and fs mapping (main.yml), but using different +# information from the ansible_devices facts to map the WWN instead of dynamic device names. + +# Logic: Collect "dm-*" devices which have +# - no "holders" +# - no "links.uuids" +# - no "partitions" +# - "wwn" defined +# - "size" matching any of the filesystems defined in {{ sap_storage_setup_definition }} + +- name: SAP Storage Setup - Make a list of unused DM devices of the requested sizes + ansible.builtin.set_fact: + available_devices_multipath: | + {% set av_disks = [] %} + {% set all_disks = (ansible_devices | dict2items) %} + {% for disk in all_disks %} + {%- if disk.key.startswith('dm-') + and disk.value.wwn is defined %} + {%- for fs in sap_storage_setup_definition %} + {%- if disk.value.links.uuids | length == 0 + and disk.value.partitions | length == 0 + and disk.value.holders | length == 0 + and fs.disk_size is defined + and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} + {%- set add_to_list = av_disks.append(disk) %} + {%- endif %} + {%- endfor %} + {%- endif %} + {%- endfor %} + {{ av_disks | items2dict }} + +# !! +# If the DISK MATCHING syntax has changed in the above, it must also +# be adjusted in the next task +# !! + +# This task assigns device names for each volume to be created. +# - custom definition: sap_storage_setup_definition +# - ansible facts: ansible-devices + +# DM devices are used for discovery, but the actual WWN will be used for +# the filesystem mapping. + +- name: SAP Storage Setup - Set fact for target filesystem device mapping + ansible.builtin.set_fact: + filesystem_device_map: "{{ filesystem_device_map | default([]) + [__multipath_to_fs_device_map] }}" + vars: + __multipath_to_fs_device_map: | + {% set device_map = [] %} + {% set av_dev = (available_devices_multipath | dict2items) %} + {% set assigned_dev = [] %} + {% for fs in sap_storage_setup_definition -%} + {% set matching_dev = [] -%} + + {%- if fs.disk_size is defined + and ('nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type)) + and fs.swap_path is not defined -%} + + {%- for dev in av_dev -%} + {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) + and dev.key not in assigned_dev + and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} + + {# comment: dev.key is the dm- device and assigned_dev is just a list of + devices that have been processed already #} + {%- set assigned = assigned_dev.append(dev.key) %} + + {# comment: this is the actual device and path to be used for the mapping #} + {# comment: wwn prefix "0x" must be removed and a "3" prefixed #} + {%- set add = matching_dev.append('/dev/mapper/3' + dev.value.wwn[2:]) %} + + {%- endif %} + {%- endfor %} + + {%- set extend = device_map.extend([ + { + 'device': matching_dev | join(','), + 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), + 'mountpoint': fs.mountpoint | default(''), + 'name': fs.name, + 'size': fs.disk_size, + } + ]) %} + {%- endif %} + {%- endfor %} + {{ device_map }} diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index dd7e43760..6a1bf8987 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -48,6 +48,11 @@ # - ansible facts: ansible_devices # ######### + +# When multipathing is enabled it will run device detection and fs mapping +# first and the following generic tasks will do the same for any non-multipathed +# devices in addition. + - name: SAP Storage Setup - Make a list of unused disk devices of the requested sizes ansible.builtin.set_fact: available_devices: | @@ -70,13 +75,18 @@ # be adjusted in the next task # !! +########## # This task assigns device names for each volume to be created. # - custom definition: sap_storage_setup_definition # - ansible facts: ansible-devices +# +########## - name: SAP Storage Setup - Set fact for target filesystem device mapping ansible.builtin.set_fact: - filesystem_device_map: | + filesystem_device_map: "{{ filesystem_device_map | default([]) + [__single_disk_to_fs_device_map] }}" + vars: + __single_disk_to_fs_device_map: | {% set device_map = [] %} {% set av_dev = (available_devices | dict2items) %} {% set assigned_dev = [] %} From 3ecbe6be2420e3ea422044a6e8470f56bef0c43e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 4 Sep 2023 17:14:58 +0200 Subject: [PATCH 074/179] sap_storage_setup: enh: new multipathing parameter --- roles/sap_storage_setup/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/sap_storage_setup/README.md b/roles/sap_storage_setup/README.md index 67b76cc1b..f3a99fb70 100644 --- a/roles/sap_storage_setup/README.md +++ b/roles/sap_storage_setup/README.md @@ -127,6 +127,13 @@ The type of service the target system is going to be configured for.
This can be a list of multiple types which apply to a single host.
If not defined, the default will be inherited from the global parameter `sap_host_type`. One of these parameters must be defined.
+### sap_storage_setup_multipath_enable_and_detect + +- _Type:_ `bool` +- _Default:_ `True` + +Define if multipathing should be enabled and dynamic multipath devices detected and used for the filesystem setup.
+ ### sap_storage_setup_sid required - _Type:_ `str` From 33114b69cd7d0c8fe04027f6c8550be5a0cc5312 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 12:40:12 +0200 Subject: [PATCH 075/179] sap_storage_setup: fix: moved multipathing include file into sub directory --- .../tasks/{ => generic_tasks}/configure_multipathing.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename roles/sap_storage_setup/tasks/{ => generic_tasks}/configure_multipathing.yml (100%) diff --git a/roles/sap_storage_setup/tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml similarity index 100% rename from roles/sap_storage_setup/tasks/configure_multipathing.yml rename to roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml From b4c2358d26173013239ca80319df5936700a901a Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 14:59:23 +0200 Subject: [PATCH 076/179] sap_storage_setup: fix: device list merging --- .../tasks/generic_tasks/configure_multipathing.yml | 8 ++++---- roles/sap_storage_setup/tasks/main.yml | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index b24aa3416..9e54f5362 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -96,12 +96,12 @@ and dev.key not in assigned_dev and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} - {# comment: dev.key is the dm- device and assigned_dev is just a list of - devices that have been processed already #} + {#- comment: dev.key is the dm- device and assigned_dev is just a list of + devices that have been processed already -#} {%- set assigned = assigned_dev.append(dev.key) %} - {# comment: this is the actual device and path to be used for the mapping #} - {# comment: wwn prefix "0x" must be removed and a "3" prefixed #} + {#- comment: this is the actual device and path to be used for the mapping -#} + {#- comment: wwn prefix "0x" must be removed and a "3" prefixed -#} {%- set add = matching_dev.append('/dev/mapper/3' + dev.value.wwn[2:]) %} {%- endif %} diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 6a1bf8987..2c1421fa0 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -60,7 +60,8 @@ {% set all_disks = (ansible_devices | dict2items) %} {% for disk in all_disks %} {%- for fs in sap_storage_setup_definition %} - {%- if disk.value.links.uuids | length == 0 + {%- if not disk.key.startswith('dm-') + and disk.value.links.uuids | length == 0 and disk.value.partitions | length == 0 and fs.disk_size is defined and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} @@ -84,7 +85,7 @@ - name: SAP Storage Setup - Set fact for target filesystem device mapping ansible.builtin.set_fact: - filesystem_device_map: "{{ filesystem_device_map | default([]) + [__single_disk_to_fs_device_map] }}" + filesystem_device_map: "{{ (filesystem_device_map | default([]) + [__single_disk_to_fs_device_map]) | flatten }}" vars: __single_disk_to_fs_device_map: | {% set device_map = [] %} From 56d10cd1d770a31ee4fb85f86e5bb40f430cf070 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 18:51:47 +0200 Subject: [PATCH 077/179] sap_ha_pacemaker_cluster: fix: GCP vip resource force cidr 32 --- .../platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 7a873a7c0..942877ff3 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -12,6 +12,8 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: 32 when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or From e92a07956d0308bd6fa3572dc1fafa3ca8632e5e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 19:15:08 +0200 Subject: [PATCH 078/179] sap_ha_pacemaker_cluster: fix: GCP vip needs a nic defined --- .../platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 942877ff3..39272c9a6 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -14,6 +14,8 @@ value: "{{ vip_list_item.value }}" - name: cidr_netmask value: 32 + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or From 72994ea9885bfffca6af0c85040595dca579d117 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 18:51:47 +0200 Subject: [PATCH 079/179] sap_ha_pacemaker_cluster: fix: GCP vip resource force cidr 32 --- .../platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 7a873a7c0..942877ff3 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -12,6 +12,8 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: 32 when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or From 7c68a64ad7241ce66792d9c7a2e970024a5cf357 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 6 Sep 2023 19:15:08 +0200 Subject: [PATCH 080/179] sap_ha_pacemaker_cluster: fix: GCP vip needs a nic defined --- .../platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 942877ff3..39272c9a6 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -14,6 +14,8 @@ value: "{{ vip_list_item.value }}" - name: cidr_netmask value: 32 + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or From 49a55656801314663278e84341b6c5cdbe3fbd2c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 15:17:15 +0200 Subject: [PATCH 081/179] sap_storage_setup: enh: multipathing support is disabled by default --- roles/sap_storage_setup/README.md | 2 +- roles/sap_storage_setup/defaults/main.yml | 6 +++--- roles/sap_storage_setup/meta/argument_specs.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/sap_storage_setup/README.md b/roles/sap_storage_setup/README.md index f3a99fb70..d30109f09 100644 --- a/roles/sap_storage_setup/README.md +++ b/roles/sap_storage_setup/README.md @@ -130,7 +130,7 @@ If not defined, the default will be inherited from the global parameter `sap_hos ### sap_storage_setup_multipath_enable_and_detect - _Type:_ `bool` -- _Default:_ `True` +- _Default:_ `False` Define if multipathing should be enabled and dynamic multipath devices detected and used for the filesystem setup.
diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index c67ad5200..583c2c386 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -4,11 +4,11 @@ sap_storage_setup_host_type: "{{ sap_host_type }}" sap_storage_setup_sid: "{{ sap_system_sid }}" -# By default look for multipath devices. -# This includes +# By default do not look for multipath devices. +# When enabled, this includes # - installation of necessary packages # - enabling of related services -sap_storage_setup_multipath_enable_and_detect: true +sap_storage_setup_multipath_enable_and_detect: false # The instance_nr parameters are required for references at the bottom. sap_storage_setup_nwas_abap_ascs_instance_nr: '00' diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 317716921..298fb2a47 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -145,7 +145,7 @@ argument_specs: sap_storage_setup_multipath_enable_and_detect: - default: true + default: false description: - Define if multipathing should be enabled and dynamic multipath devices detected and used for the filesystem setup. required: false From 4cba8700080de8fb38a261a0159b58e143b11fd8 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 15:28:47 +0200 Subject: [PATCH 082/179] sap_storage_setup: fix: reduce packages and avoid package loop --- .../tasks/generic_tasks/configure_multipathing.yml | 5 +---- roles/sap_storage_setup/tasks/main.yml | 5 +---- roles/sap_storage_setup/vars/RedHat.yml | 8 +++----- roles/sap_storage_setup/vars/Suse.yml | 4 ++-- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index 9e54f5362..282e9bbcf 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -1,11 +1,8 @@ --- - name: SAP Storage Setup - Install OS packages for multipathing ansible.builtin.package: - name: "{{ mp_package_item }}" + name: "{{ __sap_storage_setup_extra_packages_multipath }}" state: present - loop: "{{ __sap_storage_setup_extra_packages_multipath }}" - loop_control: - loop_var: mp_package_item - name: SAP Storage Setup - Make sure multipath services are running ansible.builtin.service: diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 2c1421fa0..08a39f39e 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -11,11 +11,8 @@ - name: SAP Storage Setup - Install additional OS packages ansible.builtin.package: - name: "{{ package_item }}" + name: "{{ __sap_storage_setup_extra_packages }}" state: present - loop: "{{ __sap_storage_setup_extra_packages }}" - loop_control: - loop_var: package_item - name: SAP Storage Setup - Make sure services are running ansible.builtin.service: diff --git a/roles/sap_storage_setup/vars/RedHat.yml b/roles/sap_storage_setup/vars/RedHat.yml index e98c1383f..ef952716b 100644 --- a/roles/sap_storage_setup/vars/RedHat.yml +++ b/roles/sap_storage_setup/vars/RedHat.yml @@ -3,16 +3,14 @@ __sap_storage_setup_extra_packages: - lvm2 - - lvm2-dbusd - - lvm2-libs - - lvm2-lockd - nfs-utils +# - lvm2-dbusd __sap_storage_setup_extra_packages_multipath: - device-mapper-multipath -__sap_storage_setup_extra_services: - - lvm2-lvmdbusd +#__sap_storage_setup_extra_services: +# - lvm2-lvmdbusd __sap_storage_setup_extra_services_multipath: - multipathd diff --git a/roles/sap_storage_setup/vars/Suse.yml b/roles/sap_storage_setup/vars/Suse.yml index d4c0dbc1b..376d35e19 100644 --- a/roles/sap_storage_setup/vars/Suse.yml +++ b/roles/sap_storage_setup/vars/Suse.yml @@ -8,8 +8,8 @@ __sap_storage_setup_extra_packages: __sap_storage_setup_extra_packages_multipath: - multipath-tools -__sap_storage_setup_extra_services: - - lvm2-lvmdbusd +#__sap_storage_setup_extra_services: +# - lvm2-lvmdbusd __sap_storage_setup_extra_services_multipath: - multipathd From d115507817ef216a7f0972a3925228eccddd5fb9 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 15:36:26 +0200 Subject: [PATCH 083/179] sap_storage_setup: enh: attempt play to fail when temp NFS fails --- .../tasks/generic_tasks/configure_nfs_filesystems.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 4697ec2dc..622a27fa5 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -94,7 +94,10 @@ # Put temporary tasks inside a block which will make sure # that even in case of failure the temporary mountpoint will be removed - name: SAP Storage Setup - Temporary steps for NFS directory structure - # Block global parameters + ### Block global parameters + # Stop execution of tasks after this block for any host, if one host + # failed a task in this block. + any_errors_fatal: true vars: attach_item: | {{ sap_storage_setup_definition From 1daef457d09ec7ece27bc0e1970b5fe635c60a45 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 17:05:00 +0200 Subject: [PATCH 084/179] sap_storage_setup: fix: make wwn processing independent of DM devices --- .../generic_tasks/configure_multipathing.yml | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index 282e9bbcf..32a7609b5 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -33,7 +33,7 @@ # Similar to generic device discovery and fs mapping (main.yml), but using different # information from the ansible_devices facts to map the WWN instead of dynamic device names. -# Logic: Collect "dm-*" devices which have +# Logic: Collect devices which have # - no "holders" # - no "links.uuids" # - no "partitions" @@ -46,13 +46,13 @@ {% set av_disks = [] %} {% set all_disks = (ansible_devices | dict2items) %} {% for disk in all_disks %} - {%- if disk.key.startswith('dm-') - and disk.value.wwn is defined %} + {%- if disk.value.wwn is defined + and disk.value.links.uuids | length == 0 + and disk.value.partitions | length == 0 + and disk.value.holders | length == 0 + %} {%- for fs in sap_storage_setup_definition %} - {%- if disk.value.links.uuids | length == 0 - and disk.value.partitions | length == 0 - and disk.value.holders | length == 0 - and fs.disk_size is defined + {%- if fs.disk_size is defined and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} {%- set add_to_list = av_disks.append(disk) %} {%- endif %} @@ -90,14 +90,12 @@ {%- for dev in av_dev -%} {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) - and dev.key not in assigned_dev + and dev.value.wwn not in assigned_dev and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} - {#- comment: dev.key is the dm- device and assigned_dev is just a list of - devices that have been processed already -#} - {%- set assigned = assigned_dev.append(dev.key) %} + {#- comment: assigned_dev is a list for keeping track of wwns that have been added already -#} + {%- set assigned = assigned_dev.append(dev.value.wwn) %} - {#- comment: this is the actual device and path to be used for the mapping -#} {#- comment: wwn prefix "0x" must be removed and a "3" prefixed -#} {%- set add = matching_dev.append('/dev/mapper/3' + dev.value.wwn[2:]) %} From 0115f2b87822805cc9841c41ae496aa3228f938b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 17:25:47 +0200 Subject: [PATCH 085/179] sap_storage_setup: fix: only add fs mapping when not mapped already --- roles/sap_storage_setup/tasks/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 08a39f39e..efbb6d7f6 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -92,8 +92,10 @@ {% set matching_dev = [] -%} {%- if fs.disk_size is defined - and ('nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type)) - and fs.swap_path is not defined -%} + and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) + and fs.swap_path is not defined + and fs.mountpoint not in filesystem_device_map | map(attribute="mountpoint") + -%} {%- for dev in av_dev -%} {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) From 994a3de5748d54b591f5cf9185e45180d8ab88c1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 19:40:35 +0200 Subject: [PATCH 086/179] sap_storage_setup: fix: services task conditional --- roles/sap_storage_setup/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index efbb6d7f6..807d72cdd 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -15,6 +15,7 @@ state: present - name: SAP Storage Setup - Make sure services are running + when: __sap_storage_setup_extra_services is defined ansible.builtin.service: name: "{{ service_item }}" state: started @@ -94,6 +95,7 @@ {%- if fs.disk_size is defined and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) and fs.swap_path is not defined + and fs.mountpoint is defined and fs.mountpoint not in filesystem_device_map | map(attribute="mountpoint") -%} From 67d3e78e50db369758459ccaa28a9059f660a1ad Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 7 Sep 2023 20:13:29 +0200 Subject: [PATCH 087/179] sap_storage_setup: fix: jinja fixes --- roles/sap_storage_setup/tasks/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 807d72cdd..794dca7f7 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -95,8 +95,7 @@ {%- if fs.disk_size is defined and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) and fs.swap_path is not defined - and fs.mountpoint is defined - and fs.mountpoint not in filesystem_device_map | map(attribute="mountpoint") + and fs.name not in filesystem_device_map | map(attribute="name") -%} {%- for dev in av_dev -%} From 286a9c5773e5ea73858aff67a00cf2c7b3350a4c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 11:25:37 +0200 Subject: [PATCH 088/179] sap_storage_setup: fix: device mapping only for new mounts --- .../generic_tasks/configure_multipathing.yml | 14 +- .../map_single_disks_to_filesystems.yml | 140 ++++++++++++++ roles/sap_storage_setup/tasks/main.yml | 181 ++++-------------- 3 files changed, 184 insertions(+), 151 deletions(-) create mode 100644 roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index 32a7609b5..0f36744b0 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -1,10 +1,10 @@ --- -- name: SAP Storage Setup - Install OS packages for multipathing +- name: SAP Storage Setup - (Multipathing) Install OS packages ansible.builtin.package: name: "{{ __sap_storage_setup_extra_packages_multipath }}" state: present -- name: SAP Storage Setup - Make sure multipath services are running +- name: SAP Storage Setup - (Multipathing) Make sure services are running ansible.builtin.service: name: "{{ mp_service_item }}" state: started @@ -14,7 +14,7 @@ # Scan the SCSI bus to make sure devices have been refreshed after multipath was enabled. # Create /etc/multipath.conf if it does not exist yet. -- name: SAP Storage Setup - Scan SCSI bus and create/refresh multipath config +- name: SAP Storage Setup - (Multipathing) Scan SCSI bus and create/refresh config register: __sap_storage_setup_register_refresh ansible.builtin.shell: | rescan-scsi-bus.sh \ @@ -25,7 +25,7 @@ failed_when: false changed_when: __sap_storage_setup_register_refresh.rc == 0 -- name: SAP Storage Setup - Refresh ansible device facts +- name: SAP Storage Setup - (Multipathing) Refresh ansible device facts ansible.builtin.setup: gather_subset: - "hardware" @@ -40,7 +40,7 @@ # - "wwn" defined # - "size" matching any of the filesystems defined in {{ sap_storage_setup_definition }} -- name: SAP Storage Setup - Make a list of unused DM devices of the requested sizes +- name: SAP Storage Setup - (Multipathing) Make a list of unused WWNs of the requested sizes ansible.builtin.set_fact: available_devices_multipath: | {% set av_disks = [] %} @@ -73,9 +73,9 @@ # DM devices are used for discovery, but the actual WWN will be used for # the filesystem mapping. -- name: SAP Storage Setup - Set fact for target filesystem device mapping +- name: SAP Storage Setup - (Multipathing) Set fact for target filesystem device mapping ansible.builtin.set_fact: - filesystem_device_map: "{{ filesystem_device_map | default([]) + [__multipath_to_fs_device_map] }}" + filesystem_device_map: "{{ filesystem_device_map | default([]) + __multipath_to_fs_device_map }}" vars: __multipath_to_fs_device_map: | {% set device_map = [] %} diff --git a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml new file mode 100644 index 000000000..5bbba3e2a --- /dev/null +++ b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml @@ -0,0 +1,140 @@ +--- +########## +# Creating a list of unused devices that match the requested filesystem sizes, using +# - custom definition: sap_storage_setup_definition +# - ansible facts: ansible_devices +# +######### + +- name: SAP Storage Setup - Make a list of unused disk devices of the requested sizes + ansible.builtin.set_fact: + available_devices: | + {% set av_disks = [] %} + {% set all_disks = (ansible_devices | dict2items) %} + {% for disk in all_disks %} + {%- for fs in sap_storage_setup_definition %} + {%- if not disk.key.startswith('dm-') + and disk.value.links.uuids | length == 0 + and disk.value.partitions | length == 0 + and fs.disk_size is defined + and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} + {%- set add_to_list = av_disks.append(disk) %} + {%- endif %} + {%- endfor %} + {%- endfor %} + {{ av_disks | items2dict }} + +# !! +# If the DISK MATCHING syntax has changed in the above, it must also +# be adjusted in the next task +# !! + +########## +# This task assigns device names for each volume to be created. +# - custom definition: sap_storage_setup_definition +# - ansible facts: ansible-devices +# +########## + + +# When multipathing is enabled, there will be a {{ filesystem_device_map }} +# defined already that is to be enhanced with single disk definitions, if +# applicable. + +- name: SAP Storage Setup - Set fact for target filesystem device mapping + ansible.builtin.set_fact: + filesystem_device_map: "{{ filesystem_device_map | default([]) + __single_disk_to_fs_device_map }}" + vars: + __single_disk_to_fs_device_map: | + {% set device_map = [] %} + {% set av_dev = (available_devices | dict2items) %} + {% set assigned_dev = [] %} + {% for fs in sap_storage_setup_definition -%} + {% set matching_dev = [] -%} + + {%- if fs.disk_size is defined + and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) + and fs.swap_path is not defined + and fs.name not in filesystem_device_map | map(attribute="name") + -%} + + {%- for dev in av_dev -%} + {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) + and dev.key not in assigned_dev + and dev.value.holders | length == 0 + and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} + + {%- set assigned = assigned_dev.append(dev.key) %} + {%- set add = matching_dev.append('/dev/' + dev.key) %} + + {%- endif %} + {%- endfor %} + + {%- if matching_dev | length > 0 -%} + {%- set extend = device_map.extend([ + { + 'device': matching_dev | join(','), + 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), + 'mountpoint': fs.mountpoint | default(''), + 'name': fs.name, + 'size': fs.disk_size, + } + ]) %} + {%- endif %} + {%- endif %} + {%- endfor %} + {{ device_map }} + + +# This task combines information to create a mapping list of devices to filesystems. +# Sources: +# - Extravars definition: sap_storage_setup_definition +# - Ansible host facts: hostvars[host_node].ansible_devices +- name: SAP Storage Setup - Set fact for device to filesystem mapping + ansible.builtin.set_fact: + volume_map: "{{ volume_map + volume_element }}" + vars: + volume_map: [] + volume_element: + - filesystem_type: "{{ map_item.filesystem_type | default(sap_storage_setup_local_filesystem_type) }}" + mountpoint: "{{ map_item.mountpoint | default('') }}" + volume_group: "{{ map_item.lvm_vg_name | default('vg_' + map_item.name) }}" + volume_name: "{{ map_item.lvm_lv_name | default('lv_' + map_item.name) }}" + device: |- + {% for entry in filesystem_device_map %} + {%- if map_item.name == entry.name -%} + {{ entry.device }} + {%- endif %} + {%- endfor %} + pesize: "{{ map_item.lvm_vg_physical_extent_size | default('4') }}" + pv_opts: "{{ map_item.lvm_pv_options | default('') }}" + vg_opts: "{{ map_item.lvm_vg_options | default('') }}" + lv_opts: |- + {% set lvopts = [] %} + {% if map_item.lvm_lv_stripes is defined and + map_item.lvm_lv_stripes | int > 0 -%} + {% set addopt = lvopts.append('--stripes ' + map_item.lvm_lv_stripes | string) %} + {%- endif %} + {% if map_item.lvm_lv_stripe_size is defined and + map_item.lvm_lv_stripe_size | length > 0 -%} + {% set addopt = lvopts.append('--stripesize ' + map_item.lvm_lv_stripe_size) %} + {%- endif %} + {{ lvopts | join(' ') }} + + loop: "{{ sap_storage_setup_definition }}" + loop_control: + label: "{{ map_item.name }}" + loop_var: map_item + when: + - map_item.nfs_path is not defined + - '"nfs" not in map_item.filesystem_type' + - map_item.swap_path is not defined + - filesystem_device_map is defined + - filesystem_device_map | length > 0 + + +- name: SAP Storage Setup - Display local disk setup assignment + ansible.builtin.debug: + var: volume_map + when: + - volume_map is defined diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 794dca7f7..263965080 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -4,12 +4,14 @@ ansible.builtin.setup: gather_subset: - "distribution" + - "hardware" - name: SAP Storage Setup - Include OS specific vars ansible.builtin.include_vars: file: "{{ ansible_os_family }}.yml" - name: SAP Storage Setup - Install additional OS packages + when: __sap_storage_setup_extra_packages is defined ansible.builtin.package: name: "{{ __sap_storage_setup_extra_packages }}" state: present @@ -23,171 +25,62 @@ loop_control: loop_var: service_item -- name: SAP Storage Setup - Configure multipathing +# Create a list of elements from {{ sap_storage_setup_definition }} for all +# mountpoint elements that are not already reported as mounted in ansible facts. + +# NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) +# Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map + +- name: SAP Storage Setup - Determine which local filesystems are not configured yet when: - - sap_storage_setup_multipath_enable_and_detect - ansible.builtin.include_tasks: - file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_multipathing.yml" + - new_mounts_item.nfs_path is not defined + - new_mounts_item.mountpoint is defined + - new_mounts_item.mountpoint not in ansible_mounts | map(attribute=mount") + ansible.builtin.set_fact: + sap_storage_setup_new_mounts_fact: "{{ sap_storage_setup_new_mounts_fact | default([]) + [new_mounts_item] }}" + loop: "{{ sap_storage_setup_definition }}" + loop_control: + loop_var: new_mounts_item + label: "{{ new_mounts_item.name }}" -################ -# Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml -################ +# TODO: Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml #- name: SAP Storage Setup - Preparation for '{{ sap_storage_cloud_type }}' # include_tasks: "{{ sap_storage_cloud_type }}_main.yml" - # TODO: verify that the number of disks matches the fs definition # TODO: add functionality to work with existing LVM volumes and skip disk assignment -########## -# Creating a list of unused devices that match the requested filesystem sizes, using -# - custom definition: sap_storage_setup_definition -# - ansible facts: ansible_devices -# -######### - +# Multipathing before single device processing: # When multipathing is enabled it will run device detection and fs mapping # first and the following generic tasks will do the same for any non-multipathed -# devices in addition. +# devices in addition, if there are any left and filesystems not yet assigned +# with devices. -- name: SAP Storage Setup - Make a list of unused disk devices of the requested sizes - ansible.builtin.set_fact: - available_devices: | - {% set av_disks = [] %} - {% set all_disks = (ansible_devices | dict2items) %} - {% for disk in all_disks %} - {%- for fs in sap_storage_setup_definition %} - {%- if not disk.key.startswith('dm-') - and disk.value.links.uuids | length == 0 - and disk.value.partitions | length == 0 - and fs.disk_size is defined - and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} - {%- set add_to_list = av_disks.append(disk) %} - {%- endif %} - {%- endfor %} - {%- endfor %} - {{ av_disks | items2dict }} - -# !! -# If the DISK MATCHING syntax has changed in the above, it must also -# be adjusted in the next task -# !! - -########## -# This task assigns device names for each volume to be created. -# - custom definition: sap_storage_setup_definition -# - ansible facts: ansible-devices -# -########## - -- name: SAP Storage Setup - Set fact for target filesystem device mapping - ansible.builtin.set_fact: - filesystem_device_map: "{{ (filesystem_device_map | default([]) + [__single_disk_to_fs_device_map]) | flatten }}" - vars: - __single_disk_to_fs_device_map: | - {% set device_map = [] %} - {% set av_dev = (available_devices | dict2items) %} - {% set assigned_dev = [] %} - {% for fs in sap_storage_setup_definition -%} - {% set matching_dev = [] -%} - - {%- if fs.disk_size is defined - and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) - and fs.swap_path is not defined - and fs.name not in filesystem_device_map | map(attribute="name") - -%} - - {%- for dev in av_dev -%} - {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) - and dev.key not in assigned_dev - and dev.value.holders | length == 0 - and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} - - {%- set assigned = assigned_dev.append(dev.key) %} - {%- set add = matching_dev.append('/dev/' + dev.key) %} - - {%- endif %} - {%- endfor %} - - {%- if matching_dev | length > 0 -%} - {%- set extend = device_map.extend([ - { - 'device': matching_dev | join(','), - 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), - 'mountpoint': fs.mountpoint | default(''), - 'name': fs.name, - 'size': fs.disk_size, - } - ]) %} - {%- endif %} - {%- endif %} - {%- endfor %} - {{ device_map }} - - -# This task combines information to create a mapping list of devices to filesystems. -# Sources: -# - Extravars definition: sap_storage_setup_definition -# - Ansible host facts: hostvars[host_node].ansible_devices -- name: SAP Storage Setup - Set fact for device to filesystem mapping - ansible.builtin.set_fact: - volume_map: "{{ volume_map + volume_element }}" - vars: - volume_map: [] - volume_element: - - filesystem_type: "{{ map_item.filesystem_type | default(sap_storage_setup_local_filesystem_type) }}" - mountpoint: "{{ map_item.mountpoint | default('') }}" - volume_group: "{{ map_item.lvm_vg_name | default('vg_' + map_item.name) }}" - volume_name: "{{ map_item.lvm_lv_name | default('lv_' + map_item.name) }}" - device: |- - {% for entry in filesystem_device_map %} - {%- if map_item.name == entry.name -%} - {{ entry.device }} - {%- endif %} - {%- endfor %} - pesize: "{{ map_item.lvm_vg_physical_extent_size | default('4') }}" - pv_opts: "{{ map_item.lvm_pv_options | default('') }}" - vg_opts: "{{ map_item.lvm_vg_options | default('') }}" - lv_opts: |- - {% set lvopts = [] %} - {% if map_item.lvm_lv_stripes is defined and - map_item.lvm_lv_stripes | int > 0 -%} - {% set addopt = lvopts.append('--stripes ' + map_item.lvm_lv_stripes | string) %} - {%- endif %} - {% if map_item.lvm_lv_stripe_size is defined and - map_item.lvm_lv_stripe_size | length > 0 -%} - {% set addopt = lvopts.append('--stripesize ' + map_item.lvm_lv_stripe_size) %} - {%- endif %} - {{ lvopts | join(' ') }} - - loop: "{{ sap_storage_setup_definition }}" - loop_control: - label: "{{ map_item.name }}" - loop_var: map_item +- name: SAP Storage Setup - Configure multipathing and map disks to target filesystems when: - - map_item.nfs_path is not defined - - '"nfs" not in map_item.filesystem_type' - - map_item.swap_path is not defined - - filesystem_device_map is defined - - filesystem_device_map | length > 0 - + - sap_storage_setup_multipath_enable_and_detect + - sap_storage_setup_new_mounts_fact is defined + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_multipathing.yml" -- name: SAP Storage Setup - Display local disk setup assignment - ansible.builtin.debug: - var: volume_map +- name: SAP Storage Setup - Map non-multipathed disks to target filesystems when: - - volume_map is defined - + - not sap_storage_setup_multipath_enable_and_detect + - sap_storage_setup_new_mounts_fact is defined + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/map_single_disks_to_filesystems.yml" -################ +# LVM setup will only be entered when there were +# - unconfigured mountpoints +# - unconfigured disks matching the unconfigured filesystem sizes - name: SAP Storage Setup - Configure Volume Groups and Logical Volumes - ansible.builtin.include_tasks: - file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" when: - volume_map is defined - volume_map | length > 0 + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" # NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) From 9fb2b3c4a07f19efaa63f601f9c71a7b9adf9c35 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 11:25:37 +0200 Subject: [PATCH 089/179] sap_storage_setup: fix: device mapping only for new mounts --- roles/sap_storage_setup/tasks/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 263965080..e79b6ebbe 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -64,10 +64,8 @@ ansible.builtin.include_tasks: file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_multipathing.yml" -- name: SAP Storage Setup - Map non-multipathed disks to target filesystems +- name: SAP Storage Setup - Combine single disks and complete mapping definition when: - - not sap_storage_setup_multipath_enable_and_detect - - sap_storage_setup_new_mounts_fact is defined ansible.builtin.include_tasks: file: "{{ sap_storage_setup_cloud_type }}_tasks/map_single_disks_to_filesystems.yml" From d09f83dbed347f5841af7053d6cd19647280dac1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 11:36:22 +0200 Subject: [PATCH 090/179] sap_storage_setup: fix: needs conditional --- roles/sap_storage_setup/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index e79b6ebbe..a5c14df55 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -66,6 +66,7 @@ - name: SAP Storage Setup - Combine single disks and complete mapping definition when: + - sap_storage_setup_new_mounts_fact is defined ansible.builtin.include_tasks: file: "{{ sap_storage_setup_cloud_type }}_tasks/map_single_disks_to_filesystems.yml" From 3036de7b1dc28a0129a61bdb9d607649e811fffb Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 11:47:01 +0200 Subject: [PATCH 091/179] sap_storage_setup: fix: only use filtered storage definition fact --- .../tasks/generic_tasks/configure_multipathing.yml | 8 ++++---- .../map_single_disks_to_filesystems.yml | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index 0f36744b0..dd475bd7e 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -38,7 +38,7 @@ # - no "links.uuids" # - no "partitions" # - "wwn" defined -# - "size" matching any of the filesystems defined in {{ sap_storage_setup_definition }} +# - "size" matching any of the filesystems defined in {{ sap_storage_setup_new_mounts_fact }} - name: SAP Storage Setup - (Multipathing) Make a list of unused WWNs of the requested sizes ansible.builtin.set_fact: @@ -51,7 +51,7 @@ and disk.value.partitions | length == 0 and disk.value.holders | length == 0 %} - {%- for fs in sap_storage_setup_definition %} + {%- for fs in sap_storage_setup_new_mounts_fact %} {%- if fs.disk_size is defined and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} {%- set add_to_list = av_disks.append(disk) %} @@ -67,7 +67,7 @@ # !! # This task assigns device names for each volume to be created. -# - custom definition: sap_storage_setup_definition +# - reduced custom definition: sap_storage_setup_new_mounts_fact # - ansible facts: ansible-devices # DM devices are used for discovery, but the actual WWN will be used for @@ -81,7 +81,7 @@ {% set device_map = [] %} {% set av_dev = (available_devices_multipath | dict2items) %} {% set assigned_dev = [] %} - {% for fs in sap_storage_setup_definition -%} + {% for fs in sap_storage_setup_new_mounts_fact -%} {% set matching_dev = [] -%} {%- if fs.disk_size is defined diff --git a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml index 5bbba3e2a..cd10daa51 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml @@ -1,7 +1,7 @@ --- ########## # Creating a list of unused devices that match the requested filesystem sizes, using -# - custom definition: sap_storage_setup_definition +# - definition of unconfigured filesystems: sap_storage_setup_new_mounts_fact # - ansible facts: ansible_devices # ######### @@ -12,7 +12,7 @@ {% set av_disks = [] %} {% set all_disks = (ansible_devices | dict2items) %} {% for disk in all_disks %} - {%- for fs in sap_storage_setup_definition %} + {%- for fs in sap_storage_setup_new_mounts_fact %} {%- if not disk.key.startswith('dm-') and disk.value.links.uuids | length == 0 and disk.value.partitions | length == 0 @@ -31,7 +31,7 @@ ########## # This task assigns device names for each volume to be created. -# - custom definition: sap_storage_setup_definition +# - definition of unconfigured filesystems: sap_storage_setup_new_mounts_fact # - ansible facts: ansible-devices # ########## @@ -49,7 +49,7 @@ {% set device_map = [] %} {% set av_dev = (available_devices | dict2items) %} {% set assigned_dev = [] %} - {% for fs in sap_storage_setup_definition -%} + {% for fs in sap_storage_setup_new_mounts_fact -%} {% set matching_dev = [] -%} {%- if fs.disk_size is defined @@ -88,7 +88,7 @@ # This task combines information to create a mapping list of devices to filesystems. # Sources: -# - Extravars definition: sap_storage_setup_definition +# - sap_storage_setup_new_mounts_fact derived from extravars: sap_storage_setup_definition # - Ansible host facts: hostvars[host_node].ansible_devices - name: SAP Storage Setup - Set fact for device to filesystem mapping ansible.builtin.set_fact: @@ -121,7 +121,7 @@ {%- endif %} {{ lvopts | join(' ') }} - loop: "{{ sap_storage_setup_definition }}" + loop: "{{ sap_storage_setup_new_mounts_fact }}" loop_control: label: "{{ map_item.name }}" loop_var: map_item From 5bb070d25d0bdbda0c5b3ca4b0e5886cf97d467f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 14:32:49 +0200 Subject: [PATCH 092/179] sap_storage_setup: fix: typo and swap include --- .../tasks/generic_tasks/configure_multipathing.yml | 3 ++- .../generic_tasks/map_single_disks_to_filesystems.yml | 4 +++- roles/sap_storage_setup/tasks/main.yml | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml index dd475bd7e..7274b25d5 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_multipathing.yml @@ -67,7 +67,8 @@ # !! # This task assigns device names for each volume to be created. -# - reduced custom definition: sap_storage_setup_new_mounts_fact +# - sap_storage_setup_new_mounts_fact derived from extravars: sap_storage_setup_definition +# and is dynamically generated during runtime to list only unconfigured filesystems # - ansible facts: ansible-devices # DM devices are used for discovery, but the actual WWN will be used for diff --git a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml index cd10daa51..21e23785d 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml @@ -31,7 +31,8 @@ ########## # This task assigns device names for each volume to be created. -# - definition of unconfigured filesystems: sap_storage_setup_new_mounts_fact +# - sap_storage_setup_new_mounts_fact derived from extravars: sap_storage_setup_definition +# and is dynamically generated during runtime to list only unconfigured filesystems # - ansible facts: ansible-devices # ########## @@ -89,6 +90,7 @@ # This task combines information to create a mapping list of devices to filesystems. # Sources: # - sap_storage_setup_new_mounts_fact derived from extravars: sap_storage_setup_definition +# and is dynamically generated during runtime to list only unconfigured filesystems # - Ansible host facts: hostvars[host_node].ansible_devices - name: SAP Storage Setup - Set fact for device to filesystem mapping ansible.builtin.set_fact: diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index a5c14df55..8e4fee565 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -34,8 +34,11 @@ - name: SAP Storage Setup - Determine which local filesystems are not configured yet when: - new_mounts_item.nfs_path is not defined - - new_mounts_item.mountpoint is defined - - new_mounts_item.mountpoint not in ansible_mounts | map(attribute=mount") + - ( + new_mounts_item.mountpoint is defined + and new_mounts_item.mountpoint not in ansible_mounts | map(attribute="mount") + ) + or new_mounts_item.filesystem_type == 'swap' ansible.builtin.set_fact: sap_storage_setup_new_mounts_fact: "{{ sap_storage_setup_new_mounts_fact | default([]) + [new_mounts_item] }}" loop: "{{ sap_storage_setup_definition }}" From a7674315072fbe267fabbadd935888601bd4cd0f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 14:48:12 +0200 Subject: [PATCH 093/179] sap_storage_setup: enh: only add swap config when current swap is smaller --- roles/sap_storage_setup/tasks/main.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 8e4fee565..0c4c099e5 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -38,7 +38,11 @@ new_mounts_item.mountpoint is defined and new_mounts_item.mountpoint not in ansible_mounts | map(attribute="mount") ) - or new_mounts_item.filesystem_type == 'swap' + or + ( + new_mounts_item.filesystem_type == 'swap' + and ansible_swaptotal_mb > new_mounts_item.disk_size * 1000 + ) ansible.builtin.set_fact: sap_storage_setup_new_mounts_fact: "{{ sap_storage_setup_new_mounts_fact | default([]) + [new_mounts_item] }}" loop: "{{ sap_storage_setup_definition }}" @@ -91,7 +95,7 @@ ansible.builtin.include_tasks: file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_swap.yml" when: - - '"swap" in sap_storage_setup_definition + - '"swap" in sap_storage_setup_new_mounts_fact | map(attribute="filesystem_type", default=sap_storage_setup_local_filesystem_type)' - name: SAP Storage Setup - Configure NFS filesystems From 0b6ae739f935693dd916a5adadb1ae2876486307 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 15:26:39 +0200 Subject: [PATCH 094/179] sap_storage_setup: fix: added fallback when fs device map is not already defined --- .../map_single_disks_to_filesystems.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml index 21e23785d..b3754bfde 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/map_single_disks_to_filesystems.yml @@ -56,7 +56,7 @@ {%- if fs.disk_size is defined and 'nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) and fs.swap_path is not defined - and fs.name not in filesystem_device_map | map(attribute="name") + and fs.name not in filesystem_device_map | default([]) | map(attribute="name") -%} {%- for dev in av_dev -%} @@ -93,6 +93,12 @@ # and is dynamically generated during runtime to list only unconfigured filesystems # - Ansible host facts: hostvars[host_node].ansible_devices - name: SAP Storage Setup - Set fact for device to filesystem mapping + when: + - map_item.nfs_path is not defined + - '"nfs" not in map_item.filesystem_type' + - map_item.swap_path is not defined + - filesystem_device_map is defined + - filesystem_device_map | length > 0 ansible.builtin.set_fact: volume_map: "{{ volume_map + volume_element }}" vars: @@ -127,12 +133,6 @@ loop_control: label: "{{ map_item.name }}" loop_var: map_item - when: - - map_item.nfs_path is not defined - - '"nfs" not in map_item.filesystem_type' - - map_item.swap_path is not defined - - filesystem_device_map is defined - - filesystem_device_map | length > 0 - name: SAP Storage Setup - Display local disk setup assignment From da3be97db5f24ca8acba25c0a33809508c0b81ef Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 15:53:47 +0200 Subject: [PATCH 095/179] sap_storage_setup: fix: enter swap config only when applicable --- roles/sap_storage_setup/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 0c4c099e5..134257a67 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -95,6 +95,7 @@ ansible.builtin.include_tasks: file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_swap.yml" when: + - sap_storage_setup_new_mounts_fact is defined - '"swap" in sap_storage_setup_new_mounts_fact | map(attribute="filesystem_type", default=sap_storage_setup_local_filesystem_type)' From 7d7ab80174d24fa48c4276fb369e3d5f5faafbad Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 8 Sep 2023 15:54:47 +0200 Subject: [PATCH 096/179] sap_install_media_detect: also extract SIGNATURE.SMF If this file is not present, the HANA installation will fail. So we need to extract this file already in this role. --- roles/sap_install_media_detect/tasks/organize_files.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index ea7075029..2ad021835 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -133,7 +133,11 @@ - line_item.extract_archive == 'y' - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files - ansible.builtin.shell: "set -o pipefail && {{ __sap_install_media_detect_fact_sapcar_path }} -xvf {{ line_item.file }} -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" + ansible.builtin.command: >- + {{ __sap_install_media_detect_fact_sapcar_path }} + -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} + -xvf {{ line_item.file }} + -manifest SIGNATURE.SMF args: chdir: "{{ __sap_install_media_detect_software_main_directory }}" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" From a7aa3b15a63b039c1ade120516283172bce541a1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 17:20:08 +0200 Subject: [PATCH 097/179] sap_storage_setup: fix: typo in calculation --- roles/sap_storage_setup/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 134257a67..3274adc3f 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -41,7 +41,7 @@ or ( new_mounts_item.filesystem_type == 'swap' - and ansible_swaptotal_mb > new_mounts_item.disk_size * 1000 + and ansible_swaptotal_mb < (new_mounts_item.disk_size * 1000) ) ansible.builtin.set_fact: sap_storage_setup_new_mounts_fact: "{{ sap_storage_setup_new_mounts_fact | default([]) + [new_mounts_item] }}" From dd15322fd221849d9c033ae1056beadf4ba29c83 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 8 Sep 2023 17:26:36 +0200 Subject: [PATCH 098/179] sap_storage_setup: enh: comment for the calculation --- roles/sap_storage_setup/tasks/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 3274adc3f..f981197f3 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -43,6 +43,8 @@ new_mounts_item.filesystem_type == 'swap' and ansible_swaptotal_mb < (new_mounts_item.disk_size * 1000) ) + # Calculating with 1000 instead of 1024, because existing swaptotal is likely to be + # reported at a slightly reduced size due to volume/filesystem metadata. ansible.builtin.set_fact: sap_storage_setup_new_mounts_fact: "{{ sap_storage_setup_new_mounts_fact | default([]) + [new_mounts_item] }}" loop: "{{ sap_storage_setup_definition }}" From 39e4d221b33e97fd2ec06d4ed99c7051c5ca3fc4 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sat, 9 Sep 2023 00:21:50 +0200 Subject: [PATCH 099/179] sap_install_media_detect: enable sapfile to also detect HANA export files with only digits as the file name --- roles/sap_install_media_detect/files/tmp/sapfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 82e1c8ec4..19c3b2094 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -281,6 +281,17 @@ for _FILE in "$@"; do /SAP SOLUTION MANAGER/{_sap_file_type="sap_export_solman_abap"} END{print _sap_file_type}') fi + if [[ ${_SAP_FILE_TYPE}. == "sap_unknown." && ${_GENERIC_FILE_TYPE}. == "zip." ]]; then + _SAP_FILE_TYPE=$(unzip -p "${_FILE}" META-INF/SAPMANIFEST.MF | awk ' + BEGIN{FS="="} + /total/{total=$NF} + /number/{number=$NF} + /product-id/{product_id=$NF; if (length(total)>0 && length(number)>0) { + a=substr(product_id, index(product_id, "4")+1, index(product_id, "1")-(index(product_id, "4")+1)); + if (a=="fnd" || a=="core")print "sap_export_s4hana" + } + }') + fi else _SAP_FILE_TYPE="sap_unknown" fi From 09feb21a3d9c6f79b8091abd4b2753836b44170c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 11 Sep 2023 12:05:27 +0200 Subject: [PATCH 100/179] sap_install_media_detect: use a different string in sapfile to detect S/4HANA Core export files --- roles/sap_install_media_detect/files/tmp/sapfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 19c3b2094..3cb3f1f39 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -283,14 +283,16 @@ for _FILE in "$@"; do fi if [[ ${_SAP_FILE_TYPE}. == "sap_unknown." && ${_GENERIC_FILE_TYPE}. == "zip." ]]; then _SAP_FILE_TYPE=$(unzip -p "${_FILE}" META-INF/SAPMANIFEST.MF | awk ' - BEGIN{FS="="} + BEGIN{FS="="; _sap_file_type="sap_unknown"} /total/{total=$NF} /number/{number=$NF} - /product-id/{product_id=$NF; if (length(total)>0 && length(number)>0) { - a=substr(product_id, index(product_id, "4")+1, index(product_id, "1")-(index(product_id, "4")+1)); - if (a=="fnd" || a=="core")print "sap_export_s4hana" + /product-id/{ + product_id=$NF; if (length(total)>0 && length(number)>0) { + a=substr(product_id, index(product_id, "4")+1, index(product_id, "1")-(index(product_id, "4")+1)); + if (a=="fnd" || a=="hanaop"){_sap_file_type="sap_export_s4hana"} } - }') + } + END{print _sap_file_type}') fi else _SAP_FILE_TYPE="sap_unknown" From 2cb7f6df3b9645700f85de8970f15139defbbeb6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 11 Sep 2023 13:35:17 +0200 Subject: [PATCH 101/179] sap_install_media_detect: Use the correct task names when setting SAPEXEDB file names --- .../tasks/find_files_after_extraction.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index d1d977ca2..a711ebf9b 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -197,7 +197,7 @@ - sap_install_media_detect_kernel_db == 'sapmaxdb' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length != 1 - - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for SAP MAXDB is present + - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP MAXDB ansible.builtin.set_fact: sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}" when: @@ -211,7 +211,7 @@ - sap_install_media_detect_kernel_db == 'oracledb' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length != 1 - - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for Oracle DB is present + - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for Oracle DB ansible.builtin.set_fact: sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}" when: @@ -225,7 +225,7 @@ - sap_install_media_detect_kernel_db == 'ibmdb2' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length != 1 - - name: SAP Install Media Detect - Find files after extraction - Fail if none, or more than one, SAPEXEDB file for IBM Db2 is present + - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for IBM Db2 ansible.builtin.set_fact: sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}" when: From 467339c6f3779c481c0f9822b322a63823f8ef15 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 11 Sep 2023 13:47:21 +0200 Subject: [PATCH 102/179] sap_install_media_detect: Use the previously working path names for IBM Db2 and SAP ASE --- .../tasks/set_global_vars.yml | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 2430ca5c4..5560301f2 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -61,18 +61,18 @@ - sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_db == "saphana" -# In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64' but for the role sap_swpm, we need -# to set the path which contains this directory, not the directory itself. +# In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64'. For the role sap_swpm, we need to set +# exactly this path - name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: - sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "ibmdb2" -# In 'find_files_after_extraction.yml', we search for a directory name which contains 'LINUX_X86_64' but for the role sap_swpm, we need +# In 'find_files_after_extraction.yml', we search for a directory name which contains 'LINUX_X86_64'. For the role sap_swpm, we need # to set the path which contains this directory, not the directory itself. For the Oracle client, we search for a directory name which -# contains 'OCL_LINUX_X86_64' but we also need the path which contains this directory. +# contains 'OCL_LINUX_X86_64'. For the role sap_swpm, we also need the path which contains this directory. - name: SAP Install Media Detect - Detection completed - Set facts for Oracle DB ansible.builtin.set_fact: sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_anydb_install_oracle Ansible Role @@ -81,12 +81,13 @@ ignore_errors: true when: sap_install_media_detect_db == "oracledb" -# In 'find_files_after_extraction.yml', we search for a directory which contains 'sybodbc' for the SAP ASE Client, but for the role -# sap_swpm, we need to set the path which contains this directory, not the directory itself. +# In 'find_files_after_extraction.yml', we search for a directory name which contains 'SYBASE_LINUX'. For the role sap_swpm, we need +# to set exactly this path. For the ASE client, we search for a directory which contains 'sybodbc'. For the role +# sap_swpm, we need to set exactly this path. - name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: - sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role - sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == "sapase" From a78decff41031b3b10e6a31a8a562a2ab1a4dddc Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 11 Sep 2023 14:24:03 +0200 Subject: [PATCH 103/179] sap_install_media_detect: use a different pattern for ASE client to get identical results to v.1.2.2 --- .../tasks/find_files_after_extraction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index a711ebf9b..053ad0aa3 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -89,8 +89,8 @@ ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" recurse: true - file_type: file - patterns: ".*sybodbc.*" + file_type: directory + patterns: "sybodbc" use_regex: true register: detect_directory_sapase_client_extracted when: sap_install_media_detect_db == "sapase" From 7a167567edf19e660979fed983866d1df4a1ac15 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 11 Sep 2023 22:37:26 +0200 Subject: [PATCH 104/179] sap_install_media_detect: use sap_swpm_download_basket for the S4HANA export files, use one level up for sap_swpm_cd_export_path --- roles/sap_install_media_detect/files/tmp/sapfile | 1 + roles/sap_install_media_detect/tasks/set_global_vars.yml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 3cb3f1f39..860e1bf8f 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -359,6 +359,7 @@ for _FILE in "$@"; do _EXTRACT="n" ;; sap_export_s4hana|sap_export_bw4hana) + _TARGET_DIRECTORY="sap_swpm_download_basket" _EXTRACTION_DIRECTORY="none" _EXTRACT="n" ;; diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 5560301f2..a39469ff5 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -153,13 +153,13 @@ - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "saps4hana" - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: - sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path }}" # for sap_swpm Ansible Role + sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_export == "sapbw4hana" From 58c5eec8516100e03a55daeccf2425b3fe2fd148 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 12 Sep 2023 12:02:20 +0200 Subject: [PATCH 105/179] sap_storage_setup: fix: correction of comments --- roles/sap_storage_setup/tasks/main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index f981197f3..d9e3b26ad 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -28,9 +28,6 @@ # Create a list of elements from {{ sap_storage_setup_definition }} for all # mountpoint elements that are not already reported as mounted in ansible facts. -# NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) -# Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map - - name: SAP Storage Setup - Determine which local filesystems are not configured yet when: - new_mounts_item.nfs_path is not defined @@ -91,7 +88,8 @@ file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" -# NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) +# NOTE: The "default" in the conditional of this task requires +# Jinja2 version >= 2.11.0 (released January 2020) # Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map - name: SAP Storage Setup - Configure swap ansible.builtin.include_tasks: From 23ad550980b41e7378544cfbb170b668948b44db Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 12 Sep 2023 13:56:29 +0200 Subject: [PATCH 106/179] sap_ha_pacemaker_cluster: enh: ascs/ers HA post-installation config --- .../configure_netweaver_postinstallation.yml | 97 +++++++++++++++++++ roles/sap_ha_pacemaker_cluster/tasks/main.yml | 10 ++ 2 files changed, 107 insertions(+) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml new file mode 100644 index 000000000..75f3fd217 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml @@ -0,0 +1,97 @@ +--- +# 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 units" + ansible.builtin.service: + name: "{{ instance_srv_item }}" + enabled: + 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 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 87dfb650f..05893b153 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -186,6 +186,7 @@ # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) # https://github.com/linux-system-roles/ha_cluster#ha_cluster_resource_defaults # Keeping separate for compatibility with older versions of the ha_cluster role. + # TODO: Change resource defaults update to "ha_cluster" native syntax. - name: "SAP HA Install Pacemaker - Check resource defaults" ansible.builtin.command: cmd: | @@ -217,6 +218,15 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + - name: "SAP HA Install Pacemaker - Include NetWeaver ASCS/ERS post installation" + ansible.builtin.include_tasks: + file: configure_netweaver_postinstallation.yml + apply: + tags: nwas_postinst + tags: nwas_postinst + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'ascs_ers') | length > 0 + ### END OF BLOCK: prerequisite changes and cluster setup # Save all the constructed cluster parameters into a vars file. From ef0a3c2841fb5430007d53309c2055ba8e97eef5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 12 Sep 2023 14:26:00 +0200 Subject: [PATCH 107/179] sap_ha_pacemaker_cluster: fix: missing service state and nic var --- .../tasks/configure_netweaver_postinstallation.yml | 2 +- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 2 +- .../platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml index 75f3fd217..e23612358 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml @@ -64,7 +64,7 @@ - name: "SAP HA Pacemaker - (systemd) Disable ASCS/ERS instance units" ansible.builtin.service: name: "{{ instance_srv_item }}" - enabled: + enabled: false loop: "{{ sap_ha_pacemaker_cluster_instance_services_fact }}" loop_control: loop_var: instance_srv_item diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 05893b153..8d7f4e92d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -225,7 +225,7 @@ tags: nwas_postinst tags: nwas_postinst when: - - sap_ha_pacemaker_cluster_host_type | select('search', 'ascs_ers') | length > 0 + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap') | length > 0 ### END OF BLOCK: prerequisite changes and cluster setup diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 91dcad871..7cec51de1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -58,7 +58,7 @@ - name: ip value: "{{ vip_list_item.value }}" - name: interface - value: "{{ sap_ha_pacemaker_cluster_aws_vip_client_interface }}" + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" - name: routing_table value: "{{ sap_ha_pacemaker_cluster_aws_vip_update_rt | join(',') }}" when: From 7787ddc2da75e7e0507332e4dad5729dbc75531b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 12 Sep 2023 18:52:41 +0200 Subject: [PATCH 108/179] sap_ha_pacemaker_cluster: feat: multi-NIC first tasks --- roles/sap_ha_pacemaker_cluster/README.md | 2 +- .../defaults/main.yml | 2 +- .../meta/argument_specs.yml | 2 +- .../construct_vars_vip_resources_default.yml | 4 +++ .../tasks/include_vars_common.yml | 17 ++++++++++ ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 4 +++ ...s_vip_resources_cloud_ibmcloud_powervs.yml | 4 +++ ...ct_vars_vip_resources_cloud_msazure_vm.yml | 4 +++ ...uct_vars_vip_resources_hyp_ibmpower_vm.yml | 4 +++ roles/sap_ha_pacemaker_cluster/vars/main.yml | 31 +++---------------- 10 files changed, 44 insertions(+), 30 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 6cf0c731a..eb5a60660 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -427,9 +427,9 @@ sap_ha_pacemaker_cluster_resource_defaults: ### sap_ha_pacemaker_cluster_vip_client_interface - _Type:_ `str` -- _Default:_ `eth0` OS device name of the network interface to use for the Virtual IP configuration.
+When there is only one interface on the system, its name will be used by default.
### sap_ha_pacemaker_cluster_vip_hana_primary_ip_address diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 9b208d45a..a95e171b8 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -98,7 +98,7 @@ sap_ha_pacemaker_cluster_fence_options: ### VIP resource default patterns sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" -sap_ha_pacemaker_cluster_vip_client_interface: eth0 +sap_ha_pacemaker_cluster_vip_client_interface: '' # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index a2035e47a..5a394c0ae 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -325,9 +325,9 @@ argument_specs: # type: str sap_ha_pacemaker_cluster_vip_client_interface: - default: eth0 description: - OS device name of the network interface to use for the Virtual IP configuration. + - When there is only one interface on the system, its name will be used by default. required: false type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 5217de9e8..3d680387f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -13,5 +13,9 @@ - attrs: - name: ip value: "{{ vip_list_item.value | quote }}" + - name: cidr_netmask + value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - __sap_ha_pacemaker_cluster_vip_resource_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index ab3e1bb74..eaac65324 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -7,6 +7,23 @@ ansible.builtin.setup: gather_subset: hardware,interfaces +# Multi-NIC: +# Find out if there is more than one interface present, this will +# be used for determining the target NIC for VIP configurations. +- name: "SAP HA Prepare Pacemaker - Set multi-NIC when more than one interface is found" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_nic_multi_bool: true + when: + - ansible_interfaces | length > 2 + +- name: "SAP HA Pacemaker - Set interface name and netmask when only one interface is present" + ansible.builtin.set_fact: + sap_ha_pacemaker_cluster_vip_client_interface: "{{ ansible_default_ipv4.interface }}" + sap_ha_pacemaker_cluster_vip_cidr_netmask: "{{ ansible_default_ipv4.prefix }}" + when: + - not __sap_ha_pacemaker_cluster_nic_multi_bool + - sap_ha_pacemaker_cluster_vip_client_interface == '' + # Include vars files based on the environment. # Respect order for potential variable precedence. - name: "SAP HA Prepare Pacemaker - Include environment specific variables" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 7cec51de1..4bd66f5bd 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -12,6 +12,10 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml index da995eae2..917ef21b1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml @@ -12,6 +12,10 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index 34982f29b..4d1d5c4ea 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -12,6 +12,10 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml index da995eae2..917ef21b1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml @@ -12,6 +12,10 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + - name: cidr_netmask + value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" + - name: nic + value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index c96a08fbf..27b93aee8 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -27,37 +27,14 @@ __sap_ha_pacemaker_cluster_required_facts: # - virtualization_role # subset: virtual # - virtualization_type # subset: virtual +# By default assume non-multi-NIC configuration. +# This is automatically adjusted during preparation tasks. +__sap_ha_pacemaker_cluster_nic_multi_bool: false + # Define empty parameters to avoid undefined input variables. # The arguments_spec check complains. # The actual values must be empty, they are set by various tasks! -__sap_ha_pacemaker_cluster_hana_primary_synonyms: - - primary - - hana_primary - - promoted - - rw - -__sap_ha_pacemaker_cluster_hana_secondary_synonyms: - - secondary - - hana_secondary - - unpromoted - - ro - -__sap_ha_pacemaker_cluster_nwas_ascs_synonyms: - - ascs - - nwas_ascs - - nwas_abap_ascs - -__sap_ha_pacemaker_cluster_nwas_ers_synonyms: - - ers - - nwas_ers - - nwas_abap_ers - -__sap_ha_pacemaker_cluster_nwas_pas_synonyms: - - pas - - nwas_pas - - nwas_abap_pas - # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' __sap_ha_pacemaker_cluster_supported_platforms: From d89fe8109a537df72368494efe9b36598285f920 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 12 Sep 2023 19:08:48 +0200 Subject: [PATCH 109/179] sap_ha_pacemaker_cluster: enh: treat cidr_netmask separately --- .../sap_ha_pacemaker_cluster/tasks/include_vars_common.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index eaac65324..3ca69983b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -16,14 +16,17 @@ when: - ansible_interfaces | length > 2 -- name: "SAP HA Pacemaker - Set interface name and netmask when only one interface is present" +- name: "SAP HA Pacemaker - Set interface name when only one interface is present" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_vip_client_interface: "{{ ansible_default_ipv4.interface }}" - sap_ha_pacemaker_cluster_vip_cidr_netmask: "{{ ansible_default_ipv4.prefix }}" when: - not __sap_ha_pacemaker_cluster_nic_multi_bool - sap_ha_pacemaker_cluster_vip_client_interface == '' +- name: "SAP HA Pacemaker - Set cidr netmask of the defined interface" + ansible.builtin.set_fact: + sap_ha_pacemaker_cluster_vip_cidr_netmask: "{{ vars['ansible_' + sap_ha_pacemaker_cluster_vip_client_interface].ipv4.prefix }}" + # Include vars files based on the environment. # Respect order for potential variable precedence. - name: "SAP HA Prepare Pacemaker - Include environment specific variables" From f14c378c00defc6984f30505d93554a813e3c3a7 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 13 Sep 2023 10:12:06 +0200 Subject: [PATCH 110/179] sap_ha_pacemaker_cluster: enh: verify user-defined NIC and fail early --- .../tasks/validate_input_parameters.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 2ae0ed659..5c5f5a58d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -28,3 +28,11 @@ or sap_ha_pacemaker_cluster_netweaver_sid is defined - sap_ha_pacemaker_cluster_hana_sid | length > 0 or sap_ha_pacemaker_cluster_netweaver_sid | length > 0 + + +# Verify that the user-defined VIP NIC device name exists on the system. +- name: "SAP HA Pacemaker - Verify that the custom NIC name exists" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_client_interface in ansible_interfaces + fail_msg: "The defined 'sap_ha_pacemaker_cluster_vip_client_interface' does not exist on this system!" From cd1f62b891550beaf301ba20c7f3101466349af3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 13 Sep 2023 15:01:54 +0200 Subject: [PATCH 111/179] sap_ha_pacemaker_cluster: enh: improved SID and VIP/NIC input validation --- .../tasks/include_vars_common.yml | 7 +- .../tasks/validate_input_parameters.yml | 76 ++++++++++++++----- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index 3ca69983b..68e5fbac8 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -10,22 +10,25 @@ # Multi-NIC: # Find out if there is more than one interface present, this will # be used for determining the target NIC for VIP configurations. +# Assumption: The local loopback "lo" is always in the list. - name: "SAP HA Prepare Pacemaker - Set multi-NIC when more than one interface is found" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_nic_multi_bool: true when: - ansible_interfaces | length > 2 -- name: "SAP HA Pacemaker - Set interface name when only one interface is present" +- name: "SAP HA Prepare Pacemaker - Set interface name when only one interface is present" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_vip_client_interface: "{{ ansible_default_ipv4.interface }}" when: - not __sap_ha_pacemaker_cluster_nic_multi_bool - sap_ha_pacemaker_cluster_vip_client_interface == '' -- name: "SAP HA Pacemaker - Set cidr netmask of the defined interface" +- name: "SAP HA Prepare Pacemaker - Set cidr netmask of the defined interface" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_vip_cidr_netmask: "{{ vars['ansible_' + sap_ha_pacemaker_cluster_vip_client_interface].ipv4.prefix }}" + when: + - sap_ha_pacemaker_cluster_vip_client_interface != '' # Include vars files based on the environment. # Respect order for potential variable precedence. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 5c5f5a58d..dd946859c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -1,38 +1,80 @@ --- # The SAP ID must follow a strict format and not use reserved special values # TODO: This check may be better placed in a SAP role earlier in the chain... -- name: "SAP HA Prepare Pacemaker - Validate SAP System ID (SAP HANA)" +- name: "SAP HA Prepare Pacemaker - (SAP HANA) Validate SAP System ID" ansible.builtin.assert: that: - sap_ha_pacemaker_cluster_hana_sid | length == 3 - sap_ha_pacemaker_cluster_hana_sid not in __sap_sid_prohibited + fail_msg: | + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires 'sap_ha_pacemaker_cluster_hana_sid' to be defined! when: - - "'hana' in sap_ha_pacemaker_cluster_host_type" - - sap_ha_pacemaker_cluster_hana_sid is defined - - sap_ha_pacemaker_cluster_hana_sid | length > 0 + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 -- name: "SAP HA Prepare Pacemaker - Validate SAP System ID (SAP Netweaver)" +- name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP System ID" ansible.builtin.assert: that: - sap_ha_pacemaker_cluster_netweaver_sid | length == 3 - sap_ha_pacemaker_cluster_netweaver_sid not in __sap_sid_prohibited + fail_msg: | + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires 'sap_ha_pacemaker_cluster_netweaver_sid' to be defined! when: - - "'nwas' in sap_ha_pacemaker_cluster_host_type" - - sap_ha_pacemaker_cluster_netweaver_sid is defined - - sap_ha_pacemaker_cluster_netweaver_sid | length > 0 + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 -- name: "SAP HA Prepare Pacemaker - Verify that a SID is defined" + +# Verify that the user-defined VIP NIC device name exists on the system. +- name: "SAP HA Prepare Pacemaker - Verify that the custom NIC name exists" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_hana_sid is defined - or sap_ha_pacemaker_cluster_netweaver_sid is defined - - sap_ha_pacemaker_cluster_hana_sid | length > 0 - or sap_ha_pacemaker_cluster_netweaver_sid | length > 0 + - sap_ha_pacemaker_cluster_vip_client_interface in ansible_interfaces + fail_msg: "The interface '{{ sap_ha_pacemaker_cluster_vip_client_interface }}' does not exist on this system!" + when: + - sap_ha_pacemaker_cluster_vip_client_interface | length > 0 +# Verify that an IP address for the VIP of the defined host type is defined. +- name: "SAP HA Prepare Pacemaker - (HANA primary) Verify that the VIP is defined" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address is defined + - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_hana_primary_ip_address' is not defined." + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 -# Verify that the user-defined VIP NIC device name exists on the system. -- name: "SAP HA Pacemaker - Verify that the custom NIC name exists" +- name: "SAP HA Prepare Pacemaker - (NetWeaver ASCS) Verify that the VIP is defined" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_vip_client_interface in ansible_interfaces - fail_msg: "The defined 'sap_ha_pacemaker_cluster_vip_client_interface' does not exist on this system!" + - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address is defined + - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address' is not defined." + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_ascs') | length > 0 + +- name: "SAP HA Prepare Pacemaker - (NetWeaver ERS) Verify that the VIP is defined" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address is defined + - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address' is not defined." + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_ascs_ers') | length > 0 + +- name: "SAP HA Prepare Pacemaker - (NetWeaver PAS) Verify that the VIP is defined" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address is defined + - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address' is not defined." + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_pas') | length > 0 + +- name: "SAP HA Prepare Pacemaker - (NetWeaver AAS) Verify that the ERS VIP is defined" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address is defined + - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address' is not defined." + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_pas_aas') | length > 0 From c94ed5c3303c22ea1bdb013d0f85187acfa2537f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 13 Sep 2023 15:16:56 +0200 Subject: [PATCH 112/179] sap_ha_pacemaker_cluster: validation improvements --- .../tasks/validate_input_parameters.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index dd946859c..6d77a1c67 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -1,6 +1,5 @@ --- # The SAP ID must follow a strict format and not use reserved special values -# TODO: This check may be better placed in a SAP role earlier in the chain... - name: "SAP HA Prepare Pacemaker - (SAP HANA) Validate SAP System ID" ansible.builtin.assert: that: @@ -23,8 +22,21 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 +# NIC definition validation +- name: "SAP HA Prepare Pacemaker - Verify that a custom NIC name is defined when multiple NICs exist" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_vip_client_interface is defined + - sap_ha_pacemaker_cluster_vip_client_interface | length > 0 + fail_msg: + Multiple interfaces are found on the system. + + {{ ansible_interfaces | to_nice_yaml }} + + In this case 'sap_ha_pacemaker_cluster_vip_client_interface' must be defined. + when: + - ansible_interfaces | length > 2 -# Verify that the user-defined VIP NIC device name exists on the system. - name: "SAP HA Prepare Pacemaker - Verify that the custom NIC name exists" ansible.builtin.assert: that: @@ -33,7 +45,7 @@ when: - sap_ha_pacemaker_cluster_vip_client_interface | length > 0 -# Verify that an IP address for the VIP of the defined host type is defined. +# VIP definition validation - name: "SAP HA Prepare Pacemaker - (HANA primary) Verify that the VIP is defined" ansible.builtin.assert: that: From e61368469124e09927e23e9294285ce7be778d58 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 13 Sep 2023 15:56:15 +0200 Subject: [PATCH 113/179] sap_ha_pacemaker_cluster: remove cidr_netmask from IPaddr2 resource definitions and leave it to the agent --- .../tasks/construct_vars_vip_resources_default.yml | 2 -- roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml | 5 ----- .../construct_vars_vip_resources_cloud_aws_ec2_vs.yml | 2 -- .../construct_vars_vip_resources_cloud_ibmcloud_powervs.yml | 2 -- .../construct_vars_vip_resources_cloud_msazure_vm.yml | 2 -- .../construct_vars_vip_resources_hyp_ibmpower_vm.yml | 2 -- 6 files changed, 15 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 3d680387f..98a49b57c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -13,8 +13,6 @@ - attrs: - name: ip value: "{{ vip_list_item.value | quote }}" - - name: cidr_netmask - value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" - name: nic value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml index 68e5fbac8..f132a6738 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_common.yml @@ -24,11 +24,6 @@ - not __sap_ha_pacemaker_cluster_nic_multi_bool - sap_ha_pacemaker_cluster_vip_client_interface == '' -- name: "SAP HA Prepare Pacemaker - Set cidr netmask of the defined interface" - ansible.builtin.set_fact: - sap_ha_pacemaker_cluster_vip_cidr_netmask: "{{ vars['ansible_' + sap_ha_pacemaker_cluster_vip_client_interface].ipv4.prefix }}" - when: - - sap_ha_pacemaker_cluster_vip_client_interface != '' # Include vars files based on the environment. # Respect order for potential variable precedence. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 4bd66f5bd..c34cfac8f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -12,8 +12,6 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" - - name: cidr_netmask - value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" - name: nic value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml index 917ef21b1..97b662d67 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml @@ -12,8 +12,6 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" - - name: cidr_netmask - value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" - name: nic value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index 4d1d5c4ea..244532aeb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -12,8 +12,6 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" - - name: cidr_netmask - value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" - name: nic value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml index 917ef21b1..97b662d67 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml @@ -12,8 +12,6 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" - - name: cidr_netmask - value: "{{ sap_ha_pacemaker_cluster_vip_cidr_netmask }}" - name: nic value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: From 3eeb1737698cd3d5bc49387b4d9e63f87c4735d6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 15 Sep 2023 12:01:37 +0200 Subject: [PATCH 114/179] sap_install_media_detect: move extracted SIGNATURE.SMF into the correct subdir for HANA non-export files --- .../tasks/organize_files.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 2ad021835..cc7019ad5 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -148,6 +148,18 @@ - line_item.archive_type == 'sapcar' - line_item.extract_archive == 'y' +- name: SAP Install Media Detect - Organize all files - Move SIGNATURE.SMF into subdir for SAP HANA non-export files + ansible.builtin.shell: | + extracted_dir=$(ls -d */) + mv SIGNATURE.SMF ${extracted_dir} + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - line_item.sap_file_type is search("saphana") + - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: src: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }}" From 66254448c496e271250ae1a59387da99c65b273b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 15 Sep 2023 22:55:28 +0200 Subject: [PATCH 115/179] sap_swpm: Improve the detection of variables ... from the inifile.params file, using only awk commands --- .../sap_swpm/tasks/swpm/detect_variables.yml | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/roles/sap_swpm/tasks/swpm/detect_variables.yml b/roles/sap_swpm/tasks/swpm/detect_variables.yml index a73931037..59c08ad8c 100644 --- a/roles/sap_swpm/tasks/swpm/detect_variables.yml +++ b/roles/sap_swpm/tasks/swpm/detect_variables.yml @@ -2,68 +2,70 @@ # Detect Product ID - name: SAP SWPM - Detect Product ID - ansible.builtin.shell: | - set -o pipefail && sed -n '3p' {{ sap_swpm_tmpdir.path }}/inifile.params | awk 'NF{print $(NF-1)}' | tr -d \' + ansible.builtin.command: | + awk 'BEGIN{IGNORECASE=1;a=0} + /Product ID/&&a==0{a=1; gsub ("#", ""); gsub ("\047", ""); product_id=$NF} + END{print product_id}' {{ sap_swpm_tmpdir.path }}/inifile.params register: sap_swpm_inifile_product_id_detect changed_when: false # Set fact for product id -- name: Set SAP product ID +- name: SAP SWPM - Set SAP product ID ansible.builtin.set_fact: sap_swpm_product_catalog_id: "{{ sap_swpm_inifile_product_id_detect.stdout }}" -- name: Display SAP product ID +- name: SAP SWPM - Display SAP product ID ansible.builtin.debug: msg: - "Product ID is {{ sap_swpm_product_catalog_id }}" # Detect Software Path - name: SAP SWPM - Detect Software Path - ansible.builtin.shell: | - set -o pipefail && cat {{ sap_swpm_tmpdir.path }}/inifile.params | grep archives.downloadBasket | awk '{ print $3 }' + ansible.builtin.command: | + awk '!/^#/&&/archives.downloadBasket/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params register: sap_swpm_inifile_software_path changed_when: false # Set fact for software path -- name: Set Software Path +- name: SAP SWPM - Set Software Path ansible.builtin.set_fact: sap_swpm_software_path: "{{ sap_swpm_inifile_software_path.stdout }}" -- name: Display SAP SID +- name: SAP SWPM - Display Software Path ansible.builtin.debug: msg: - "Software path is {{ sap_swpm_software_path }}" # Detect SID - name: SAP SWPM - Detect SID - ansible.builtin.shell: | - set -o pipefail && cat {{ sap_swpm_tmpdir.path }}/inifile.params | grep NW_GetSidNoProfiles.sid | awk '{ print $3 }' + ansible.builtin.command: | + awk '!/^#/&&/NW_GetSidNoProfiles.sid/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params register: sap_swpm_inifile_sid changed_when: false # Set fact for SID -- name: Set SID +- name: SAP SWPM - Set SID ansible.builtin.set_fact: sap_swpm_sid: "{{ sap_swpm_inifile_sid.stdout }}" -- name: Display SAP SID +- name: SAP SWPM - Display SAP SID ansible.builtin.debug: msg: - "SAP SID {{ sap_swpm_sid }}" # Detect FQDN - name: SAP SWPM - Detect FQDN - ansible.builtin.shell: | - set -o pipefail && cat {{ sap_swpm_tmpdir.path }}/inifile.params | grep NW_getFQDN.FQDN | awk '{ print $3 }' + ansible.builtin.command: | + awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params register: sap_swpm_inifile_fqdn changed_when: false # Set fact for FQDN -- name: Set FQDN +- name: SAP SWPM - Set FQDN ansible.builtin.set_fact: sap_swpm_fqdn: "{{ sap_swpm_inifile_fqdn.stdout }}" -- name: Display FQDN +- name: SAP SWPM - Display FQDN ansible.builtin.debug: msg: - "SAP fqdn {{ sap_swpm_fqdn }}" From bf8f4e6bffd270dd25b47c05e139e5612d05e7fa Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 18 Sep 2023 15:15:53 +0200 Subject: [PATCH 116/179] sap_install_media_detect: add the task flow of the role to README.md --- roles/sap_install_media_detect/README.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index d99460c21..22823bdca 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -16,6 +16,27 @@ RAR files. See the comments and examples for the RAR file handling in `defaults/ when the role was run, it will remain enabled. If the EPEL repo was not present, the associated GPG key will be removed and the EPEL repo will be disabled as the last task. +## Execution Flow + +- At the beginning of the execution of the role, a new tool `sapfile` is pushed to a temporary directory on the managed node. +- Also a package which contains a command for extracting and listing content of files of type `RAR` is installed. +- The next step is to check if source and/or target directories exist. If role parameter `sap_install_media_detect_target_directory` is defined, files will later be copied from `sap_install_media_detect_source_directory`. This is the `remote_dir` case. +- If the system on which the `sap_install_media_detect_source_directory` is not writable, the role would normally fail because one or both of the following conditions are not met: + - The SAPCAR EXE file is not executable. + - There are one or more `ZIP` or `RAR` files without extension. +- In this `remote_dir` case, to make sure the role does not fail, it needs to be run first on the node on which `sap_install_media_detect_source_directory` is writable, with role parameter `sap_install_media_detect_file_server_only` set to `true` so the role will not perform and further file detection activities. +- After the SAPCAR EXE file is executable and there are no more `ZIP` or `RAR` files without extension, the role can be called on a managed node where `sap_install_media_detect_source_directory` is not writable. +- A new list of all files with the correct final file names will then be created, and for each of the files, the SAP file types are determined using the `sapfile` tool, either using the file names or - if this information is not sufficient - from information inside the file. +- We then assert that there is at least (or exactly, depending on the file type) one file available for each of the `sap_install_media_detect_*` parameters. For example, if `sap_install_media_detect_kernel_db` is set to `saphana`, then there must be one SAP Kernel DB dependent file for SAP HANA. +- In case of `remote_dir`, the next step is to copy all files from `sap_install_media_detect_source_directory` to `sap_install_media_detect_target_directory`. +- Then we extract files which are configured in `sapfile` to be extracted, and copy or move files which are configured in `sapfile` to be copied or moved. Certain files like SAPCAR*.EXE and SAP Host Agent will be copied to two different directories. +- Once all necessary files have been extracted and all files are copied or moved to where we want them to be, we are using the Ansible find module to identify the different file types by using file or directory name patterns. +- The last step is to fill all required `sap_swpm` parameters from the result of the previous find step, and display all the variables. + +## Variables and Parameters + +See the file `defaults/main.yml`. + ## Dependencies This role does not depend on any other Ansible Role. @@ -30,7 +51,7 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_install_media_detect_provide_sapfile_utility `: Provides the sapfile utility on the managed node. This tool is required for determining the SAP file type. - tag `sap_install_media_detect_create_file_list_phase_1`: Create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. - tag `sap_install_media_detect_create_file_list_phase_2`: Create a final list of all required files in `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) -- tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files in to the target directories if specified by the output of the sapfile command. +- tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files into the target directories if specified by the output of the sapfile command. - tag `sap_install_media_detect_find_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. - tag `sap_install_media_detect_set_global_vars`: Set all final variables for later use by Ansible roles or tasks. From b30918122918e788cf25fda136b539af8fd0fcb0 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 18 Sep 2023 16:14:15 +0200 Subject: [PATCH 117/179] sap_install_media_detect: detaults/main.yml: fix variable in comment, add examples and explanations --- .../defaults/main.yml | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 7a118b4fd..8e73b1e32 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -37,7 +37,7 @@ sap_install_media_detect_rar_extract: '/usr/bin/unrar x' # Fully qualified path to an additional argument to the program for extracting RAR files, for specifying the directory into # which the archive is to be extracted. Needs to be empty or start with a space character. # If sap_install_media_detect_rar_package is set to 'EPEL', this variable is not used. -#sap_install_media_detect_rar_extract_argument: ' -o' +#sap_install_media_detect_rar_extract_directory_argument: ' -o' sap_install_media_detect_rar_extract_directory_argument: '' # Directory where the SAP software is located @@ -63,22 +63,31 @@ sap_install_media_detect_move_or_copy_archives: true # By default, the presence of at least one file for each file type according to the configured role parameters is asserted. Set the # following parameter to 'false' to skip this step. -#sap_install_media_detect_assert_after_sapfile: false - -# saphana, sapase, sapmaxdb, oracledb, ibmdb2 -#sap_install_media_detect_db: 'saphana' -sap_install_media_detect_db: '' +sap_install_media_detect_assert_after_sapfile: true +# Typical parameter settings for SAP S/4HANA: +sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true sap_install_media_detect_igs: true sap_install_media_detect_kernel: true -# saphana, sapase, sapmaxdb, oracledb, ibmdb2 -#sap_install_media_detect_kernel_db: 'sapmaxdb' +#sap_install_media_detect_kernel_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +# (only necessary if there is more than one SAPEXEDB file in the source directory) sap_install_media_detect_webdisp: false - -# saps4hana, sapbw4hana, sapecc, sapecc_ides, sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java -sap_install_media_detect_export: +sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides, +# sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java + +# Typical parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database: +#sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +#sap_install_media_detect_swpm: true +#sap_install_media_detect_hostagent: true +#sap_install_media_detect_igs: true +#sap_install_media_detect_kernel: true +#sap_install_media_detect_kernel_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +# (only necessary if there is more than one SAPEXEDB file in the source directory) +#sap_install_media_detect_webdisp: false +#sap_install_media_detect_export: 'sapecc' # saps4hana, sapbw4hana, sapecc, sapecc_ides, +# sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java # e.g. /db_backup sap_install_media_detect_backup_directory: From 6ace92313bd16eb17f60f31f0889eaede685c078 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 18 Sep 2023 20:15:01 +0100 Subject: [PATCH 118/179] sap_ha_pacemaker_cluster: fix ibm powervm stonith --- .../platform/ascertain_platform_type.yml | 14 +-------- .../tasks/platform/include_vars_platform.yml | 18 +++++++++++ .../register_sysinfo_hyp_ibmpower_vm.yml | 30 +++++++++++++++++++ 3 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml 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..575683ecd --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml @@ -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 From 81f3c36df3af06143cec026442d918fd458da398 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 18 Sep 2023 20:20:17 +0100 Subject: [PATCH 119/179] sap_ha_pacemaker_cluster: improve comment for ibm power hmc mtms --- .../tasks/platform/register_sysinfo_hyp_ibmpower_vm.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 index 575683ecd..f703571ec 100644 --- 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 @@ -5,7 +5,9 @@ # 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 +# 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) From 75e3216d88c202297f817c754c4cf9fcd1f20f6c Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 18 Sep 2023 20:34:31 +0100 Subject: [PATCH 120/179] sap_ha_pacemaker_cluster: fix ibm power vars --- .../vars/platform_hyp_ibmpower_vm.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 From 8e17253a84f8a8d679d6a72ed18cbac2c3f9958a Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:02:35 +0100 Subject: [PATCH 121/179] sap_ha_pacemaker_cluster: add ibm powervm vars reference --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 From 729e620cfb80bd49bebfb10ab24f6db907fc8ea6 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 19 Sep 2023 14:27:43 +0200 Subject: [PATCH 122/179] sap_swpm, sap_install_media_detect, playbooks: replace sap_swpm_cd_rdms_path by sap_swpm_cd_rdbms_path --- ...sap-swpm-default-mode-solman-hana-abap-onehost-install.yml | 2 +- ...sap-swpm-default-mode-solman-hana-java-onehost-install.yml | 2 +- roles/sap_install_media_detect/tasks/set_global_vars.yml | 4 ++-- roles/sap_swpm/defaults/main.yml | 2 +- roles/sap_swpm/templates/configfile.j2 | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml index d1d9c10e0..2840f34cb 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml @@ -45,7 +45,7 @@ sap_swpm_cd_export_pt1_path: /software/download_basket/SOLMAN/51054655_1_DIR sap_swpm_cd_export_pt2_path: /software/download_basket/SOLMAN/51054655_2_DIR sap_swpm_cd_language_path: /software/download_basket/SOLMAN/51054655_3_DIR sap_swpm_cd_java_path: /software/download_basket/SOLMAN/51054655_4_DIR -sap_swpm_cd_rdms_path: /software/download_basket/SAPINST/SAP_HANA/51054623 +sap_swpm_cd_rdbms_path: /software/download_basket/SAPINST/SAP_HANA/51054623 # NW Passwords sap_swpm_master_password: "NewPass$321" diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml index 6014fe636..7bc9bd3e8 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml @@ -47,7 +47,7 @@ sap_swpm_cd_export_pt1_path: /software/download_basket/SOLMAN/51054655_1_DIR sap_swpm_cd_export_pt2_path: /software/download_basket/SOLMAN/51054655_2_DIR sap_swpm_cd_language_path: /software/download_basket/SOLMAN/51054655_3_DIR sap_swpm_cd_java_path: /software/download_basket/SOLMAN/51054655_4_DIR -sap_swpm_cd_rdms_path: /software/download_basket/SAPINST/SAP_HANA/51054623 +sap_swpm_cd_rdbms_path: /software/download_basket/SAPINST/SAP_HANA/51054623 # NW Passwords sap_swpm_master_password: "NewPass$321" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index a39469ff5..a52c16ed5 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -55,7 +55,7 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm ansible.builtin.set_fact: - sap_swpm_cd_rdms_path: "{{ sap_hana_client_path.files[0].path }}/" # for sap_swpm Ansible Role + sap_swpm_cd_rdbms_path: "{{ sap_hana_client_path.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives @@ -204,7 +204,7 @@ - sap_swpm_cd_oracle_path - sap_swpm_cd_sapase_path - sap_swpm_cd_sapmaxdb_path - - sap_swpm_cd_rdms_path + - sap_swpm_cd_rdbms_path - sap_swpm_cd_ibmdb2_client_path - sap_swpm_cd_oracle_client_path - sap_swpm_cd_sapase_client_path diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 4434d9f79..f1e146786 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -138,7 +138,7 @@ sap_swpm_cd_export_pt1_path: sap_swpm_cd_export_pt2_path: sap_swpm_cd_language_path: sap_swpm_cd_java_path: -sap_swpm_cd_rdms_path: +sap_swpm_cd_rdbms_path: sap_swpm_cd_export_path: sap_swpm_cd_ibmdb2_path: sap_swpm_cd_ibmdb2_client_path: diff --git a/roles/sap_swpm/templates/configfile.j2 b/roles/sap_swpm/templates/configfile.j2 index a4148526e..e59f930b6 100644 --- a/roles/sap_swpm/templates/configfile.j2 +++ b/roles/sap_swpm/templates/configfile.j2 @@ -25,7 +25,7 @@ HDB_Software_Dialogs.useMediaCD = {{ sap_swpm_software_use_media }} ###### SAPINST.CD.PACKAGE.LANGUAGE = {{ sap_swpm_cd_language_path }} SAPINST.CD.PACKAGE.JAVA = {{ sap_swpm_cd_java_path }} -SAPINST.CD.PACKAGE.RDBMS = {{ sap_swpm_cd_rdms_path }} +SAPINST.CD.PACKAGE.RDBMS = {{ sap_swpm_cd_rdbms_path }} # SAPINST.CD.PACKAGE.KERNEL = # SAPINST.CD.PACKAGE.KERNEL2 = # SAPINST.CD.PACKAGE.KERNEL3 = From b9575789b89439b04be58ed2191212b88cd2a6aa Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 15 Sep 2023 11:24:51 +0200 Subject: [PATCH 123/179] sap_ha_pacemaker_cluster: enh: vip ip addresses can contain a /cidr suffix that will be stripped --- .../tasks/include_construct_vip_resources.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index b269c4826..6480f1f9b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -6,17 +6,17 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_all_vip_fact: - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/*', '') }}" - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address }}" + value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/*', '') }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" ansible.builtin.set_fact: From c6f640469d27eeb5f331adbfd648a64c79e5fa0e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 15 Sep 2023 19:38:10 +0200 Subject: [PATCH 124/179] sap_ha_pacemaker_cluster: fix: VIP addresses applied corresponding to host type --- .../tasks/include_construct_vip_resources.yml | 48 ++++++++++--------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 6480f1f9b..1007f703b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -5,33 +5,31 @@ - name: "SAP HA Prepare Pacemaker - Make a list of potential VIP definitions" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_all_vip_fact: - - key: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/*', '') }}" - - key: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name }}" - value: "{{ sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/*', '') }}" + hana_scaleup_perf: "{{ + { + sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: sap_ha_pacemaker_cluster_vip_hana_primary_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address | regex_replace('/.*', '') + } }}" + nwas_abap_ascs_ers: "{{ + { + sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/.*', '') + } }}" + nwas_abap_pas_aas: "{{ + { + sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/.*', '') + } }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_vip_resource_definition: "{{ __sap_ha_pacemaker_cluster_vip_resource_definition | default({}) - | combine ({ vip_item.key : vip_item.value }) }}" - loop: "{{ __sap_ha_pacemaker_cluster_all_vip_fact }}" + | combine(__sap_ha_pacemaker_cluster_all_vip_fact[vip_item]) }}" + loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: vip_item - label: "{{ vip_item.key }}: {{ vip_item.value }}" - when: - - vip_item.key is defined - - vip_item.key != '' - - vip_item.value is defined - - vip_item.value != '' + # Repeat the VIP resource definition in a loop over the above combined possible parameters. - name: "SAP HA Prepare Pacemaker - Include variable construction for standard VIP resources" @@ -40,8 +38,11 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms + - vip_list_item.value != '' + - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" ansible.builtin.include_tasks: "platform/construct_vars_vip_resources_{{ __sap_ha_pacemaker_cluster_platform }}.yml" @@ -49,8 +50,11 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms + - vip_list_item.value != '' + - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" ansible.builtin.include_tasks: @@ -59,7 +63,7 @@ loop_control: index_var: loop_index loop_var: vip_list_item + label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address is defined - - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address != '' - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + - vip_list_item.value != '' From 667db5908f20a5d28a77a469ca963a17b09ff20b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 19 Sep 2023 17:58:38 +0200 Subject: [PATCH 125/179] sap_ha_pacemaker_cluster: dev comment for host_type list conversion --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index c4bdd5f66..7726ec60c 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -79,6 +79,9 @@ sap_ha_pacemaker_cluster_resource_defaults: {} # nwas_abap_ascs_ers # nwas_abap_pas_aas # nwas_java_scs_ers (maybe) +# +# 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in +# 'tasks/ascertain_sap_landscape.yml'. sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" sap_ha_pacemaker_cluster_replication_type: none From 586361c56eccc3cb486e51f4304f0c3d6a561b7d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 19 Sep 2023 22:01:32 +0200 Subject: [PATCH 126/179] sap_install_media_detect: handle SIGNATURE.SMF inside sapcar extraction task --- .../tasks/organize_files.yml | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index cc7019ad5..0d0c53833 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -132,14 +132,26 @@ - line_item.archive_type == 'rarexe' - line_item.extract_archive == 'y' +- name: SAP Install Media Detect - Organize all files - Create temp dir for sapcar archive files - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" + state: directory + owner: root + group: root + mode: '0755' + - name: SAP Install Media Detect - Organize all files - Extract sapcar archive files - ansible.builtin.command: >- + ansible.builtin.shell: >- {{ __sap_install_media_detect_fact_sapcar_path }} - -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} - -xvf {{ line_item.file }} + -R {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + -xvf {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} -manifest SIGNATURE.SMF + && extracted_dir=$(ls -d */) + && mv SIGNATURE.SMF $extracted_dir + && mkdir -p {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/$extracted_dir + && mv $extracted_dir {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/ args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" loop_control: loop_var: line_item @@ -148,17 +160,10 @@ - line_item.archive_type == 'sapcar' - line_item.extract_archive == 'y' -- name: SAP Install Media Detect - Organize all files - Move SIGNATURE.SMF into subdir for SAP HANA non-export files - ansible.builtin.shell: | - extracted_dir=$(ls -d */) - mv SIGNATURE.SMF ${extracted_dir} - args: - chdir: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" - loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" - loop_control: - loop_var: line_item - when: - - line_item.sap_file_type is search("saphana") +- name: SAP Install Media Detect - Organize all files - Remove temp dir - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" + state: absent - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: From f8a8477f266db8f1711dca18ec60c55318291ded Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Wed, 20 Sep 2023 08:23:28 +0100 Subject: [PATCH 127/179] sap_swpm: hdbuserstore check --- roles/sap_swpm/tasks/post_install.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/tasks/post_install.yml b/roles/sap_swpm/tasks/post_install.yml index d26dbee2f..4e0d39968 100644 --- a/roles/sap_swpm/tasks/post_install.yml +++ b/roles/sap_swpm/tasks/post_install.yml @@ -34,7 +34,14 @@ # - ' Master Password - {{ sap_swpm_master_password }} ' # - ' DDIC 000 Password - {{ sap_swpm_ddic_000_password }} ' -- name: SAP SWPM Post Install - Enforce Connection Info in hdbuserstore +# SAP HANA Client will not be installed for any installation with SAP AnyDB +# and will only be installed alongside SAP NWAS PAS or AAS (not NWAS ASCS) +- name: SAP SWPM Post Install - Check for SAP HANA Client hdbuserstore + ansible.builtin.stat: + path: /usr/sap/{{ sap_swpm_sid }}/hdbclient/hdbuserstore + register: __sap_swpm_post_install_register_hdbuserstore_exists + +- name: SAP SWPM Post Install - Enforce Connection Info in SAP HANA Client hdbuserstore ansible.builtin.shell: | /usr/sap/{{ sap_swpm_sid }}/hdbclient/hdbuserstore \ SET DEFAULT \ @@ -44,6 +51,8 @@ executable: /bin/bash become: true become_user: "{{ sap_swpm_sid | lower }}adm" - when: sap_swpm_install_saphostagent is defined and sap_swpm_install_saphostagent + when: + - sap_swpm_install_saphostagent is defined and sap_swpm_install_saphostagent + - __sap_swpm_post_install_register_hdbuserstore_exists.stat.exists register: __sap_swpm_post_install_register_hdbuserstore_connection changed_when: __sap_swpm_post_install_register_hdbuserstore_connection is succeeded From a153398bafe8c197ed7eccada360cab0794d312f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Sep 2023 10:12:24 +0200 Subject: [PATCH 128/179] sap_install_media_detect: support database client only assertions --- roles/sap_install_media_detect/defaults/main.yml | 2 ++ .../tasks/prepare/create_file_list_phase_2.yml | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 8e73b1e32..b99bbeb35 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -67,6 +67,7 @@ sap_install_media_detect_assert_after_sapfile: true # Typical parameter settings for SAP S/4HANA: sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 sap_install_media_detect_swpm: true sap_install_media_detect_hostagent: true sap_install_media_detect_igs: true @@ -79,6 +80,7 @@ sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, s # Typical parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database: #sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +#sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_swpm: true #sap_install_media_detect_hostagent: true #sap_install_media_detect_igs: true diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index aab5000c2..b22b500e2 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -219,7 +219,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana_client') | length > 0 fail_msg: "No file found for saphana_client" when: - - (sap_install_media_detect_db | d('')) == 'saphana' + - (sap_install_media_detect_db | d('')) == 'saphana' or + (sap_install_media_detect_db_client | d('')) == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: @@ -235,7 +236,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase_client') | length > 0 fail_msg: "No file found for sapase_client" when: - - (sap_install_media_detect_db | d('')) == 'sapase' + - (sap_install_media_detect_db | d('')) == 'sapase' or + (sap_install_media_detect_db_client | d('')) == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: @@ -259,7 +261,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb_client') | length > 0 fail_msg: "No file found for oracledb_client" when: - - (sap_install_media_detect_db | d('')) == 'oracledb' + - (sap_install_media_detect_db | d('')) == 'oracledb' or + (sap_install_media_detect_db_client | d('')) == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: @@ -275,7 +278,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_client') | length > 0 fail_msg: "No file found for ibmdb2_client" when: - - (sap_install_media_detect_db | d('')) == 'ibmdb2' + - (sap_install_media_detect_db | d('')) == 'ibmdb2' or + (sap_install_media_detect_db_client | d('')) == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: From 90636ecf1b42dfc81e4ed98afd4ca90748ded159 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Sep 2023 14:08:43 +0200 Subject: [PATCH 129/179] sap_install_media_detect: Make the role more robust against missing vars - in all when conditions, set defaults for all role vars. And replace double by single quotes for strings. - do not set any defaults for SAP product related vars in defaults/main.yml - also add the new DB client related variable in task 'Set fact with the results of the sapfile command' --- .../defaults/main.yml | 16 ++--- .../tasks/find_files_after_extraction.yml | 44 ++++++------ .../tasks/organize_files.yml | 4 +- .../tasks/prepare/check_directories.yml | 2 +- .../prepare/create_file_list_phase_2.yml | 72 ++++++++++--------- .../tasks/set_global_vars.yml | 30 ++++---- 6 files changed, 86 insertions(+), 82 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index b99bbeb35..63e5a357f 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -66,16 +66,16 @@ sap_install_media_detect_move_or_copy_archives: true sap_install_media_detect_assert_after_sapfile: true # Typical parameter settings for SAP S/4HANA: -sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 -sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 -sap_install_media_detect_swpm: true -sap_install_media_detect_hostagent: true -sap_install_media_detect_igs: true -sap_install_media_detect_kernel: true +#sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +#sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +#sap_install_media_detect_swpm: true +#sap_install_media_detect_hostagent: true +#sap_install_media_detect_igs: true +#sap_install_media_detect_kernel: true #sap_install_media_detect_kernel_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 # (only necessary if there is more than one SAPEXEDB file in the source directory) -sap_install_media_detect_webdisp: false -sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides, +#sap_install_media_detect_webdisp: false +#sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides, # sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java # Typical parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database: diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 053ad0aa3..6cef59c82 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -33,7 +33,7 @@ patterns: "SAP_HANA_CLIENT" register: sap_hana_client_path ignore_errors: true - when: sap_install_media_detect_db == "saphana" + when: sap_install_media_detect_db | d('') == 'saphana' - name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 ansible.builtin.find: @@ -43,7 +43,7 @@ patterns: ".*LINUXX86_64.*" use_regex: true register: detect_directory_ibmdb2_extracted - when: sap_install_media_detect_db == "ibmdb2" + when: sap_install_media_detect_db | d('') == 'ibmdb2' - name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 Client ansible.builtin.find: @@ -53,7 +53,7 @@ patterns: ".*DATA_UNITS.*" use_regex: true register: detect_directory_ibmdb2_client_extracted - when: sap_install_media_detect_db == "ibmdb2" + when: sap_install_media_detect_db | d('') == 'ibmdb2' - name: SAP Install Media Detect - Find files after extraction - Find Oracle DB ansible.builtin.find: @@ -63,7 +63,7 @@ patterns: ".*LINUX_X86_64.*" use_regex: true register: detect_directory_oracledb_extracted - when: sap_install_media_detect_db == "oracledb" + when: sap_install_media_detect_db | d('') == 'oracledb' - name: SAP Install Media Detect - Find files after extraction - Find Oracle DB Client ansible.builtin.find: @@ -73,7 +73,7 @@ patterns: ".*OCL_LINUX_X86_64.*" use_regex: true register: detect_directory_oracledb_client_extracted - when: sap_install_media_detect_db == "oracledb" + when: sap_install_media_detect_db | d('') == 'oracledb' - name: SAP Install Media Detect - Find files after extraction - Find SAP ASE ansible.builtin.find: @@ -83,7 +83,7 @@ patterns: ".*SYBASE_LINUX.*" use_regex: true register: detect_directory_sapase_extracted - when: sap_install_media_detect_db == "sapase" + when: sap_install_media_detect_db | d('') == 'sapase' - name: SAP Install Media Detect - Find files after extraction - Find SAP ASE Client ansible.builtin.find: @@ -93,7 +93,7 @@ patterns: "sybodbc" use_regex: true register: detect_directory_sapase_client_extracted - when: sap_install_media_detect_db == "sapase" + when: sap_install_media_detect_db | d('') == 'sapase' - name: SAP Install Media Detect - Find files after extraction - Find SAP MaxDB ansible.builtin.find: @@ -103,7 +103,7 @@ patterns: '.*MaxDB_7.9.*' use_regex: true register: detect_directory_sapmaxdb_extracted - when: sap_install_media_detect_db == "sapmaxdb" + when: sap_install_media_detect_db | d('') == 'sapmaxdb' - name: SAP Install Media Detect - Find files after extraction - Find SAPEXE ansible.builtin.shell: ls SAPEXE_*.SAR @@ -111,7 +111,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_independent_file_name_get changed_when: false - when: sap_install_media_detect_kernel + when: sap_install_media_detect_kernel | d(false) - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXE found ansible.builtin.fail: @@ -130,7 +130,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_dependent_file_name_get changed_when: false - when: sap_install_media_detect_kernel + when: sap_install_media_detect_kernel | d(false) - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found, database unspecific ansible.builtin.fail: @@ -150,7 +150,7 @@ register: __sap_install_media_detect_register_db_dependent_kernel_files changed_when: false when: - - sap_install_media_detect_kernel + - sap_install_media_detect_kernel | d(false) - sap_install_media_detect_kernel_db is defined - name: SAP Install Media Detect - Find files after extraction - Set fact with the results of the sapfile command @@ -238,7 +238,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get changed_when: false - when: sap_install_media_detect_igs + when: sap_install_media_detect_igs | d(false) - name: SAP Install Media Detect - Find files after extraction - Find IGS Helper, latest version ansible.builtin.shell: set -o pipefail && ls -1tr igshelper*.sar | tail -1 @@ -246,7 +246,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get changed_when: false - when: sap_install_media_detect_igs + when: sap_install_media_detect_igs | d(false) - name: SAP Install Media Detect - Find files after extraction - Find WEBDISP ansible.builtin.shell: ls SAPWEBDISP_*.SAR @@ -255,7 +255,7 @@ register: sap_swpm_web_dispatcher_file_name_get ignore_errors: true changed_when: false - when: sap_install_media_detect_webdisp + when: sap_install_media_detect_webdisp | d(false) - name: SAP Install Media Detect - Find files after extraction - Fail if more than one WEBDISP found ansible.builtin.fail: @@ -272,7 +272,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_ecc_export_extracted - when: sap_install_media_detect_export == "sapecc" + when: sap_install_media_detect_export | d('') == 'sapecc' - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export ansible.builtin.find: @@ -282,7 +282,7 @@ patterns: '.*EXP.*' use_regex: true register: detect_directory_ecc_ides_export_extracted - when: sap_install_media_detect_export == "sapecc_ides" + when: sap_install_media_detect_export | d('') == 'sapecc_ides' - name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export ansible.builtin.find: @@ -292,7 +292,7 @@ patterns: '.*S4.*EXPORT.*' use_regex: true register: s4hana_export_files - when: sap_install_media_detect_export == "saps4hana" + when: sap_install_media_detect_export | d('') == 'saps4hana' - name: SAP Install Media Detect - Find files after extraction - Find SAP BW/4HANA Export ansible.builtin.find: @@ -302,7 +302,7 @@ patterns: '.*BW4.*EXPORT.*' use_regex: true register: bw4hana_export_files - when: sap_install_media_detect_export == "sapbw4hana" + when: sap_install_media_detect_export | d('') == 'sapbw4hana' - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export ansible.builtin.find: @@ -312,7 +312,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_nwas_abap_export_extracted - when: sap_install_media_detect_export == "sapnwas_abap" + when: sap_install_media_detect_export | d('') == 'sapnwas_abap' - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export ansible.builtin.find: @@ -322,7 +322,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_nwas_java_export_extracted - when: sap_install_media_detect_export == "sapnwas_java" + when: sap_install_media_detect_export | d('') == 'sapnwas_java' - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export ansible.builtin.find: @@ -332,7 +332,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_solgmr_abap_export_extracted - when: sap_install_media_detect_export == "sapsolman_abap" + when: sap_install_media_detect_export | d('') == 'sapsolman_abap' - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (JAVA) platform only Export ansible.builtin.find: @@ -342,4 +342,4 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_solgmr_java_export_extracted - when: sap_install_media_detect_export == "sapsolman_java" + when: sap_install_media_detect_export | d('') == 'sapsolman_java' diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 0d0c53833..40598ecd4 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -76,7 +76,7 @@ loop_var: line_item when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == 'saphana' + - sap_install_media_detect_db | d('') == 'saphana' - line_item.target_dir == 'auto' - name: SAP Install Media Detect - Organize all files - Create target directory 'sap_swpm_download_basket' @@ -178,7 +178,7 @@ loop_var: line_item when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == 'saphana' + - sap_install_media_detect_db | d('') == 'saphana' - (line_item.sap_file_type == 'sapcar' or line_item.sap_file_type == 'saphana_client' or line_item.sap_file_type == 'sap_hostagent') diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index 70bdb0f5c..a66b3acf7 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -56,7 +56,7 @@ - name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_source_directory' when: sap_install_media_detect_target_directory is undefined or - sap_install_media_detect_target_directory | string == "None" or + sap_install_media_detect_target_directory | string == 'None' or sap_install_media_detect_target_directory | string | length == 0 block: diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index b22b500e2..8b01c6f97 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -54,40 +54,44 @@ (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] == 'sap_kernel') or (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] is search('sap_kernel_db_')) or (sap_install_media_detect_webdisp | d(false) and item.stdout.split(';')[1] == 'sap_webdisp') or - (sap_install_media_detect_db == 'saphana' and ( + (sap_install_media_detect_db | d('') == 'saphana' and ( item.stdout.split(';')[1] == 'saphana' or item.stdout.split(';')[1] == 'saphana_client' or item.stdout.split(';')[1] == 'saphana_other') ) or - (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or - (sap_install_media_detect_db == 'sapase' and ( + (sap_install_media_detect_db_client | d('') == 'saphana' and item.stdout.split(';')[1] == 'saphana_client') or + (sap_install_media_detect_db | d('') == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or + (sap_install_media_detect_db | d('') == 'sapase' and ( item.stdout.split(';')[1] == 'sapase' or item.stdout.split(';')[1] == 'sapase_client') ) or - (sap_install_media_detect_db == 'oracledb' and ( + (sap_install_media_detect_db_client | d('') == 'sapase' and item.stdout.split(';')[1] == 'sapase_client') or + (sap_install_media_detect_db | d('') == 'oracledb' and ( item.stdout.split(';')[1] == 'oracledb' or item.stdout.split(';')[1] == 'oracledb_client' or item.stdout.split(';')[1] == 'oracledb_tools') ) or - (sap_install_media_detect_db == 'ibmdb2' and ( + (sap_install_media_detect_db_client | d('') == 'oracledb' and item.stdout.split(';')[1] == 'oracledb_client') or + (sap_install_media_detect_db | d('') == 'ibmdb2' and ( item.stdout.split(';')[1] == 'ibmdb2' or item.stdout.split(';')[1] == 'ibmdb2_client' or item.stdout.split(';')[1] == 'ibmdb2_license') ) or + (sap_install_media_detect_db_client | d('') == 'ibmdb2' and item.stdout.split(';')[1] == 'ibmdb2_client') or (sap_install_media_detect_export == 'saps4hana' and ( item.stdout.split(';')[1] == 'sap_export_s4hana' or item.stdout.split(';')[1] == 'sap_s4hana_lang') ) or - (sap_install_media_detect_export == 'sapbw4hana' and ( + (sap_install_media_detect_export | d('') == 'sapbw4hana' and ( item.stdout.split(';')[1] == 'sap_export_bw4hana' or item.stdout.split(';')[1] == 'sap_s4hana_lang') ) or - (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or - (sap_install_media_detect_export == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or - (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or - (sap_install_media_detect_export == 'sapsolman_java' and item.stdout.split(';')[1] == 'sap_export_solman_java') or - (sap_install_media_detect_export == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or - (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') + (sap_install_media_detect_export | d('') == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or + (sap_install_media_detect_export | d('') == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or + (sap_install_media_detect_export | d('') == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or + (sap_install_media_detect_export | d('') == 'sapsolman_java' and item.stdout.split(';')[1] == 'sap_export_solman_java') or + (sap_install_media_detect_export | d('') == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or + (sap_install_media_detect_export | d('') == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') - name: SAP Install Media Detect - Prepare - Asserts when: @@ -211,7 +215,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana') | length > 0 fail_msg: "No file found for saphana" when: - - (sap_install_media_detect_db | d('')) == 'saphana' + - sap_install_media_detect_db | d('') == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that saphana_client is present ansible.builtin.assert: @@ -219,8 +223,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana_client') | length > 0 fail_msg: "No file found for saphana_client" when: - - (sap_install_media_detect_db | d('')) == 'saphana' or - (sap_install_media_detect_db_client | d('')) == 'saphana' + - sap_install_media_detect_db | d('') == 'saphana' or + sap_install_media_detect_db_client | d('') == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: @@ -228,7 +232,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') | length > 0 fail_msg: "No file found for sapase" when: - - (sap_install_media_detect_db | d('')) == 'sapase' + - sap_install_media_detect_db | d('') == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapase_client is present ansible.builtin.assert: @@ -236,8 +240,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase_client') | length > 0 fail_msg: "No file found for sapase_client" when: - - (sap_install_media_detect_db | d('')) == 'sapase' or - (sap_install_media_detect_db_client | d('')) == 'sapase' + - sap_install_media_detect_db | d('') == 'sapase' or + sap_install_media_detect_db_client | d('') == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: @@ -245,7 +249,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapmaxdb') | length > 0 fail_msg: "No file found for sapmaxdb" when: - - (sap_install_media_detect_db | d('')) == 'sapmaxdb' + - sap_install_media_detect_db | d('') == 'sapmaxdb' - name: SAP Install Media Detect - Prepare - Assert that oracledb is present ansible.builtin.assert: @@ -253,7 +257,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb') | length > 0 fail_msg: "No file found for oracledb" when: - - (sap_install_media_detect_db | d('')) == 'oracledb' + - sap_install_media_detect_db | d('') == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that oracledb_client is present ansible.builtin.assert: @@ -261,8 +265,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb_client') | length > 0 fail_msg: "No file found for oracledb_client" when: - - (sap_install_media_detect_db | d('')) == 'oracledb' or - (sap_install_media_detect_db_client | d('')) == 'oracledb' + - sap_install_media_detect_db | d('') == 'oracledb' or + sap_install_media_detect_db_client | d('') == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: @@ -270,7 +274,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2') | length > 0 fail_msg: "No file found for ibmdb2" when: - - (sap_install_media_detect_db | d('')) == 'ibmdb2' + - sap_install_media_detect_db | d('') == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_client is present ansible.builtin.assert: @@ -278,8 +282,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_client') | length > 0 fail_msg: "No file found for ibmdb2_client" when: - - (sap_install_media_detect_db | d('')) == 'ibmdb2' or - (sap_install_media_detect_db_client | d('')) == 'ibmdb2' + - sap_install_media_detect_db | d('') == 'ibmdb2' or + sap_install_media_detect_db_client | d('') == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: @@ -287,7 +291,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_license') | length > 0 fail_msg: "No file found for ibmdb2_license" when: - - (sap_install_media_detect_db | d('')) == 'ibmdb2' + - sap_install_media_detect_db | d('') == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that sap_export_s4hana is present ansible.builtin.assert: @@ -295,7 +299,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_s4hana') | length > 0 fail_msg: "No file found for sap_export_s4hana" when: - - (sap_install_media_detect_export | d('')) == 'saps4hana' + - sap_install_media_detect_export | d('') == 'saps4hana' - name: SAP Install Media Detect - Prepare - Assert that sap_export_bw4hana is present ansible.builtin.assert: @@ -303,7 +307,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_bw4hana') | length > 0 fail_msg: "No file found for sap_export_bw4hana" when: - - (sap_install_media_detect_export | d('')) == 'sapbw4hana' + - sap_install_media_detect_export | d('') == 'sapbw4hana' - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc is present ansible.builtin.assert: @@ -311,7 +315,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc') | length > 0 fail_msg: "No file found for sap_export_ecc" when: - - (sap_install_media_detect_export | d('')) == 'sapecc' + - sap_install_media_detect_export | d('') == 'sapecc' - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc_ides is present ansible.builtin.assert: @@ -319,7 +323,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc_ides') | length > 0 fail_msg: "No file found for sap_export_ecc_ides" when: - - (sap_install_media_detect_export | d('')) == 'sapecc_ides' + - sap_install_media_detect_export | d('') == 'sapecc_ides' - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_abap is present ansible.builtin.assert: @@ -327,7 +331,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_abap') | length > 0 fail_msg: "No file found for sap_export_nwas_abap" when: - - (sap_install_media_detect_export | d('')) == 'sapnwas_abap' + - sap_install_media_detect_export | d('') == 'sapnwas_abap' - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_java is present ansible.builtin.assert: @@ -335,7 +339,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_java') | length > 0 fail_msg: "No file found for sap_export_nwas_java" when: - - (sap_install_media_detect_export | d('')) == 'sapnwas_java' + - sap_install_media_detect_export | d('') == 'sapnwas_java' - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_abap is present ansible.builtin.assert: @@ -343,7 +347,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_abap') | length > 0 fail_msg: "No file found for sap_export_solman_abap" when: - - (sap_install_media_detect_export | d('')) == 'sapsolman_abap' + - sap_install_media_detect_export | d('') == 'sapsolman_abap' - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_java is present ansible.builtin.assert: @@ -351,7 +355,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_java') | length > 0 fail_msg: "No file found for sap_export_solman_java" when: - - (sap_install_media_detect_export | d('')) == 'sapsolman_java' + - sap_install_media_detect_export | d('') == 'sapsolman_java' #- name: SAP Install Media Detect - Prepare - Identify the sapcar program # ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index a52c16ed5..2492814f3 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -41,7 +41,7 @@ ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == "saphana" + - sap_install_media_detect_db == 'saphana' - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_hana_install, move_or_copy_archives parameter not set ansible.builtin.set_fact: @@ -51,7 +51,7 @@ ignore_errors: true when: - not sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == "saphana" + - sap_install_media_detect_db == 'saphana' - name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm ansible.builtin.set_fact: @@ -59,7 +59,7 @@ ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == "saphana" + - sap_install_media_detect_db == 'saphana' # In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64'. For the role sap_swpm, we need to set # exactly this path @@ -68,7 +68,7 @@ sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}/" # for sap_swpm Ansible Role sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "ibmdb2" + when: sap_install_media_detect_db == 'ibmdb2' # In 'find_files_after_extraction.yml', we search for a directory name which contains 'LINUX_X86_64'. For the role sap_swpm, we need # to set the path which contains this directory, not the directory itself. For the Oracle client, we search for a directory name which @@ -79,7 +79,7 @@ sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "oracledb" + when: sap_install_media_detect_db == 'oracledb' # In 'find_files_after_extraction.yml', we search for a directory name which contains 'SYBASE_LINUX'. For the role sap_swpm, we need # to set exactly this path. For the ASE client, we search for a directory which contains 'sybodbc'. For the role @@ -89,13 +89,13 @@ sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}/" # for sap_swpm Ansible Role sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "sapase" + when: sap_install_media_detect_db == 'sapase' - name: SAP Install Media Detect - Detection completed - Set facts for SAP MaxDB ansible.builtin.set_fact: sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_db == "sapmaxdb" + when: sap_install_media_detect_db == 'sapmaxdb' - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXE ansible.builtin.set_fact: @@ -141,7 +141,7 @@ ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_ecc_export_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapecc" + when: sap_install_media_detect_export == 'sapecc' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP ECC IDES ansible.builtin.set_fact: @@ -149,31 +149,31 @@ sap_swpm_cd_export_pt1_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[0] }}/" # for sap_swpm Ansible Role sap_swpm_cd_export_pt2_path: "{{ (detect_directory_ecc_ides_export_extracted.files | map(attribute='path') | map('dirname') | list | select() | unique)[1] }}/" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapecc_ides" + when: sap_install_media_detect_export == 'sapecc_ides' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP S/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ s4hana_export_files.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "saps4hana" + when: sap_install_media_detect_export == 'saps4hana' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP BW/4HANA ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ bw4hana_export_files.files[0].path | dirname }}" # for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapbw4hana" + when: sap_install_media_detect_export == 'sapbw4hana' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (ABAP) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_nwas_abap_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapnwas_abap" + when: sap_install_media_detect_export == 'sapnwas_abap' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP NetWeaver AS (JAVA) platform only ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_nwas_java_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapnwas_java" + when: sap_install_media_detect_export == 'sapnwas_java' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (ABAP) ansible.builtin.set_fact: @@ -181,13 +181,13 @@ sap_swpm_cd_export_pt1_path: "{{ detect_directory_solgmr_abap_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role sap_swpm_cd_export_pt2_path: "{{ detect_directory_solgmr_abap_export_extracted.files[1].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapsolman_abap" + when: sap_install_media_detect_export == 'sapsolman_abap' - name: SAP Install Media Detect - Detection completed - Set facts for Export of SAP Solution Manager (JAVA) ansible.builtin.set_fact: sap_swpm_cd_export_path: "{{ detect_directory_solgmr_java_export_extracted.files[0].path }}/" # directory DATA_UNITS, for sap_swpm Ansible Role ignore_errors: true - when: sap_install_media_detect_export == "sapsolman_java" + when: sap_install_media_detect_export == 'sapsolman_java' - name: SAP Install Media Detect - Detection completed - Set fact for displaying all variables ansible.builtin.set_fact: From bc3bf4a5e8e4e439ed16ec51de73609ee6f0f55b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Sep 2023 21:18:44 +0200 Subject: [PATCH 130/179] sap_install_media_detect: Make the role more robust against missing vars - in all when conditions, remove defaults for all role vars again. - set all SAP product related vars in defaults/main.yml to empty or, in case of boolean, to false - add more DB client file handling code - use different variable names of 'sap_swpm_kernel_dependent_file_name_get' for db unspecific and for db specific --- .../defaults/main.yml | 16 ++- .../tasks/find_files_after_extraction.yml | 77 +++++++------ .../prepare/create_file_list_phase_2.yml | 102 +++++++++--------- .../tasks/set_global_vars.yml | 32 +++++- 4 files changed, 135 insertions(+), 92 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 63e5a357f..961ffd693 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -65,7 +65,19 @@ sap_install_media_detect_move_or_copy_archives: true # following parameter to 'false' to skip this step. sap_install_media_detect_assert_after_sapfile: true -# Typical parameter settings for SAP S/4HANA: +sap_install_media_detect_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +sap_install_media_detect_db_client: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +sap_install_media_detect_swpm: false +sap_install_media_detect_hostagent: false +sap_install_media_detect_igs: false +sap_install_media_detect_kernel: false +sap_install_media_detect_kernel_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 +# (only necessary if there is more than one SAPEXEDB file in the source directory) +sap_install_media_detect_webdisp: false +sap_install_media_detect_export: '' # saps4hana, sapbw4hana, sapecc, sapecc_ides, +# sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java + +# Example for parameter settings for SAP S/4HANA: #sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_swpm: true @@ -78,7 +90,7 @@ sap_install_media_detect_assert_after_sapfile: true #sap_install_media_detect_export: 'saps4hana' # saps4hana, sapbw4hana, sapecc, sapecc_ides, # sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java -# Typical parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database: +# Example for parameter settings for SAP ERP 6.0 EHP8 with SAP HANA database: #sap_install_media_detect_db: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_db_client: 'saphana' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 #sap_install_media_detect_swpm: true diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 6cef59c82..646fabd3c 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -33,7 +33,9 @@ patterns: "SAP_HANA_CLIENT" register: sap_hana_client_path ignore_errors: true - when: sap_install_media_detect_db | d('') == 'saphana' + when: + - sap_install_media_detect_db == 'saphana' or + sap_install_media_detect_db_client == 'saphana' - name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 ansible.builtin.find: @@ -43,7 +45,7 @@ patterns: ".*LINUXX86_64.*" use_regex: true register: detect_directory_ibmdb2_extracted - when: sap_install_media_detect_db | d('') == 'ibmdb2' + when: sap_install_media_detect_db == 'ibmdb2' - name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 Client ansible.builtin.find: @@ -53,7 +55,9 @@ patterns: ".*DATA_UNITS.*" use_regex: true register: detect_directory_ibmdb2_client_extracted - when: sap_install_media_detect_db | d('') == 'ibmdb2' + when: + - sap_install_media_detect_db == 'ibmdb2' or + sap_install_media_detect_db_client == 'ibmdb2' - name: SAP Install Media Detect - Find files after extraction - Find Oracle DB ansible.builtin.find: @@ -63,7 +67,7 @@ patterns: ".*LINUX_X86_64.*" use_regex: true register: detect_directory_oracledb_extracted - when: sap_install_media_detect_db | d('') == 'oracledb' + when: sap_install_media_detect_db == 'oracledb' - name: SAP Install Media Detect - Find files after extraction - Find Oracle DB Client ansible.builtin.find: @@ -73,7 +77,9 @@ patterns: ".*OCL_LINUX_X86_64.*" use_regex: true register: detect_directory_oracledb_client_extracted - when: sap_install_media_detect_db | d('') == 'oracledb' + when: + - sap_install_media_detect_db == 'oracledb' or + sap_install_media_detect_db_client == 'oracledb' - name: SAP Install Media Detect - Find files after extraction - Find SAP ASE ansible.builtin.find: @@ -83,7 +89,7 @@ patterns: ".*SYBASE_LINUX.*" use_regex: true register: detect_directory_sapase_extracted - when: sap_install_media_detect_db | d('') == 'sapase' + when: sap_install_media_detect_db == 'sapase' - name: SAP Install Media Detect - Find files after extraction - Find SAP ASE Client ansible.builtin.find: @@ -93,7 +99,9 @@ patterns: "sybodbc" use_regex: true register: detect_directory_sapase_client_extracted - when: sap_install_media_detect_db | d('') == 'sapase' + when: + - sap_install_media_detect_db == 'sapase' or + sap_install_media_detect_db_client == 'sapase' - name: SAP Install Media Detect - Find files after extraction - Find SAP MaxDB ansible.builtin.find: @@ -103,7 +111,7 @@ patterns: '.*MaxDB_7.9.*' use_regex: true register: detect_directory_sapmaxdb_extracted - when: sap_install_media_detect_db | d('') == 'sapmaxdb' + when: sap_install_media_detect_db == 'sapmaxdb' - name: SAP Install Media Detect - Find files after extraction - Find SAPEXE ansible.builtin.shell: ls SAPEXE_*.SAR @@ -111,7 +119,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_independent_file_name_get changed_when: false - when: sap_install_media_detect_kernel | d(false) + when: sap_install_media_detect_kernel - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXE found ansible.builtin.fail: @@ -121,26 +129,30 @@ - sap_swpm_kernel_independent_file_name_get.stdout_lines | count > 1 - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific - block - when: sap_install_media_detect_kernel_db is not defined + when: + - sap_install_media_detect_kernel + - sap_install_media_detect_kernel_db is not defined or + sap_install_media_detect_kernel_db | length == 0 block: - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database unspecific ansible.builtin.shell: ls SAPEXEDB_*.SAR args: chdir: "{{ sap_swpm_software_path }}" - register: sap_swpm_kernel_dependent_file_name_get + register: sap_swpm_kernel_dependent_file_name_get_db_unspecific changed_when: false - when: sap_install_media_detect_kernel | d(false) - name: SAP Install Media Detect - Find files after extraction - Fail if more than one SAPEXEDB file found, database unspecific ansible.builtin.fail: msg: "No, or more than one, SAPEXEDB file has been detected." when: - - sap_install_media_detect_kernel - - sap_swpm_kernel_dependent_file_name_get.stdout_lines | count != 1 + - sap_swpm_kernel_dependent_file_name_get_db_unspecific.stdout_lines | count != 1 - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific - block - when: sap_install_media_detect_kernel_db is defined + when: + - sap_install_media_detect_kernel + - sap_install_media_detect_kernel_db is defined + - sap_install_media_detect_kernel_db | length > 0 block: - name: SAP Install Media Detect - Find files after extraction - Find SAPEXEDB, database specific @@ -149,9 +161,6 @@ chdir: "{{ sap_swpm_software_path }}" register: __sap_install_media_detect_register_db_dependent_kernel_files changed_when: false - when: - - sap_install_media_detect_kernel | d(false) - - sap_install_media_detect_kernel_db is defined - name: SAP Install Media Detect - Find files after extraction - Set fact with the results of the sapfile command ansible.builtin.set_fact: @@ -171,7 +180,7 @@ - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP HANA ansible.builtin.set_fact: - sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | first).file }}" + sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | first).file }}" when: - sap_install_media_detect_kernel_db == 'saphana' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_hdb') | length == 1 @@ -185,7 +194,7 @@ - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP ASE ansible.builtin.set_fact: - sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | first).file }}" + sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | first).file }}" when: - sap_install_media_detect_kernel_db == 'sapase' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ase') | length == 1 @@ -199,7 +208,7 @@ - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for SAP MAXDB ansible.builtin.set_fact: - sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}" + sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | first).file }}" when: - sap_install_media_detect_kernel_db == 'sapmaxdb' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ada') | length == 1 @@ -213,7 +222,7 @@ - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for Oracle DB ansible.builtin.set_fact: - sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}" + sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | first).file }}" when: - sap_install_media_detect_kernel_db == 'oracledb' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_ora') | length == 1 @@ -227,7 +236,7 @@ - name: SAP Install Media Detect - Find files after extraction - Set the kernel dependent file name for IBM Db2 ansible.builtin.set_fact: - sap_swpm_kernel_dependent_file_name_get: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}" + sap_swpm_kernel_dependent_file_name_get_db_specific: "{{ (__sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | first).file }}" when: - sap_install_media_detect_kernel_db == 'ibmdb2' - __sap_install_media_detect_fact_db_dependent_kernel_files_sapfile_results | selectattr('sap_file_type', 'search', 'sap_kernel_db_db6') | length == 1 @@ -238,7 +247,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get changed_when: false - when: sap_install_media_detect_igs | d(false) + when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find IGS Helper, latest version ansible.builtin.shell: set -o pipefail && ls -1tr igshelper*.sar | tail -1 @@ -246,7 +255,7 @@ chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get changed_when: false - when: sap_install_media_detect_igs | d(false) + when: sap_install_media_detect_igs - name: SAP Install Media Detect - Find files after extraction - Find WEBDISP ansible.builtin.shell: ls SAPWEBDISP_*.SAR @@ -255,7 +264,7 @@ register: sap_swpm_web_dispatcher_file_name_get ignore_errors: true changed_when: false - when: sap_install_media_detect_webdisp | d(false) + when: sap_install_media_detect_webdisp - name: SAP Install Media Detect - Find files after extraction - Fail if more than one WEBDISP found ansible.builtin.fail: @@ -272,7 +281,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_ecc_export_extracted - when: sap_install_media_detect_export | d('') == 'sapecc' + when: sap_install_media_detect_export == 'sapecc' - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC IDES Export ansible.builtin.find: @@ -282,7 +291,7 @@ patterns: '.*EXP.*' use_regex: true register: detect_directory_ecc_ides_export_extracted - when: sap_install_media_detect_export | d('') == 'sapecc_ides' + when: sap_install_media_detect_export == 'sapecc_ides' - name: SAP Install Media Detect - Find files after extraction - Find SAP S/4HANA Export ansible.builtin.find: @@ -292,7 +301,7 @@ patterns: '.*S4.*EXPORT.*' use_regex: true register: s4hana_export_files - when: sap_install_media_detect_export | d('') == 'saps4hana' + when: sap_install_media_detect_export == 'saps4hana' - name: SAP Install Media Detect - Find files after extraction - Find SAP BW/4HANA Export ansible.builtin.find: @@ -302,7 +311,7 @@ patterns: '.*BW4.*EXPORT.*' use_regex: true register: bw4hana_export_files - when: sap_install_media_detect_export | d('') == 'sapbw4hana' + when: sap_install_media_detect_export == 'sapbw4hana' - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (ABAP) platform only Export ansible.builtin.find: @@ -312,7 +321,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_nwas_abap_export_extracted - when: sap_install_media_detect_export | d('') == 'sapnwas_abap' + when: sap_install_media_detect_export == 'sapnwas_abap' - name: SAP Install Media Detect - Find files after extraction - Find SAP NetWeaver AS (JAVA) platform only Export ansible.builtin.find: @@ -322,7 +331,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_nwas_java_export_extracted - when: sap_install_media_detect_export | d('') == 'sapnwas_java' + when: sap_install_media_detect_export == 'sapnwas_java' - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (ABAP) platform only Export ansible.builtin.find: @@ -332,7 +341,7 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_solgmr_abap_export_extracted - when: sap_install_media_detect_export | d('') == 'sapsolman_abap' + when: sap_install_media_detect_export == 'sapsolman_abap' - name: SAP Install Media Detect - Find files after extraction - Find SAP Solution Manager (JAVA) platform only Export ansible.builtin.find: @@ -342,4 +351,4 @@ patterns: '.*DATA_UNITS.*' use_regex: true register: detect_directory_solgmr_java_export_extracted - when: sap_install_media_detect_export | d('') == 'sapsolman_java' + when: sap_install_media_detect_export == 'sapsolman_java' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 8b01c6f97..3871186e4 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -48,50 +48,50 @@ (item.stdout.split(';')[1] == 'sapcar') or (item.stdout.split(';')[1] == 'sap_jvm') or (item.stdout.split(';')[1] == 'sap_unknown') or - (sap_install_media_detect_swpm | d(false) and item.stdout.split(';')[1] == 'sap_swpm') or - (sap_install_media_detect_hostagent | d(false) and item.stdout.split(';')[1] == 'sap_hostagent') or - (sap_install_media_detect_igs | d(false) and item.stdout.split(';')[1] == 'sap_igs') or - (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] == 'sap_kernel') or - (sap_install_media_detect_kernel | d(false) and item.stdout.split(';')[1] is search('sap_kernel_db_')) or - (sap_install_media_detect_webdisp | d(false) and item.stdout.split(';')[1] == 'sap_webdisp') or - (sap_install_media_detect_db | d('') == 'saphana' and ( + (sap_install_media_detect_swpm and item.stdout.split(';')[1] == 'sap_swpm') or + (sap_install_media_detect_hostagent and item.stdout.split(';')[1] == 'sap_hostagent') or + (sap_install_media_detect_igs and item.stdout.split(';')[1] == 'sap_igs') or + (sap_install_media_detect_kernel and item.stdout.split(';')[1] == 'sap_kernel') or + (sap_install_media_detect_kernel and item.stdout.split(';')[1] is search('sap_kernel_db_')) or + (sap_install_media_detect_webdisp and item.stdout.split(';')[1] == 'sap_webdisp') or + (sap_install_media_detect_db == 'saphana' and ( item.stdout.split(';')[1] == 'saphana' or item.stdout.split(';')[1] == 'saphana_client' or item.stdout.split(';')[1] == 'saphana_other') ) or - (sap_install_media_detect_db_client | d('') == 'saphana' and item.stdout.split(';')[1] == 'saphana_client') or - (sap_install_media_detect_db | d('') == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or - (sap_install_media_detect_db | d('') == 'sapase' and ( + (sap_install_media_detect_db_client == 'saphana' and item.stdout.split(';')[1] == 'saphana_client') or + (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or + (sap_install_media_detect_db == 'sapase' and ( item.stdout.split(';')[1] == 'sapase' or item.stdout.split(';')[1] == 'sapase_client') ) or - (sap_install_media_detect_db_client | d('') == 'sapase' and item.stdout.split(';')[1] == 'sapase_client') or - (sap_install_media_detect_db | d('') == 'oracledb' and ( + (sap_install_media_detect_db_client == 'sapase' and item.stdout.split(';')[1] == 'sapase_client') or + (sap_install_media_detect_db == 'oracledb' and ( item.stdout.split(';')[1] == 'oracledb' or item.stdout.split(';')[1] == 'oracledb_client' or item.stdout.split(';')[1] == 'oracledb_tools') ) or - (sap_install_media_detect_db_client | d('') == 'oracledb' and item.stdout.split(';')[1] == 'oracledb_client') or - (sap_install_media_detect_db | d('') == 'ibmdb2' and ( + (sap_install_media_detect_db_client == 'oracledb' and item.stdout.split(';')[1] == 'oracledb_client') or + (sap_install_media_detect_db == 'ibmdb2' and ( item.stdout.split(';')[1] == 'ibmdb2' or item.stdout.split(';')[1] == 'ibmdb2_client' or item.stdout.split(';')[1] == 'ibmdb2_license') ) or - (sap_install_media_detect_db_client | d('') == 'ibmdb2' and item.stdout.split(';')[1] == 'ibmdb2_client') or + (sap_install_media_detect_db_client == 'ibmdb2' and item.stdout.split(';')[1] == 'ibmdb2_client') or (sap_install_media_detect_export == 'saps4hana' and ( item.stdout.split(';')[1] == 'sap_export_s4hana' or item.stdout.split(';')[1] == 'sap_s4hana_lang') ) or - (sap_install_media_detect_export | d('') == 'sapbw4hana' and ( + (sap_install_media_detect_export == 'sapbw4hana' and ( item.stdout.split(';')[1] == 'sap_export_bw4hana' or item.stdout.split(';')[1] == 'sap_s4hana_lang') ) or - (sap_install_media_detect_export | d('') == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or - (sap_install_media_detect_export | d('') == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or - (sap_install_media_detect_export | d('') == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or - (sap_install_media_detect_export | d('') == 'sapsolman_java' and item.stdout.split(';')[1] == 'sap_export_solman_java') or - (sap_install_media_detect_export | d('') == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or - (sap_install_media_detect_export | d('') == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') + (sap_install_media_detect_export == 'sapnwas_abap' and item.stdout.split(';')[1] == 'sap_export_nwas_abap') or + (sap_install_media_detect_export == 'sapsolman_abap' and item.stdout.split(';')[1] == 'sap_export_solman_abap') or + (sap_install_media_detect_export == 'sapnwas_java' and item.stdout.split(';')[1] == 'sap_export_nwas_java') or + (sap_install_media_detect_export == 'sapsolman_java' and item.stdout.split(';')[1] == 'sap_export_solman_java') or + (sap_install_media_detect_export == 'sapecc' and item.stdout.split(';')[1] == 'sap_export_ecc') or + (sap_install_media_detect_export == 'sapecc_ides' and item.stdout.split(';')[1] == 'sap_export_ecc_ides') - name: SAP Install Media Detect - Prepare - Asserts when: @@ -109,7 +109,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_swpm') | length > 0 fail_msg: "No file found for sap_swpm" when: - - sap_install_media_detect_swpm | d(false) + - sap_install_media_detect_swpm - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB independent is present ansible.builtin.assert: @@ -118,7 +118,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXE_') | length == 1 fail_msg: "No, or more than one, DB independent SAP Kernel file found" when: - - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_kernel - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP Kernel DB dependent is present ansible.builtin.assert: @@ -127,7 +127,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPEXEDB_') | length == 1 fail_msg: "No, or more than one, DB dependent SAP Kernel file found" when: - - sap_install_media_detect_kernel | d(false) + - sap_install_media_detect_kernel - sap_install_media_detect_kernel_db is not defined - name: SAP Install Media Detect - Prepare - Assert that exactly one matching SAP Kernel DB dependent is present @@ -180,7 +180,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_hostagent') | length > 0 fail_msg: "No SAP Host Agent file found" when: - - sap_install_media_detect_hostagent | d(false) + - sap_install_media_detect_hostagent - name: SAP Install Media Detect - Prepare - Assert that igsexe is present ansible.builtin.assert: @@ -189,7 +189,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igsexe') | length > 0 fail_msg: "No igsexe file found" when: - - sap_install_media_detect_igs | d(false) + - sap_install_media_detect_igs - name: SAP Install Media Detect - Prepare - Assert that igshelper is present ansible.builtin.assert: @@ -198,7 +198,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'igshelper') | length > 0 fail_msg: "No igshelper file found" when: - - sap_install_media_detect_igs | d(false) + - sap_install_media_detect_igs - name: SAP Install Media Detect - Prepare - Assert that exactly one SAP WEBDISP is present ansible.builtin.assert: @@ -207,7 +207,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('file', 'search', 'SAPWEBDISP_') | length == 1 fail_msg: "No, or more than one, SAPWEBDISP file found" when: - - sap_install_media_detect_webdisp | d(false) + - sap_install_media_detect_webdisp - name: SAP Install Media Detect - Prepare - Assert that saphana is present ansible.builtin.assert: @@ -215,7 +215,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana') | length > 0 fail_msg: "No file found for saphana" when: - - sap_install_media_detect_db | d('') == 'saphana' + - sap_install_media_detect_db - name: SAP Install Media Detect - Prepare - Assert that saphana_client is present ansible.builtin.assert: @@ -223,8 +223,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana_client') | length > 0 fail_msg: "No file found for saphana_client" when: - - sap_install_media_detect_db | d('') == 'saphana' or - sap_install_media_detect_db_client | d('') == 'saphana' + - sap_install_media_detect_db == 'saphana' or + sap_install_media_detect_db_client == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: @@ -232,7 +232,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase') | length > 0 fail_msg: "No file found for sapase" when: - - sap_install_media_detect_db | d('') == 'sapase' + - sap_install_media_detect_db == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapase_client is present ansible.builtin.assert: @@ -240,8 +240,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase_client') | length > 0 fail_msg: "No file found for sapase_client" when: - - sap_install_media_detect_db | d('') == 'sapase' or - sap_install_media_detect_db_client | d('') == 'sapase' + - sap_install_media_detect_db == 'sapase' or + sap_install_media_detect_db_client == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: @@ -249,7 +249,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapmaxdb') | length > 0 fail_msg: "No file found for sapmaxdb" when: - - sap_install_media_detect_db | d('') == 'sapmaxdb' + - sap_install_media_detect_db == 'sapmaxdb' - name: SAP Install Media Detect - Prepare - Assert that oracledb is present ansible.builtin.assert: @@ -257,7 +257,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb') | length > 0 fail_msg: "No file found for oracledb" when: - - sap_install_media_detect_db | d('') == 'oracledb' + - sap_install_media_detect_db == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that oracledb_client is present ansible.builtin.assert: @@ -265,8 +265,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb_client') | length > 0 fail_msg: "No file found for oracledb_client" when: - - sap_install_media_detect_db | d('') == 'oracledb' or - sap_install_media_detect_db_client | d('') == 'oracledb' + - sap_install_media_detect_db == 'oracledb' or + sap_install_media_detect_db_client == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: @@ -274,7 +274,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2') | length > 0 fail_msg: "No file found for ibmdb2" when: - - sap_install_media_detect_db | d('') == 'ibmdb2' + - sap_install_media_detect_db == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_client is present ansible.builtin.assert: @@ -282,8 +282,8 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_client') | length > 0 fail_msg: "No file found for ibmdb2_client" when: - - sap_install_media_detect_db | d('') == 'ibmdb2' or - sap_install_media_detect_db_client | d('') == 'ibmdb2' + - sap_install_media_detect_db == 'ibmdb2' or + sap_install_media_detect_db_client == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: @@ -291,7 +291,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_license') | length > 0 fail_msg: "No file found for ibmdb2_license" when: - - sap_install_media_detect_db | d('') == 'ibmdb2' + - sap_install_media_detect_db == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that sap_export_s4hana is present ansible.builtin.assert: @@ -299,7 +299,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_s4hana') | length > 0 fail_msg: "No file found for sap_export_s4hana" when: - - sap_install_media_detect_export | d('') == 'saps4hana' + - sap_install_media_detect_export == 'saps4hana' - name: SAP Install Media Detect - Prepare - Assert that sap_export_bw4hana is present ansible.builtin.assert: @@ -307,7 +307,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_bw4hana') | length > 0 fail_msg: "No file found for sap_export_bw4hana" when: - - sap_install_media_detect_export | d('') == 'sapbw4hana' + - sap_install_media_detect_export == 'sapbw4hana' - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc is present ansible.builtin.assert: @@ -315,7 +315,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc') | length > 0 fail_msg: "No file found for sap_export_ecc" when: - - sap_install_media_detect_export | d('') == 'sapecc' + - sap_install_media_detect_export == 'sapecc' - name: SAP Install Media Detect - Prepare - Assert that sap_export_ecc_ides is present ansible.builtin.assert: @@ -323,7 +323,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_ecc_ides') | length > 0 fail_msg: "No file found for sap_export_ecc_ides" when: - - sap_install_media_detect_export | d('') == 'sapecc_ides' + - sap_install_media_detect_export == 'sapecc_ides' - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_abap is present ansible.builtin.assert: @@ -331,7 +331,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_abap') | length > 0 fail_msg: "No file found for sap_export_nwas_abap" when: - - sap_install_media_detect_export | d('') == 'sapnwas_abap' + - sap_install_media_detect_export == 'sapnwas_abap' - name: SAP Install Media Detect - Prepare - Assert that sap_export_nwas_java is present ansible.builtin.assert: @@ -339,7 +339,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_nwas_java') | length > 0 fail_msg: "No file found for sap_export_nwas_java" when: - - sap_install_media_detect_export | d('') == 'sapnwas_java' + - sap_install_media_detect_export == 'sapnwas_java' - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_abap is present ansible.builtin.assert: @@ -347,7 +347,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_abap') | length > 0 fail_msg: "No file found for sap_export_solman_abap" when: - - sap_install_media_detect_export | d('') == 'sapsolman_abap' + - sap_install_media_detect_export == 'sapsolman_abap' - name: SAP Install Media Detect - Prepare - Assert that sap_export_solman_java is present ansible.builtin.assert: @@ -355,7 +355,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sap_export_solman_java') | length > 0 fail_msg: "No file found for sap_export_solman_java" when: - - sap_install_media_detect_export | d('') == 'sapsolman_java' + - sap_install_media_detect_export == 'sapsolman_java' #- name: SAP Install Media Detect - Prepare - Identify the sapcar program # ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 2492814f3..7cf50b8f6 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -53,13 +53,14 @@ - not sap_install_media_detect_move_or_copy_archives - sap_install_media_detect_db == 'saphana' -- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA - sap_swpm +- name: SAP Install Media Detect - Detection completed - Set facts for SAP HANA Client - sap_swpm ansible.builtin.set_fact: sap_swpm_cd_rdbms_path: "{{ sap_hana_client_path.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == 'saphana' + - sap_install_media_detect_db == 'saphana' or + sap_install_media_detect_db_client == 'saphana' # In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64'. For the role sap_swpm, we need to set # exactly this path @@ -70,6 +71,12 @@ ignore_errors: true when: sap_install_media_detect_db == 'ibmdb2' +- name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 Client + ansible.builtin.set_fact: + sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db_client == 'ibmdb2' + # In 'find_files_after_extraction.yml', we search for a directory name which contains 'LINUX_X86_64'. For the role sap_swpm, we need # to set the path which contains this directory, not the directory itself. For the Oracle client, we search for a directory name which # contains 'OCL_LINUX_X86_64'. For the role sap_swpm, we also need the path which contains this directory. @@ -81,6 +88,12 @@ ignore_errors: true when: sap_install_media_detect_db == 'oracledb' +- name: SAP Install Media Detect - Detection completed - Set facts for Oracle DB Client + ansible.builtin.set_fact: + sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db_client == 'oracledb' + # In 'find_files_after_extraction.yml', we search for a directory name which contains 'SYBASE_LINUX'. For the role sap_swpm, we need # to set exactly this path. For the ASE client, we search for a directory which contains 'sybodbc'. For the role # sap_swpm, we need to set exactly this path. @@ -91,6 +104,12 @@ ignore_errors: true when: sap_install_media_detect_db == 'sapase' +- name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE Client + ansible.builtin.set_fact: + sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role + ignore_errors: true + when: sap_install_media_detect_db_client == 'sapase' + - name: SAP Install Media Detect - Detection completed - Set facts for SAP MaxDB ansible.builtin.set_fact: sap_swpm_cd_sapmaxdb_path: "{{ detect_directory_sapmaxdb_extracted.files[0].path }}/" # for sap_swpm Ansible Role @@ -106,17 +125,20 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, unspecific ansible.builtin.set_fact: sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}/" - sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" + sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get_db_unspecific.stdout }}" when: - - sap_install_media_detect_kernel_db is not defined - sap_install_media_detect_kernel + - sap_install_media_detect_kernel_db is not defined or + sap_install_media_detect_kernel_db | length == 0 - name: SAP Install Media Detect - Detection completed - Set facts for SAPEXEDB, specific ansible.builtin.set_fact: sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}/" - sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get }}" + sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get_db_specific }}" when: + - sap_install_media_detect_kernel - sap_install_media_detect_kernel_db is defined + - sap_install_media_detect_kernel_db | length > 0 - name: SAP Install Media Detect - Detection completed - Set facts for SAP IGS ansible.builtin.set_fact: From 2f3d2e1e7f47b14607ef1e01230bc741f3bf58d4 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 20 Sep 2023 22:01:15 +0200 Subject: [PATCH 131/179] sap_install_media_detect: ensure the presence of the unzip package --- roles/sap_install_media_detect/README.md | 1 + roles/sap_install_media_detect/tasks/main.yml | 7 +++++++ .../tasks/prepare/enable_zip_handling.yml | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 roles/sap_install_media_detect/tasks/prepare/enable_zip_handling.yml diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index 22823bdca..48cedcb89 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -44,6 +44,7 @@ This role does not depend on any other Ansible Role. ## Tags With the following tags, the role can be called to perform certain activities only: +- tag `sap_install_media_detect_zip_handling`: Only perform the task for enabling the listing and extracting of files of type `ZIP`. - tag `sap_install_media_detect_rar_handling`: Only perform the tasks for enabling the listing and extracting of files of type `RAR`. This includes enabling and disabling the EPEL repo for RHEL systems, if desired. - tag `sap_install_media_detect_add_file_extension`: Add file name extensions to any files in `sap_install_media_detect_source_directory` which are of type `RAR` or `ZIP` and have no ending. Needs to be used with tag `sap_install_media_detect_create_file_list_phase_1`. diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index f25074ff5..932a540ec 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -12,6 +12,13 @@ tags: sap_install_media_detect_provide_sapfile_utility tags: sap_install_media_detect_provide_sapfile_utility +- name: SAP Install Media Detect - Prepare - Enable zip handling + ansible.builtin.include_tasks: + file: prepare/enable_zip_handling.yml + apply: + tags: sap_install_media_detect_zip_handling + tags: sap_install_media_detect_zip_handling + - name: SAP Install Media Detect - Prepare - Enable rar handling ansible.builtin.include_tasks: file: prepare/enable_rar_handling.yml diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_zip_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_zip_handling.yml new file mode 100644 index 000000000..3c154e896 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/enable_zip_handling.yml @@ -0,0 +1,6 @@ +--- + +- name: SAP Install Media Detect - Prepare - Ensure the presence of the 'unzip' package + ansible.builtin.package: + name: 'unzip' + state: present From 8834b612e216685959e9ae13293685af5d8102ff Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 20 Sep 2023 16:33:52 +0200 Subject: [PATCH 132/179] sap_ha_pacemaker_cluster: fix: typo in README --- roles/sap_ha_pacemaker_cluster/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index eb5a60660..a844702f0 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -73,7 +73,7 @@ The Ansible Control System (where Ansible is executed from) must have: - Ansible Collection [`redhat.sap_install` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/sap_install) version `1.3.0` or later - Ansible Collection [`redhat.rhel_system_roles` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles) version `1.20.0` or later - **Supported (Downstream)** via RHEL4SAP license: - - RHEL System Roles for SAP RPM Package `rhel-system-roles-3.6.0` or later + - RHEL System Roles for SAP RPM Package `rhel-system-roles-sap-3.6.0` or later - RHEL System Roles RPM Package `rhel-system-roles-1.20.0` or later ## Prerequisites From d7769d026535a70e26faf4e7eab879e21e9b8c80 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 21 Sep 2023 11:12:17 +0200 Subject: [PATCH 133/179] sap*preconfigure: Install package libxcrypt-compat on RHEL 9.x Solves issue #457. --- roles/sap_general_preconfigure/vars/RedHat_9.yml | 6 ++++++ roles/sap_hana_preconfigure/vars/RedHat_9.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/roles/sap_general_preconfigure/vars/RedHat_9.yml b/roles/sap_general_preconfigure/vars/RedHat_9.yml index 1b025cc48..ca0d473b7 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_9.yml @@ -62,6 +62,8 @@ __sap_general_preconfigure_packages_x86_64: - hostname # package tuned: no longer part of package group "Core" in RHEL 9, so we have to install it - tuned +# package libxcrypt-compat: needed by sapstartsrv and SAP HANA on RHEL 9: + - libxcrypt-compat __sap_general_preconfigure_packages_ppc64le: - uuidd @@ -74,6 +76,8 @@ __sap_general_preconfigure_packages_ppc64le: - hostname # package tuned: no longer part of package group "Core" in RHEL 9, so we have to install it - tuned +# package libxcrypt-compat: needed by sapstartsrv and SAP HANA on RHEL 9: + - libxcrypt-compat __sap_general_preconfigure_packages_s390x: - uuidd @@ -86,6 +90,8 @@ __sap_general_preconfigure_packages_s390x: - hostname # package tuned: no longer part of package group "Core" in RHEL 9, so we have to install it - tuned +# package libxcrypt-compat: needed by sapstartsrv on RHEL 9: + - libxcrypt-compat __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" diff --git a/roles/sap_hana_preconfigure/vars/RedHat_9.yml b/roles/sap_hana_preconfigure/vars/RedHat_9.yml index 58e2863d0..11c862ef9 100644 --- a/roles/sap_hana_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_hana_preconfigure/vars/RedHat_9.yml @@ -192,8 +192,8 @@ __sap_hana_preconfigure_packages: - chkconfig # package compat-openssl11: needed for HANA scale-out and when configuring HANA backup on Azure - compat-openssl11 -# required for SAP HANA on RHEL 9: - - libxcrypt-compat +# package libxcrypt-compat: needed SAP HANA and also by sapstartsrv on RHEL 9: +# - libxcrypt-compat # now installed by role sap_general_preconfigure, see also SAP note 3108316, version 4. # For support purposes: # package graphwiz: graph visualization toos, for supportability) - graphviz From 8868553c52cd4ba4cce7774de5fdf35947f54547 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 21 Sep 2023 12:51:36 +0200 Subject: [PATCH 134/179] sap_general_preconfigure: Improve SELinux handling - Fixes #464: Allow more directories than just '/usr/sap' to be created and SELinux labeled - Also fixes #355. The role will now skip calling the lsr/selinux role if the current SELinux state is 'disabled' and a relabeling is requested. It will also display a warning message about this fact. After a reboot, once the SELinux state is 'permissive' or 'enforcing', the role can be called again and then perform the SELinux relabeling. --- roles/sap_general_preconfigure/README.md | 18 ++++++++++++- .../defaults/main.yml | 12 ++++++++- .../meta/argument_specs.yml | 21 ++++++++++++++- .../tasks/RedHat/configuration.yml | 26 +++++++++++++++++-- .../RedHat/generic/configure-selinux.yml | 22 +++++++++++++--- 5 files changed, 90 insertions(+), 9 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index 60a120d95..636ba7660 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -237,11 +237,27 @@ Can be useful if you want to implement your own reboot handling.
One of the SELinux states to be set on the system.
+### sap_general_preconfigure_create_directories +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` if you do not want the SAP directories to be created by the role.
+The SAP directories will always be created if `sap_general_preconfigure_modify_selinux_labels`
+(see below) is set to `true`, no matter how `sap_general_preconfigure_create_directories` is set.
+ +### sap_general_preconfigure_sap_directories +- _Type:_ `list` with elements of type `str` +- _Default:_ + - /usr/sap + +List of SAP directories to be created.
+ ### sap_general_preconfigure_modify_selinux_labels - _Type:_ `bool` - _Default:_ `true` -Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`.
+Set to `false` if you do not want to modify the SELinux labels for the SAP directores set
+in variable `sap_general_preconfigure_sap_directories`.
### sap_general_preconfigure_size_of_tmpfs_gb - _Type:_ `str` diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index e5a1829e9..9687a15ac 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -115,8 +115,18 @@ sap_general_preconfigure_selinux_state: 'permissive' # - permissive # - disabled +sap_general_preconfigure_create_directories: true +# Set to `false` if you do not want the SAP directories to be created by the role. +# The SAP directories will always be created if `sap_general_preconfigure_modify_selinux_labels` +# (see below) is set to `true`, no matter how `sap_general_preconfigure_create_directories` is set. + +sap_general_preconfigure_sap_directories: + - /usr/sap +# List of SAP directories to be created. + sap_general_preconfigure_modify_selinux_labels: true -# Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`. +# Set to `false` if you do not want to modify the SELinux labels for the SAP directores set +# in variable `sap_general_preconfigure_sap_directories`. sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}" # The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735. diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index ce48ec90d..2d5993d95 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -240,10 +240,29 @@ argument_specs: required: false type: str + sap_general_preconfigure_create_directories: + default: true + description: + - Set to `false` if you do not want the SAP directories to be created by the role. + - The SAP directories will always be created if `sap_general_preconfigure_modify_selinux_labels` + - (see below) is set to `true`, no matter how `sap_general_preconfigure_create_directories` is set. + required: false + type: bool + + sap_general_preconfigure_sap_directories: + default: + - '/usr/sap' + description: + - List of SAP directories to be created. + required: false + type: list + elements: str + sap_general_preconfigure_modify_selinux_labels: default: true description: - - Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`. + - Set to `false` if you do not want to modify the SELinux labels for the SAP directores set + - in variable `sap_general_preconfigure_sap_directories`. required: false type: bool diff --git a/roles/sap_general_preconfigure/tasks/RedHat/configuration.yml b/roles/sap_general_preconfigure/tasks/RedHat/configuration.yml index df5a48e9b..5893e00a9 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/configuration.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/configuration.yml @@ -4,13 +4,35 @@ ansible.builtin.debug: var: __sap_general_preconfigure_sapnotes_versions | difference(['']) -- name: Configure - Create directory '/usr/sap' +- name: Configure - Set directory variables for setting SELinux file contexts + ansible.builtin.set_fact: + sap_general_preconfigure_fact_targets_setypes: "{{ sap_general_preconfigure_fact_targets_setypes | d([]) + + [__sap_general_preconfigure_tmp_dict_target_setype] }}" + loop: "{{ sap_general_preconfigure_sap_directories }}" + loop_control: + loop_var: line_item + vars: + __sap_general_preconfigure_tmp_dict_target_setype: + target: "{{ line_item }}(/.*)?" + setype: 'usr_t' + when: sap_general_preconfigure_modify_selinux_labels + +- name: Configure - Display directory variable + ansible.builtin.debug: + var: sap_general_preconfigure_fact_targets_setypes + when: sap_general_preconfigure_modify_selinux_labels + +- name: Configure - Create directories ansible.builtin.file: - path: '/usr/sap' + path: "{{ line_item }}" state: directory mode: '0755' owner: root group: root + loop: "{{ sap_general_preconfigure_sap_directories }}" + loop_control: + loop_var: line_item + when: sap_general_preconfigure_create_directories or sap_general_preconfigure_modify_selinux_labels - name: Configure - Include configuration actions for required sapnotes ansible.builtin.include_tasks: "sapnote/{{ sap_note_line_item.number }}.yml" diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml index 4e09d3772..84375db92 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -24,6 +24,10 @@ check_mode: no changed_when: false +- name: SELinux - Display the current SELinux state + ansible.builtin.debug: + var: __sap_general_preconfigure_register_getenforce.stdout + # Reason for noqa: We need to notify a handler in another role, which is not possible from a handler in the current role - name: SELinux - Set the flag that reboot is needed to apply changes # noqa no-handler ansible.builtin.set_fact: @@ -96,14 +100,24 @@ ansible.builtin.debug: var: sap_general_preconfigure_fact_reboot_required | d(false) -- name: Configure '/usr/sap' SELinux file labels +- name: SELinux - Warn if the SELinux file contexts cannot be set + ansible.builtin.debug: + msg: "WARN: The SELinux file context cannot be set on an SELinux disabled system!" + when: + - sap_general_preconfigure_modify_selinux_labels + - __sap_general_preconfigure_register_getenforce.stdout | lower == 'disabled' + +- name: SELinux - Configure SELinux file contexts ansible.builtin.include_role: name: '{{ sap_general_preconfigure_system_roles_collection }}.selinux' vars: selinux_booleans: - { name: 'selinuxuser_execmod', state: 'on' } selinux_fcontexts: - - { target: '/usr/sap(/.*)?', setype: 'usr_t' } + - "{{ sap_general_preconfigure_fact_targets_setypes }}" selinux_restore_dirs: - - '/usr/sap' - when: sap_general_preconfigure_modify_selinux_labels + - "{{ sap_general_preconfigure_sap_directories }}" + when: + - sap_general_preconfigure_modify_selinux_labels + - sap_general_preconfigure_selinux_state != 'disabled' + - __sap_general_preconfigure_register_getenforce.stdout | lower != 'disabled' From 340f6548ff88f43dbee46d4ebc1e558282fbbcca Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 21 Sep 2023 14:04:16 +0200 Subject: [PATCH 135/179] sap_general_preconfigure: Use the ansible_selinux variable for determining the SELinux status or mode --- .../RedHat/generic/configure-selinux.yml | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml index 84375db92..dfa7208e4 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -18,15 +18,15 @@ register: __sap_general_preconfigure_register_selinux_config_type_changed notify: __sap_general_preconfigure_reboot_handler -- name: Determine the current SELinux state - ansible.builtin.command: getenforce - register: __sap_general_preconfigure_register_getenforce - check_mode: no - changed_when: false +# Set a new SELinux mode variable to the SELinux status if 'disabled' or otherwise to +# the value of the 'mode' member ('permissive' or 'enforcing') +- name: SELinux - Set an SELinux mode variable + ansible.builtin.set_fact: + __sap_general_preconfigure_fact_selinux_mode: "{{ (ansible_selinux.status == 'disabled') | ternary (ansible_selinux.status, ansible_selinux.mode) }}" -- name: SELinux - Display the current SELinux state +- name: SELinux - Display the current SELinux mode or status ansible.builtin.debug: - var: __sap_general_preconfigure_register_getenforce.stdout + var: __sap_general_preconfigure_fact_selinux_mode # Reason for noqa: We need to notify a handler in another role, which is not possible from a handler in the current role - name: SELinux - Set the flag that reboot is needed to apply changes # noqa no-handler @@ -34,14 +34,12 @@ sap_general_preconfigure_fact_reboot_required: true when: __sap_general_preconfigure_register_selinux_config_state_changed.changed or __sap_general_preconfigure_register_selinux_config_type_changed.changed or - __sap_general_preconfigure_register_getenforce.stdout | lower != - sap_general_preconfigure_selinux_state + __sap_general_preconfigure_fact_selinux_mode != sap_general_preconfigure_selinux_state - name: Call Reboot handler if necessary ansible.builtin.command: /bin/true notify: __sap_general_preconfigure_reboot_handler - when: __sap_general_preconfigure_register_getenforce.stdout | lower != - sap_general_preconfigure_selinux_state + when: __sap_general_preconfigure_fact_selinux_mode != sap_general_preconfigure_selinux_state - name: Set or unset SELinux kernel parameter, RHEL 8 and RHEL 9 when: @@ -105,7 +103,7 @@ msg: "WARN: The SELinux file context cannot be set on an SELinux disabled system!" when: - sap_general_preconfigure_modify_selinux_labels - - __sap_general_preconfigure_register_getenforce.stdout | lower == 'disabled' + - __sap_general_preconfigure_fact_selinux_mode == 'disabled' - name: SELinux - Configure SELinux file contexts ansible.builtin.include_role: @@ -120,4 +118,4 @@ when: - sap_general_preconfigure_modify_selinux_labels - sap_general_preconfigure_selinux_state != 'disabled' - - __sap_general_preconfigure_register_getenforce.stdout | lower != 'disabled' + - __sap_general_preconfigure_fact_selinux_mode != 'disabled' From 93c0eb2d416e71de0c318749d260f4a1d56f4275 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 21 Sep 2023 17:21:06 +0200 Subject: [PATCH 136/179] sap_install_media_detect: fix sap_install_media_detect_db condition --- .../tasks/prepare/create_file_list_phase_2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 3871186e4..e65f93859 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -215,7 +215,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana') | length > 0 fail_msg: "No file found for saphana" when: - - sap_install_media_detect_db + - sap_install_media_detect_db == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that saphana_client is present ansible.builtin.assert: From f7e8f66e2a1fffef70ff6615a1dde4a1454f042f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 21 Sep 2023 10:31:36 +0200 Subject: [PATCH 137/179] sap_storage_setup: fix: throttle NFS mount tasks --- .../tasks/generic_tasks/configure_nfs_filesystems.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 622a27fa5..303174207 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -113,6 +113,7 @@ register: sap_storage_setup_tmpnfs_register - name: SAP Storage Setup - ({{ nfs_item.name }}) Attach NFS host root for subdirectory verification/creation + throttle: 1 # avoid NFS request flooding and silent timeout failures (observed on MS Azure Files) ansible.posix.mount: path: "{{ sap_storage_setup_tmpnfs_register.path }}" src: "{{ attach_item.nfs_server | default(sap_storage_setup_nfs_server) }}" @@ -154,6 +155,7 @@ always: - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount + throttle: 1 # avoid NFS request flooding and silent timeout failures (observed on MS Azure Files) ansible.posix.mount: path: "{{ sap_storage_setup_tmpnfs_register.path }}" state: absent @@ -175,6 +177,7 @@ # ##### - name: SAP Storage Setup - ({{ nfs_item.name }}) Mount NFS + throttle: 1 # avoid NFS request flooding and silent timeout failures (observed on MS Azure Files) ansible.posix.mount: path: "{{ mount_item.mountpoint }}" src: "{{ nfs_server }}/{{ mount_item.mount_src | regex_replace('^/', '') }}" From 8e69838663dad852d3132baac6c8cd35e0987aa2 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 21 Sep 2023 20:15:49 +0200 Subject: [PATCH 138/179] sap_ha_pacemaker_cluster: parameter re-organization - sorted and updated defaults - sorted and updated argument specifications in sync with the defaults - adjusted 'ha_cluster' LSR parameter import and construction flow - new: all parameters are transformed into 'ha_cluster' native variables at play level - new: the 'ha_cluster' role include now relies on the new native variables, no more static list of vars --- roles/sap_ha_pacemaker_cluster/README.md | 470 +++++++--- .../defaults/main.yml | 238 ++--- .../meta/argument_specs.yml | 818 +++++++++++++----- .../ascertain_ha_cluster_in_inventory.yml | 54 -- .../tasks/construct_final_hacluster_vars.yml | 95 ++ .../tasks/construct_vars_common.yml | 42 +- .../tasks/construct_vars_stonith.yml | 16 +- .../construct_vars_vip_resources_default.yml | 3 +- .../import_hacluster_vars_from_inventory.yml | 94 ++ roles/sap_ha_pacemaker_cluster/tasks/main.yml | 71 +- roles/sap_ha_pacemaker_cluster/vars/main.yml | 31 +- 11 files changed, 1389 insertions(+), 543 deletions(-) delete mode 100644 roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index a844702f0..7caef631d 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -134,68 +134,84 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions Minimum required parameters: - [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) +- [sap_ha_pacemaker_cluster_hana_instance_number](#sap_ha_pacemaker_cluster_hana_instance_number) +- [sap_ha_pacemaker_cluster_hana_sid](#sap_ha_pacemaker_cluster_hana_sid) -### ha_cluster - -- _Type:_ `dict` - -Optional _**host_vars**_ parameter - if defined it must be set for each node.
-Dictionary that can contain various node options for the pacemaker cluster configuration.
-Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].
- -Example: - -```yaml -ha_cluster: - corosync_addresses: - - 192.168.1.10 - - 192.168.2.10 - node_name: nodeA -``` - ### sap_ha_pacemaker_cluster_aws_access_key_id - _Type:_ `str` AWS access key to allow control of instances (for example for fencing operations).
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for the cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_region - _Type:_ `str` The AWS region in which the instances to be used for the cluster setup are located.
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_secret_access_key - _Type:_ `str` AWS secret key, paired with the access key for instance control.
-Required for cluster nodes setup on Amazon cloud.
+Mandatory for the cluster setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_vip_update_rt - _Type:_ `list` List one more routing table IDs for managing Virtual IP failover through routing table changes.
-Required for VIP configuration in AWS EC2 environments.
+Mandatory for the VIP resource configuration in AWS EC2 environments.
### sap_ha_pacemaker_cluster_cluster_name - _Type:_ `str` -- _Default:_ `my-cluster` The name of the pacemaker cluster.
Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined.
+If not defined, the `ha_cluster` Linux System Role default will be used.
+ +### sap_ha_pacemaker_cluster_cluster_nodes + +- _Type:_ `list` + +List of cluster nodes and associated attributes to describe the target SAP HA environment.
+This is required for the HANA System Replication configuration.
+Synonym for this parameter is `sap_hana_cluster_nodes`.
+ +- **hana_site**
+ Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. +- **node_ip**
+ IP address of the node used for HANA System Replication. +- **node_name**
+ Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. +- **node_role**
+ Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. + +Example: + +```yaml +sap_ha_pacemaker_cluster_cluster_nodes: +- hana_site: DC01 + node_ip: 192.168.5.1 + node_name: nodeA + node_role: primary +- hana_site: DC02 + node_ip: 192.168.5.2 + node_name: nodeB + node_role: secondary +``` ### sap_ha_pacemaker_cluster_cluster_properties - _Type:_ `dict` -- _Default:_ `See example` +- _Default:_ `{'concurrent-fencing': True, 'stonith-enabled': True, 'stonith-timeout': 900}` Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing.
+When no STONITH resource is defined, STONITH will be disabled and a warning displayed.
Example: @@ -226,9 +242,31 @@ This allows using the output file later as input file for additional custom step When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes.
WARNING! This report may include sensitive details like secrets required for certain cluster resources!
+### sap_ha_pacemaker_cluster_extra_packages + +- _Type:_ `list` + +Additional extra packages to be installed, for instance specific resource packages.
+For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included.
+ +### sap_ha_pacemaker_cluster_fence_agent_minimal_packages + +- _Type:_ `list` +- _Default:_ `['fence-agents-all']` + +The minimal set of fence agent packages that will be installed.
+ +### sap_ha_pacemaker_cluster_fence_agent_packages + +- _Type:_ `list` + +Additional fence agent packages to be installed.
+This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`.
+ ### sap_ha_pacemaker_cluster_fence_options - _Type:_ `dict` +- _Default:_ `{'pcmk_reboot_retries': 4, 'pcmk_reboot_timeout': 400, 'power_timeout': 240}` STONITH resource common parameters that apply to most fencing agents.
These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS).
@@ -244,11 +282,46 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ``` +### sap_ha_pacemaker_cluster_gcp_project + +- _Type:_ `str` + +Google Cloud project name in which the target instances are installed.
+Mandatory for the cluster setup on GCP instances.
+ +### sap_ha_pacemaker_cluster_gcp_region_zone + +- _Type:_ `str` + +Goocle Cloud Platform region zone ID.
+Mandatory for the cluster setup on GCP instances.
+ +### sap_ha_pacemaker_cluster_ha_cluster + +- _Type:_ `dict` + +The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym.
+Optional _**host_vars**_ parameter - if defined it must be set for each node.
+Dictionary that can contain various node options for the pacemaker cluster configuration.
+Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md].
+If not defined, the `ha_cluster` Linux System Role default will be used.
+ +Example: + +```yaml +sap_ha_pacemaker_cluster_ha_cluster: + corosync_addresses: + - 192.168.1.10 + - 192.168.2.10 + node_name: nodeA +``` + ### sap_ha_pacemaker_cluster_hacluster_password required - _Type:_ `str` The password of the `hacluster` user which is created during pacemaker installation.
+Inherits the value of `ha_cluster_hacluster_password`, when defined.
### sap_ha_pacemaker_cluster_hana_automated_register @@ -268,6 +341,13 @@ Time difference needed between to primary time stamps, if a dual-primary situati If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status.
This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed.
+### sap_ha_pacemaker_cluster_hana_instance_number required + +- _Type:_ `str` + +The instance number of the SAP HANA database which this role will configure in the cluster.
+Inherits the value of `sap_hana_instance_number`, when defined.
+ ### sap_ha_pacemaker_cluster_hana_prefer_site_takeover - _Type:_ `bool` @@ -277,6 +357,13 @@ Parameter for the 'SAPHana' cluster resource.
Set to "false" if the cluster should first attempt to restart the instance on the same node.
When set to "true" (default) a failover to secondary will be initiated on resource failure.
+### sap_ha_pacemaker_cluster_hana_resource_clone_name + +- _Type:_ `str` +- _Default:_ `SAPHana__-clone` + +Customize the cluster resource name of the SAP HANA DB resource clone.
+ ### sap_ha_pacemaker_cluster_hana_resource_name - _Type:_ `str` @@ -284,6 +371,21 @@ When set to "true" (default) a failover to secondary will be initiated on resour Customize the cluster resource name of the SAP HANA DB resource.
+### sap_ha_pacemaker_cluster_hana_sid required + +- _Type:_ `str` + +The SAP HANA SID of the instance that will be configured in the cluster.
+The SID must follow SAP specifications - see SAP Note 1979280.
+Inherits the value of `sap_hana_sid`, when defined.
+ +### sap_ha_pacemaker_cluster_hana_topology_resource_clone_name + +- _Type:_ `str` +- _Default:_ `SAPHanaTopology__-clone` + +Customize the cluster resource name of the SAP HANA Topology resource clone.
+ ### sap_ha_pacemaker_cluster_hana_topology_resource_name - _Type:_ `str` @@ -291,23 +393,60 @@ Customize the cluster resource name of the SAP HANA DB resource.
Customize the cluster resource name of the SAP HANA Topology resource.
+### sap_ha_pacemaker_cluster_host_type + +- _Type:_ `str` +- _Default:_ `hana_scaleup_perf` + +The SAP landscape to for which the cluster is to be configured.
+The default is a 2-node SAP HANA scale-up cluster.
+ ### sap_ha_pacemaker_cluster_ibmcloud_api_key - _Type:_ `str` -The API key is required to allow control of instances (for example for fencing operations).
-Required for cluster nodes setup in IBM Cloud.
+The API key which is required to allow the control of instances (for example for fencing operations).
+Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances.
### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `str` -The cloud region key in which the instances are running.
-Required for cluster nodes setup in IBM Cloud.
+The IBM Cloud VS region name in which the instances are running.
+Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances.
+ +### sap_ha_pacemaker_cluster_msazure_resource_group + +- _Type:_ `str` + +Resource group name/ID in which the target instances are defined.
+Mandatory for the cluster setup on MS Azure instances.
+ +### sap_ha_pacemaker_cluster_msazure_subscription_id + +- _Type:_ `str` + +Subscription ID of the MS Azure environment containing the target instances.
+Mandatory for the cluster setup on MS Azure instances.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP AAS instance.
+Mandatory for NetWeaver AAS cluster configuration.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems + +- _Type:_ `list` +- _Default:_ `['/ASCS', '/ERS']` + +Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name - _Type:_ `str` +- _Default:_ `Filesystem_NWAS_ABAP_ASCS__` Name of the filesystem resource for the ASCS instance.
@@ -318,6 +457,13 @@ Name of the filesystem resource for the ASCS instance.
NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
+### sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP ASCS instance.
+Mandatory for NetWeaver ASCS/ERS cluster configuration.
+ ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool - _Type:_ `bool` @@ -331,7 +477,7 @@ NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
- _Default:_ `60` NetWeaver ASCS instance failure-timeout attribute.
-Only used for ENSA1 setups. Default is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold @@ -339,18 +485,19 @@ Only used for ENSA1 setups. Default is ENSA2.
- _Default:_ `1` NetWeaver ASCS instance migration-threshold setting attribute.
-Only used for ENSA1 setups. Default is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name - _Type:_ `str` The name of the ASCS instance, typically the profile name.
-Required for the NetWeaver ASCS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name - _Type:_ `str` +- _Default:_ `SAPInstance_NWAS_ABAP_ASCS__` Name of the ASCS instance resource.
@@ -366,14 +513,22 @@ NetWeaver ASCS instance resource stickiness attribute.
- _Type:_ `str` The full path and name of the ASCS instance profile.
-Required for the NetWeaver ASCS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name - _Type:_ `str` +- _Default:_ `Filesystem_NWAS_ABAP_ERS__` Name of the filesystem resource for the ERS instance.
+### sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP ERS instance.
+Mandatory for NetWeaver ASCS/ERS cluster configuration.
+ ### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool - _Type:_ `bool` @@ -386,11 +541,12 @@ NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
- _Type:_ `str` The name of the ERS instance, typically the profile name.
-Required for the NetWeaver ERS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name - _Type:_ `str` +- _Default:_ `SAPInstance_NWAS_ABAP_ERS__` Name of the ERS instance resource.
@@ -399,7 +555,64 @@ Name of the ERS instance resource.
- _Type:_ `str` The full path and name of the ERS instance profile.
-Required for the NetWeaver ERS resource.
+Mandatory for the NetWeaver ASCS/ERS cluster.
+ +### sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number + +- _Type:_ `str` + +Instance number of the NetWeaver ABAP PAS instance.
+Mandatory for NetWeaver PAS cluster configuration.
+ +### sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + +- _Type:_ `bool` +- _Default:_ `False` + +The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2.
+Set this parameter to 'true' to configure it as ENSA1.
+ +### sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_SAPMNT_` + +Filesystem resource name for the shared filesystem /sapmnt.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+ +### sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + +- _Type:_ `bool` +- _Default:_ `False` + +Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources.
+ +### sap_ha_pacemaker_cluster_netweaver_sid + +- _Type:_ `str` + +SID of the NetWeaver instances.
+Mandatory for NetWeaver cluster configuration.
+Uses `sap_swpm_sid` if defined.
+ +### sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_SYS_` + +Filesystem resource name for the transports filesystem /usr/sap//SYS.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+ +### sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name + +- _Type:_ `str` +- _Default:_ `Filesystem_NWAS_TRANS_` + +Filesystem resource name for the transports filesystem /usr/sap/trans.
+Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
+Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
### sap_ha_pacemaker_cluster_replication_type @@ -412,7 +625,7 @@ _Not yet supported_
### sap_ha_pacemaker_cluster_resource_defaults - _Type:_ `dict` -- _Default:_ `See example` +- _Default:_ `{'migration-threshold': 5000, 'resource-stickiness': 3000}` Set default parameters that will be valid for all pacemaker resources.
@@ -424,6 +637,106 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` +### sap_ha_pacemaker_cluster_stonith_custom + +- _Type:_ `list` + +Custom list of STONITH resource(s) to be configured in the cluster.
+This definition override any defaults the role would apply otherwise.
+ +- **agent**
+ Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. +- **name**
+ Name that will be used as the resource ID (name). +- **options**
+ The resource options listed in dictionary format, one option per line.
Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. + +Example: + +```yaml +sap_ha_pacemaker_cluster_stonith_custom: +- agent: stonith:fence_rhevm + name: my-fence-resource + options: + ip: rhevm-server + password: login-user-password + pcmk_host_list: node1,node2 + power_wait: 3 + username: login-user +``` + +### sap_ha_pacemaker_cluster_storage_definition + +- _Type:_ `list` + +List of filesystem definitions used for filesystem cluster resources.
+Uses `sap_storage_setup_definition` when defined.
+ +- **mountpoint**
+ Path under which the filesystem will be mounted.
Mandatory for all filesystems that have a mountpoint.
Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap//" and "/usr/sap//SYS". +- **name**
+ Unique name of the filesystem definition entry. +- **nfs_filesystem_type**
+ _Default:_ ``
+ NFS filesystem type used to mount this filesystem. +- **nfs_mount_options**
+ _Default:_ ``
+ Mount options to be used for this specific filesystem. +- **nfs_path**
+ Path to the filesystem source directory on the NFS server. +- **nfs_server**
+ _Default:_ ``
+ Name of the NFS server for this particular filesystem. + +Example: + +```yaml +sap_ha_pacemaker_cluster_storage_definition: +- mountpoint: /usr/sap + name: usr_sap + nfs_path: /usr/sap + nfs_server: nfs-server.example.com:/ +- mountpoint: /usr/sap/trans + name: usr_sap_trans + nfs_path: /usr/sap/trans + nfs_server: nfs-server.example.com:/ +- mountpoint: /sapmnt + name: sapmnt + nfs_filesystem_type: nfs + nfs_mount_options: defaults + nfs_path: /sapmnt + nfs_server: nfs-server.example.com:/ +``` + +### sap_ha_pacemaker_cluster_storage_nfs_filesytem_type + +- _Type:_ `str` +- _Default:_ `nfs` + +Filesystem type of the NFS filesystems that are part of the cluster configuration.
+ +### sap_ha_pacemaker_cluster_storage_nfs_mount_options + +- _Type:_ `str` +- _Default:_ `defaults` + +Mount options of the NFS filesystems that are part of the cluster configuration.
+ +### sap_ha_pacemaker_cluster_storage_nfs_server + +- _Type:_ `str` + +Default address of the NFS server, if not defined individually by filesystem.
+ +### sap_ha_pacemaker_cluster_system_roles_collection + +- _Type:_ `str` +- _Default:_ `fedora.linux_system_roles` + +Reference to the Ansible Collection used for the Linux System Roles.
+For community/upstream, use 'fedora.linux_system_roles'.
+For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'.
+ ### sap_ha_pacemaker_cluster_vip_client_interface - _Type:_ `str` @@ -436,6 +749,7 @@ When there is only one interface on the system, its name will be used by default - _Type:_ `str` The virtual IP of the primary HANA instance.
+Mandatory parameter for HANA clusters.
### sap_ha_pacemaker_cluster_vip_hana_primary_resource_name @@ -449,58 +763,63 @@ Customize the name of the resource managing the Virtual IP of the primary HANA i - _Type:_ `str` The virtual IP for read-only access to the secondary HANA instance.
+Optional parameter in HANA clusters.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver AAS instance.
+Virtual IP of the NetWeaver AAS instance.
+Mandatory for NetWeaver AAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___aas` -Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance.
+Name of the SAPInstance resource for NetWeaver AAS.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver ASCS instance.
+Virtual IP of the NetWeaver ASCS instance.
+Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___ascs` -Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance.
+Name of the SAPInstance resource for NetWeaver ASCS.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver ERS instance.
+Virtual IP of the NetWeaver ERS instance.
+Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___ers` -Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance.
+Name of the SAPInstance resource for NetWeaver ERS.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address - _Type:_ `str` -The virtual IP of the NetWeaver PAS instance.
+Virtual IP of the NetWeaver PAS instance.
+Mandatory for NetWeaver PAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name - _Type:_ `str` -- _Default:_ `vip_` +- _Default:_ `vip___pas` -Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance.
+Name of the SAPInstance resource for NetWeaver PAS.
### sap_ha_pacemaker_cluster_vip_secondary_resource_name @@ -509,61 +828,4 @@ Customize the name of the resource managing the Virtual IP of the NetWeaver PAS Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance.
-### sap_hana_cluster_nodes - -- _Type:_ `list` - -List of cluster nodes and associated attributes to describe the target SAP HA environment.
-This is required for the HANA System Replication configuration.
- -- **hana_site**
- Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. -- **node_ip**
- IP address of the node used for HANA System Replication. -- **node_name**
- Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. -- **node_role**
- Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. - -Example: - -```yaml -sap_hana_cluster_nodes: -- hana_site: DC01 - node_ip: 192.168.5.1 - node_name: nodeA - node_role: primary -- hana_site: DC02 - node_ip: 192.168.5.2 - node_name: nodeB - node_role: secondary -``` - -### sap_hana_instance_number - -- _Type:_ `str` - -The instance number of the SAP HANA database which this role will configure in the cluster.
- -### sap_hana_sid - -- _Type:_ `str` - -The SAP HANA SID of the instance that will be configured in the cluster.
-The SID must follow SAP specifications - see SAP Note 1979280.
- -### sap_hana_vip - -- _Type:_ `dict` - -One floating IP is required for SAP HANA DB connection by clients.
-This main VIP will always run on the promoted HANA node and be moved with it during a failover.
- -Example: - -```yaml -sap_hana_vip: - primary: 192.168.10.100 -``` - diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 7726ec60c..d2d8b1752 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -1,4 +1,11 @@ --- +################################################################################ +# Role generic parameters +################################################################################ + +# Do NOT USE ANSIBLE FACTS for defaults to be compatible with +# playbooks that disable generic fact gathering! + # Set which Ansible Collection to use for the Linux System Roles. # For community/upstream, use 'fedora.linux_system_roles' # For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' @@ -6,92 +13,46 @@ sap_ha_pacemaker_cluster_system_roles_collection: 'fedora.linux_system_roles' # Variables for the cluster setup must be constructed by dedicated tasks! # The included 'ha_cluster' role will not work with the role variables set -# in this role. +# in this role. This SAP HA role takes care of the parameter construction +# based on the target cluster to be configured, before feeding it into 'ha_cluster'. -# Do NOT USE ANSIBLE FACTS for defaults to be compatible with -# playbooks that disable generic fact gathering! - -# Inherit from ha_cluster Linux System Role -sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" -sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" -# Optional: write all cluster configuration (including credentials!) into a yaml -# config file for review or re-use. +# Optional: write all cluster configuration (including unencrypted credentials!) into a yaml +# config file. +# Useful for parameter review or re-use with the 'ha_cluster' LSR. sap_ha_pacemaker_cluster_create_config_varfile: false sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" -# Inherit SAP common (global synonyms) parameters -sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_ha_cluster_nodes | default(sap_hana_cluster_nodes) }}" -sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" -sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" - -# TODO: document filesystem definitions -sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" -sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs -sap_ha_pacemaker_cluster_storage_nfs_mount_options: 'defaults' -sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" +# Inherit SAP common (global synonyms) parameters when defined. +sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes | default([]) }}" -################################################################################ -# NetWeaver generic definitions -################################################################################ - -# TODO: document the nw parameters - -# Default will be ENSA2. To configure HA resources for ENSA1, enable this parameter: -sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false - -sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" - -#sap_ha_pacemaker_cluster_netweaver_common_filesystems: -# - /sapmnt -# - /usr/sap/trans -# - "/usr/sap/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS" - -# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage -# definition. -# Therefore, the /usr/sap prefix must be left out of the listed path items. -sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" - -# Make sure that there is always the default fed into the included role -sap_ha_pacemaker_cluster_fence_agent_packages: +# Make sure that there is always the minimal default fed into the included role. +# This is combined with the custom list 'sap_ha_pacemaker_cluster_fence_agent_packages'. +sap_ha_pacemaker_cluster_fence_agent_minimal_packages: - fence-agents-all -sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" - -## Resource defaults are defined differently by cluster type, if not custom defined. +# Resource defaults are defined differently by cluster type in different tasks, if not custom defined. +# TODO: migrate to 'ha_cluster' native parameter combination when moving the function to be included in the role +# (newer feature in the LSR) sap_ha_pacemaker_cluster_resource_defaults: {} # The type of SAP landscape and multi-node replication # TODO: Type definitions and feature support # TODO: Implement all types # hana_scaleup_costopt (not yet) -# hana_scaleup_perf (default) +# hana_scaleup_perf (available, default) # hana_scaleup_per_dr (not yet) # hana_scaleout (not yet) -# nwas_abap_ascs_ers -# nwas_abap_pas_aas +# nwas_abap_ascs_ers (available) +# nwas_abap_pas_aas (not yet) # nwas_java_scs_ers (maybe) -# + # 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in # 'tasks/ascertain_sap_landscape.yml'. sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" -sap_ha_pacemaker_cluster_replication_type: none -# Optional parameters to customize HANA resources -# AUTOMATED_REGISTER -sap_ha_pacemaker_cluster_hana_automated_register: true -# DUPLICATE_PRIMARY_TIMEOUT -sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: 900 -# PREFER_SITE_TAKEOVER -sap_ha_pacemaker_cluster_hana_prefer_site_takeover: true +# Currently unused parameter. Keeping for future functionality. +#sap_ha_pacemaker_cluster_replication_type: none ### stonith resource parameter defaults sap_ha_pacemaker_cluster_fence_options: @@ -100,15 +61,116 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ### VIP resource default patterns +# Currently there is no task for a different default VIP resource agent. +# Leaving out of meta/argument_specs.yml. +# Platform specific defaults are defined separately. sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' +## A custom stonith definition that takes precedence over platform defaults. +# sap_ha_pacemaker_cluster_stonith_custom: +# - name: "" +# agent: "stonith:" +# options: +# pcmk_host_list: "" + +#sap_ha_pacemaker_cluster_stonith_custom: [] + + +################################################################################ +# Inherit from 'ha_cluster' Linux System Role parameters when defined +################################################################################ + +sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" +sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" + +sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" + +# Optional: additional fence agent packages. This is combined with the above "minimal" list. +sap_ha_pacemaker_cluster_fence_agent_packages: [] + +# Mandatory. Inherit 'ha_cluster' LSR variable when defined, but do not set a default otherwise. +sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" + +# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native +# 'ha_cluster_cluster_properties' parameter. +sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + +################################################################################ +# HANA +################################################################################ + +sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" +sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" + +# Optional parameters to customize SAPHana resources +# AUTOMATED_REGISTER +sap_ha_pacemaker_cluster_hana_automated_register: true +# DUPLICATE_PRIMARY_TIMEOUT +sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: 900 +# PREFER_SITE_TAKEOVER +sap_ha_pacemaker_cluster_hana_prefer_site_takeover: true + + +# SAP HANA - Resource IDs (names) as convenience parameters. +sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" +sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" + + # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml +# +# Mandatory: primary VIP address definition in HANA scale-up clusters sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: '' sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" + + +################################################################################ +# NetWeaver generic definitions +################################################################################ + +# Default will be ENSA2. To configure HA resources for ENSA1, +# set this parameter to 'true'. +sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false + +# Inherit common synonym NetWeaver parameters when defined. +sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" +# Prepare in case JAVA SCS/ERS will be included later. +#sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" + +# Definitions for filesystems resources. Currently limited to NFS filesystems. +sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_setup_definition | default([]) }}" +sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs +sap_ha_pacemaker_cluster_storage_nfs_mount_options: 'defaults' +sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" + +# NFS filesystem resource requirement +# Not adding to argument_specs because this should not be changed anyway. +# TODO: review later and move to internal vars in vars/main.yml? +sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe + +# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage +# definition. +# Therefore, the /usr/sap prefix must be left out of the listed path items. +sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + + +# Multiple VIP parameters can be defined and will be combined. +# See tasks/include_construct_vip_resources.yml sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: '' @@ -118,17 +180,9 @@ sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemak sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: '' sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" -# SAP HANA - Resource IDs (names) as convenience parameters. -sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" -sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" -sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" -sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" - -# NFS filesystem resource requirement -sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe - -# SAP NetWeaver common - Resource IDs (names) as convenience parameters. +# SAP NetWeaver common - Resource IDs (names) as convenience parameters +# for the following filesystems: # - /sapmnt # - /usr/sap/trans # - /usr/sap/<>/SYS @@ -136,10 +190,11 @@ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" -# Enable to manage the SYS, transport and sapmnt filesystems in the cluster +# The shared filesystems are not required to be configured in the cluster. +# By default it is assumed that they are mounted by the system and available on all cluster nodes. +# Set this parameter to "true" to configure the 3 shared filesystems as part of the cluster. sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false -# TODO: document parameters ################################################################################ # ASCS resource defaults @@ -209,37 +264,22 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: # Platform specific ################################################################################ -## A custom stonith definition that takes precedence over platform defaults. -# sap_ha_pacemaker_cluster_stonith_custom: -# - name: "" -# agent: "stonith:" -# options: -# pcmk_host_list: "" - -# Simpler format translated into 'ha_cluster_cluster_properties' format of -# 'ha_cluster' LSR. -sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - ## 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_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 -## + ## Google Cloud platform, Compute Engine Virtual Machines # sap_ha_pacemaker_cluster_gcp_project # sap_ha_pacemaker_cluster_gcp_region_zone -## + ## IBM Cloud platform, Virtual Servers (x86_64) # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region -## + ## IBM Cloud platform, IBM Power Virtual Servers (ppc64le) # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region @@ -247,14 +287,14 @@ sap_ha_pacemaker_cluster_aws_vip_update_rt: [] # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid # 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/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 5a394c0ae..d5c82623c 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -27,13 +27,209 @@ argument_specs: # description: # ... - ha_cluster: + ######################################################################### + # SAP HA role generic parameters + ######################################################################### + sap_ha_pacemaker_cluster_system_roles_collection: + default: fedora.linux_system_roles description: + - Reference to the Ansible Collection used for the Linux System Roles. + - For community/upstream, use 'fedora.linux_system_roles'. + - For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'. + required: false + type: str + + sap_ha_pacemaker_cluster_create_config_dest: + default: _resource_config.yml + description: + - The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory. + - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. + - Specify a path/filename to save the file in a custom location. + - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. + required: false + type: str + + sap_ha_pacemaker_cluster_create_config_varfile: + default: false + description: + - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. + - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. + - When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes. + - WARNING! This report may include sensitive details like secrets required for certain cluster resources! + required: false + type: bool + + + sap_ha_pacemaker_cluster_cluster_nodes: + description: + - List of cluster nodes and associated attributes to describe the target SAP HA environment. + - This is required for the HANA System Replication configuration. + - Synonym for this parameter is `sap_hana_cluster_nodes`. + + example: + sap_ha_pacemaker_cluster_cluster_nodes: + - node_name: nodeA + node_role: primary + hana_site: DC01 + node_ip: 192.168.5.1 + - node_name: nodeB + node_role: secondary + hana_site: DC02 + node_ip: 192.168.5.2 + + required: false + type: list + elements: dict + options: + node_ip: + description: + - IP address of the node used for HANA System Replication. + required: true + node_name: + description: + - Name of the cluster node, should match the remote systems' hostnames. + - This is needed by the cluster members to know all their partner nodes. + required: true + node_role: + choices: + - primary + - secondary + description: + - Role of this node in the SAP cluster setup. + - There must be only **one** primary, but there can be multiple secondary nodes. + required: true + hana_site: + description: + - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). + - This is required for HANA System Replication configuration. + required: true + + sap_ha_pacemaker_cluster_fence_agent_minimal_packages: + default: ['fence-agents-all'] + description: + - The minimal set of fence agent packages that will be installed. + required: false + type: list + + sap_ha_pacemaker_cluster_resource_defaults: + default: + resource-stickiness: 3000 + migration-threshold: 5000 + description: + - Set default parameters that will be valid for all pacemaker resources. + example: + sap_ha_pacemaker_cluster_resource_defaults: + resource-stickiness: 1000 + migration-threshold: 5000 + + required: false + type: dict + + sap_ha_pacemaker_cluster_host_type: + choices: +# - hana_scaleup_costopt + - hana_scaleup_perf +# - hana_scaleup_perf_dr +# - hana_scaleout + - nwas_abap_ascs_ers +# - nwas_abap_pas_aas +# - nwas_java_scs_ers + default: hana_scaleup_perf + description: + - The SAP landscape to for which the cluster is to be configured. + - The default is a 2-node SAP HANA scale-up cluster. + required: false + type: str + + sap_ha_pacemaker_cluster_replication_type: + choices: + - mtr + - none + default: none + description: + - The type of SAP HANA site replication across multiple hosts. + - _Not yet supported_ + required: false + type: str + + sap_ha_pacemaker_cluster_fence_options: + default: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 400 + power_timeout: 240 + + description: + - STONITH resource common parameters that apply to most fencing agents. + - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). + - The listed options are set by default. + - Additional options can be added by defining this parameter in dictionary format and adding the defaults plus any valid stonith resource key-value pair. + + example: + sap_ha_pacemaker_cluster_fence_options: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 400 + power_timeout: 240 + + required: false + type: dict + + sap_ha_pacemaker_cluster_vip_client_interface: + description: + - OS device name of the network interface to use for the Virtual IP configuration. + - When there is only one interface on the system, its name will be used by default. + required: false + type: str + + sap_ha_pacemaker_cluster_stonith_custom: + description: + - Custom list of STONITH resource(s) to be configured in the cluster. + - This definition override any defaults the role would apply otherwise. + required: false + type: list + elements: dict + options: + name: + description: + - Name that will be used as the resource ID (name). + required: true + type: str + agent: + description: + - Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. + required: true + type: str + options: + description: + - The resource options listed in dictionary format, one option per line. + - Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. + required: true + type: str + + example: + sap_ha_pacemaker_cluster_stonith_custom: + - name: "my-fence-resource" + agent: "stonith:fence_rhevm" + options: + ip: rhevm-server + username: login-user + password: login-user-password + pcmk_host_list: node1,node2 + power_wait: 3 + + + ########################################################################## + # Parameters that are optionally imported from 'ha_cluster' LSR parameters + ########################################################################## + + sap_ha_pacemaker_cluster_ha_cluster: + description: + - The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym. - Optional _**host_vars**_ parameter - if defined it must be set for each node. - Dictionary that can contain various node options for the pacemaker cluster configuration. - Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md]. + - If not defined, the `ha_cluster` Linux System Role default will be used. example: - ha_cluster: + sap_ha_pacemaker_cluster_ha_cluster: corosync_addresses: - 192.168.1.10 - 192.168.2.10 @@ -43,45 +239,45 @@ argument_specs: type: dict sap_ha_pacemaker_cluster_cluster_name: - default: my-cluster description: - The name of the pacemaker cluster. - Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined. + - If not defined, the `ha_cluster` Linux System Role default will be used. required: false type: str - sap_ha_pacemaker_cluster_hacluster_password: + sap_ha_pacemaker_cluster_extra_packages: description: - - The password of the `hacluster` user which is created during pacemaker installation. - no_log: true - required: true - type: str - - sap_ha_pacemaker_cluster_aws_region: - description: - - The AWS region in which the instances to be used for the cluster setup are located. - - Required for cluster nodes setup on Amazon cloud. + - Additional extra packages to be installed, for instance specific resource packages. + - For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included. required: false - type: str + type: list - sap_ha_pacemaker_cluster_aws_access_key_id: + sap_ha_pacemaker_cluster_fence_agent_packages: description: - - AWS access key to allow control of instances (for example for fencing operations). - - Required for cluster nodes setup on Amazon cloud. + - Additional fence agent packages to be installed. + - This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`. required: false - type: str + type: list - sap_ha_pacemaker_cluster_aws_secret_access_key: + sap_ha_pacemaker_cluster_hacluster_password: description: - - AWS secret key, paired with the access key for instance control. - - Required for cluster nodes setup on Amazon cloud. - required: false + - The password of the `hacluster` user which is created during pacemaker installation. + - Inherits the value of `ha_cluster_hacluster_password`, when defined. + no_log: true + required: true type: str sap_ha_pacemaker_cluster_cluster_properties: - default: See example + default: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + description: - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. + - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. + example: sap_ha_pacemaker_cluster_cluster_properties: stonith-enabled: true @@ -91,41 +287,25 @@ argument_specs: required: false type: dict - sap_ha_pacemaker_cluster_create_config_dest: - default: _resource_config.yml - description: - - The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory. - - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. - - Specify a path/filename to save the file in a custom location. - - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. - required: false - type: str - sap_ha_pacemaker_cluster_create_config_varfile: - default: false - description: - - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. - - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. - - When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes. - - WARNING! This report may include sensitive details like secrets required for certain cluster resources! - required: false - type: bool + ########################################################################## + # HANA specific parameters + ########################################################################## - sap_ha_pacemaker_cluster_fence_options: + sap_ha_pacemaker_cluster_hana_sid: description: - - STONITH resource common parameters that apply to most fencing agents. - - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). - - The listed options are set by default. - - Additional options can be added by defining this parameter in dictionary format and adding the defaults plus any valid stonith resource key-value pair. - - example: - sap_ha_pacemaker_cluster_fence_options: - pcmk_reboot_retries: 4 - pcmk_reboot_timeout: 400 - power_timeout: 240 + - The SAP HANA SID of the instance that will be configured in the cluster. + - The SID must follow SAP specifications - see SAP Note 1979280. + - Inherits the value of `sap_hana_sid`, when defined. + required: true + type: str - required: false - type: dict + sap_ha_pacemaker_cluster_hana_instance_number: + description: + - The instance number of the SAP HANA database which this role will configure in the cluster. + - Inherits the value of `sap_hana_instance_number`, when defined. + required: true + type: str sap_ha_pacemaker_cluster_hana_automated_register: default: true @@ -164,6 +344,13 @@ argument_specs: required: false type: str + sap_ha_pacemaker_cluster_hana_resource_clone_name: + default: "SAPHana__-clone" + description: + - Customize the cluster resource name of the SAP HANA DB resource clone. + required: false + type: str + sap_ha_pacemaker_cluster_hana_topology_resource_name: default: "SAPHanaTopology__" description: @@ -171,324 +358,505 @@ argument_specs: required: false type: str - sap_ha_pacemaker_cluster_ibmcloud_api_key: + sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: + default: "SAPHanaTopology__-clone" description: - - The API key is required to allow control of instances (for example for fencing operations). - - Required for cluster nodes setup in IBM Cloud. + - Customize the cluster resource name of the SAP HANA Topology resource clone. required: false type: str - sap_ha_pacemaker_cluster_ibmcloud_region: + sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: description: - - The cloud region key in which the instances are running. - - Required for cluster nodes setup in IBM Cloud. + - The virtual IP of the primary HANA instance. + - Mandatory parameter for HANA clusters. required: false type: str - ### ASCS parameters - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: + default: "vip_" description: - - The name of the ASCS instance, typically the profile name. - - Required for the NetWeaver ASCS resource. + - Customize the name of the resource managing the Virtual IP of the primary HANA instance. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: description: - - The full path and name of the ASCS instance profile. - - Required for the NetWeaver ASCS resource. + - The virtual IP for read-only access to the secondary HANA instance. + - Optional parameter in HANA clusters. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + sap_ha_pacemaker_cluster_vip_secondary_resource_name: + default: "vip_" description: - - Name of the filesystem resource for the ASCS instance. + - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + + ########################################################################## + # NetWeaver specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: + default: false description: - - Name of the ASCS instance resource. + - The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2. + - Set this parameter to 'true' to configure it as ENSA1. + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_sid: + description: + - SID of the NetWeaver instances. + - Mandatory for NetWeaver cluster configuration. + - Uses `sap_swpm_sid` if defined. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: description: - - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". - default: false + - Instance number of the NetWeaver ABAP ASCS instance. + - Mandatory for NetWeaver ASCS/ERS cluster configuration. required: false - type: bool + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: description: - - NetWeaver ASCS instance resource stickiness attribute. - default: 5000 + - Instance number of the NetWeaver ABAP ERS instance. + - Mandatory for NetWeaver ASCS/ERS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: description: - - NetWeaver ASCS instance migration-threshold setting attribute. - - Only used for ENSA1 setups. Default is ENSA2. - default: 1 + - Instance number of the NetWeaver ABAP PAS instance. + - Mandatory for NetWeaver PAS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: description: - - NetWeaver ASCS instance failure-timeout attribute. - - Only used for ENSA1 setups. Default is ENSA2. - default: 60 + - Instance number of the NetWeaver ABAP AAS instance. + - Mandatory for NetWeaver AAS cluster configuration. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + sap_ha_pacemaker_cluster_storage_definition: description: - - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. - default: 3000 + - List of filesystem definitions used for filesystem cluster resources. + - Uses `sap_storage_setup_definition` when defined. + + elements: dict + options: + name: + description: + - Unique name of the filesystem definition entry. + required: true + type: str + + mountpoint: + description: + - Path under which the filesystem will be mounted. + - Mandatory for all filesystems that have a mountpoint. + - Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap//" and "/usr/sap//SYS". + required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input) + type: str + + nfs_filesystem_type: + default: + description: + - NFS filesystem type used to mount this filesystem. + required: false + type: str + + nfs_mount_options: + default: + description: + - Mount options to be used for this specific filesystem. + required: false + type: str + + nfs_path: + description: + - Path to the filesystem source directory on the NFS server. + required: false + type: str + + nfs_server: + default: + description: + - Name of the NFS server for this particular filesystem. + required: false + type: str + + example: + sap_ha_pacemaker_cluster_storage_definition: + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap + nfs_server: "nfs-server.example.com:/" + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans + nfs_server: "nfs-server.example.com:/" + - name: sapmnt + mountpoint: /sapmnt + nfs_filesystem_type: nfs + nfs_mount_options: defaults + nfs_path: /sapmnt + nfs_server: "nfs-server.example.com:/" + + required: false + type: list + + sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: + default: nfs + description: + - Filesystem type of the NFS filesystems that are part of the cluster configuration. required: false type: str - ### ERS parameters + sap_ha_pacemaker_cluster_storage_nfs_mount_options: + default: defaults + description: + - Mount options of the NFS filesystems that are part of the cluster configuration. + required: false + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: + sap_ha_pacemaker_cluster_storage_nfs_server: description: - - The name of the ERS instance, typically the profile name. - - Required for the NetWeaver ERS resource. + - Default address of the NFS server, if not defined individually by filesystem. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + default: + - /ASCS + - /ERS description: - - The full path and name of the ERS instance profile. - - Required for the NetWeaver ERS resource. + - Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`. + required: false + type: list + + sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: + description: + - Virtual IP of the NetWeaver ASCS instance. + - Mandatory for NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: + default: vip___ascs description: - - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". - default: false + - Name of the SAPInstance resource for NetWeaver ASCS. required: false - type: bool + type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: description: - - Name of the filesystem resource for the ERS instance. + - Virtual IP of the NetWeaver ERS instance. + - Mandatory for NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: + default: vip___ers description: - - Name of the ERS instance resource. + - Name of the SAPInstance resource for NetWeaver ERS. required: false type: str + sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: + description: + - Virtual IP of the NetWeaver PAS instance. + - Mandatory for NetWeaver PAS cluster setup. + required: false + type: str - ### HANA - sap_ha_pacemaker_cluster_replication_type: - choices: - - mtr - - none - default: none + sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: + default: vip___pas description: - - The type of SAP HANA site replication across multiple hosts. - - _Not yet supported_ + - Name of the SAPInstance resource for NetWeaver PAS. required: false type: str - sap_ha_pacemaker_cluster_resource_defaults: - default: See example + sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: description: - - Set default parameters that will be valid for all pacemaker resources. - example: - sap_ha_pacemaker_cluster_resource_defaults: - resource-stickiness: 1000 - migration-threshold: 5000 + - Virtual IP of the NetWeaver AAS instance. + - Mandatory for NetWeaver AAS cluster setup. + required: false + type: str + sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: + default: vip___aas + description: + - Name of the SAPInstance resource for NetWeaver AAS. required: false - type: dict + type: str -# sap_ha_pacemaker_cluster_host_type: -# choices: -## - hana_scaleup_costopt -# - hana_scaleup_perf -## - hana_scaleup_perf_dr -## - hana_scaleout -# - nwas_abap_ascs_ers -# - nwas_abap_pas_aas -## - nwas_java_scs_ers -# default: hana_scaleup_perf -# description: -# - The SAP landscape to be installed. -# required: false -# type: str + sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: + default: Filesystem_NWAS_SAPMNT_ + description: + - Filesystem resource name for the shared filesystem /sapmnt. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. + required: false + type: str - sap_ha_pacemaker_cluster_vip_client_interface: + sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: + default: Filesystem_NWAS_TRANS_ description: - - OS device name of the network interface to use for the Virtual IP configuration. - - When there is only one interface on the system, its name will be used by default. + - Filesystem resource name for the transports filesystem /usr/sap/trans. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. required: false type: str - sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: + sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: + default: Filesystem_NWAS_SYS_ description: - - The virtual IP of the primary HANA instance. + - Filesystem resource name for the transports filesystem /usr/sap//SYS. + - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. + - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. required: false type: str - sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: + default: false description: - - Customize the name of the resource managing the Virtual IP of the primary HANA instance. + - Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources. + required: false + type: bool + + + ########################################################################## + # NetWeaver ASCS specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + description: + - The name of the ASCS instance, typically the profile name. + - Mandatory for the NetWeaver ASCS/ERS cluster setup required: false type: str - sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: description: - - The virtual IP for read-only access to the secondary HANA instance. + - The full path and name of the ASCS instance profile. + - Mandatory for the NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_vip_secondary_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + default: Filesystem_NWAS_ABAP_ASCS__ description: - - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. + - Name of the filesystem resource for the ASCS instance. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + default: SAPInstance_NWAS_ABAP_ASCS__ description: - - The virtual IP of the NetWeaver ASCS instance. + - Name of the ASCS instance resource. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + default: false description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver ASCS instance. + - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + default: 5000 + description: + - NetWeaver ASCS instance resource stickiness attribute. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + default: 1 description: - - The virtual IP of the NetWeaver ERS instance. + - NetWeaver ASCS instance migration-threshold setting attribute. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + default: 60 description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver ERS instance. + - NetWeaver ASCS instance failure-timeout attribute. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + default: 3000 description: - - The virtual IP of the NetWeaver PAS instance. + - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: - default: "vip_" + + ########################################################################## + # NetWeaver ERS specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver PAS instance. + - The name of the ERS instance, typically the profile name. + - Mandatory for the NetWeaver ASCS/ERS cluster setup. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: description: - - The virtual IP of the NetWeaver AAS instance. + - The full path and name of the ERS instance profile. + - Mandatory for the NetWeaver ASCS/ERS cluster. required: false type: str - sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: - default: "vip_" + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + default: false + description: + - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". + required: false + type: bool + + sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + default: Filesystem_NWAS_ABAP_ERS__ + description: + - Name of the filesystem resource for the ERS instance. + required: false + type: str + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + default: SAPInstance_NWAS_ABAP_ERS__ description: - - Customize the name of the resource managing the Virtual IP of the NetWeaver AAS instance. + - Name of the ERS instance resource. required: false type: str + + ########################################################################## + # PAS specific parameters + ########################################################################## + + # TODO: implement PAS cluster setup + + ########################################################################## + # PAS specific parameters + ########################################################################## + + # TODO: implement AAS cluster setup + + + ########################################################################## + # Platforms: AWS specific parameters + ########################################################################## + sap_ha_pacemaker_cluster_aws_vip_update_rt: description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. - - Required for VIP configuration in AWS EC2 environments. + - Mandatory for the VIP resource configuration in AWS EC2 environments. required: false type: list - sap_hana_cluster_nodes: + sap_ha_pacemaker_cluster_aws_region: description: - - List of cluster nodes and associated attributes to describe the target SAP HA environment. - - This is required for the HANA System Replication configuration. - - example: - sap_hana_cluster_nodes: - - node_name: nodeA - node_role: primary - hana_site: DC01 - node_ip: 192.168.5.1 - - node_name: nodeB - node_role: secondary - hana_site: DC02 - node_ip: 192.168.5.2 + - The AWS region in which the instances to be used for the cluster setup are located. + - Mandatory for cluster nodes setup on AWS EC2 instances. + required: false + type: str - elements: dict + sap_ha_pacemaker_cluster_aws_access_key_id: + description: + - AWS access key to allow control of instances (for example for fencing operations). + - Mandatory for the cluster nodes setup on AWS EC2 instances. required: false - type: list - options: - node_ip: - description: - - IP address of the node used for HANA System Replication. - required: true - node_name: - description: - - Name of the cluster node, should match the remote systems' hostnames. - - This is needed by the cluster members to know all their partner nodes. - required: true - node_role: - choices: - - primary - - secondary - description: - - Role of this node in the SAP cluster setup. - - There must be only **one** primary, but there can be multiple secondary nodes. - required: true - hana_site: - description: - - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). - - This is required for HANA System Replication configuration. - required: true + type: str - sap_hana_instance_number: + sap_ha_pacemaker_cluster_aws_secret_access_key: description: - - The instance number of the SAP HANA database which this role will configure in the cluster. + - AWS secret key, paired with the access key for instance control. + - Mandatory for the cluster setup on AWS EC2 instances. required: false type: str - sap_hana_sid: + + ########################################################################## + # Platforms: GCP specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_gcp_project: description: - - The SAP HANA SID of the instance that will be configured in the cluster. - - The SID must follow SAP specifications - see SAP Note 1979280. + - Google Cloud project name in which the target instances are installed. + - Mandatory for the cluster setup on GCP instances. required: false type: str - sap_hana_vip: + sap_ha_pacemaker_cluster_gcp_region_zone: description: - - One floating IP is required for SAP HANA DB connection by clients. - - This main VIP will always run on the promoted HANA node and be moved with it during a failover. + - Goocle Cloud Platform region zone ID. + - Mandatory for the cluster setup on GCP instances. + required: false + type: str - example: - sap_hana_vip: - primary: 192.168.10.100 + ########################################################################## + # Platforms: IBM Cloud specific parameters - VS and Power VS common + ########################################################################## + + sap_ha_pacemaker_cluster_ibmcloud_api_key: + description: + - The API key which is required to allow the control of instances (for example for fencing operations). + - Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances. required: false - type: dict - required_one_of: [{ primary, main, rw, promoted }] + type: str + + sap_ha_pacemaker_cluster_ibmcloud_region: + description: + - The IBM Cloud VS region name in which the instances are running. + - Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances. + required: false + type: str + + + ########################################################################## + # Platforms: IBM Cloud Power VS specific parameters + ########################################################################## -# TODO: review the global parameter vs. role parameter logic and compatibility of combination of HANA + NW -# sap_system_sid: +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: # description: -# - The SID of the SAP Netweaver system that will be configured in the cluster. -# - The SID must follow SAP specifications - see SAP Note 1979280. +# - +# - Mandatory for the cluster setup on IBM Cloud Power VS instances. # required: false -# type: str +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: +# +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: +# +# +# sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: + + + ########################################################################## + # Platforms: MS Azure specific parameters + ########################################################################## + + sap_ha_pacemaker_cluster_msazure_subscription_id: + description: + - Subscription ID of the MS Azure environment containing the target instances. + - Mandatory for the cluster setup on MS Azure instances. + required: false + type: str + + sap_ha_pacemaker_cluster_msazure_resource_group: + description: + - Resource group name/ID in which the target instances are defined. + - Mandatory for the cluster setup on MS Azure instances. + required: false + type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml deleted file mode 100644 index 408bb89e6..000000000 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_ha_cluster_in_inventory.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -# If there are "ha_cluster" linux system role parameters already defined in the -# inventory, we will include these custom specifications. - -### Take the following template to add additional parameters to be inherited: -# - name: "SAP HA Prepare Pacemaker - Register ha_cluster_" -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_: "{{ ha_cluster_ }}" -# when: ha_cluster_ is defined - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_cluster_properties" - when: ha_cluster_cluster_properties is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_colocation" - when: ha_cluster_constraints_colocation is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_location" - when: ha_cluster_constraints_location is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_constraints_order" - when: ha_cluster_constraints_order is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_fence_agent_packages" - when: ha_cluster_fence_agent_packages is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_repos" - when: ha_cluster_repos is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_clones" - when: ha_cluster_resource_clones is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_groups" - when: ha_cluster_resource_groups is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" - -- name: "SAP HA Prepare Pacemaker - Register ha_cluster_resource_primitives" - when: ha_cluster_resource_primitives is defined - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml new file mode 100644 index 000000000..5a7084754 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml @@ -0,0 +1,95 @@ +--- +# After all of the previous construction flows, the final parameters must +# be translated to 'ha_cluster' Linux System Role syntax. +# +# This way the include_role parameters are set as play vars and do not +# require a static list of vars when the role is included. + +# List of parameters that are constructed by this role, but not all of them +# are mandatory to be defined. For any undefined parameter the default of the +# 'ha_cluster' role will apply, if the role has a default defined. +# +# Make sure to always define those parameters which have no 'ha_cluster' LSR default! +# +# SAP HA Pacemaker Cluster role -> 'ha_cluster' Linux System Role +# ------------------------------------------------------------------------------ +# __sap_ha_pacemaker_cluster_ha_cluster ha_cluster +# __sap_ha_pacemaker_cluster_cluster_name ha_cluster_cluster_name +# __sap_ha_pacemaker_cluster_cluster_properties ha_cluster_cluster_properties +# __sap_ha_pacemaker_cluster_constraints_colocation ha_cluster_constraints_colocation +# __sap_ha_pacemaker_cluster_constraints_location ha_cluster_constraints_location +# __sap_ha_pacemaker_cluster_constraints_order ha_cluster_constraints_order +# __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages +# __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages +# __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password +# __sap_ha_pacemaker_cluster_repos ha_cluster_repos +# __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones +# __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups +# __sap_ha_pacemaker_cluster_resource_primitives ha_cluster_resource_primitives + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster'" + when: __sap_ha_pacemaker_cluster_ha_cluster is defined + ansible.builtin.set_fact: + ha_cluster: "{{ __sap_ha_pacemaker_cluster_ha_cluster }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_name'" + when: __sap_ha_pacemaker_cluster_cluster_name is defined + ansible.builtin.set_fact: + ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_cluster_properties'" + when: __sap_ha_pacemaker_cluster_cluster_properties is defined + ansible.builtin.set_fact: + ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_colocation'" + when: __sap_ha_pacemaker_cluster_constraints_colocation is defined + ansible.builtin.set_fact: + ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_location'" + when: __sap_ha_pacemaker_cluster_constraints_location is defined + ansible.builtin.set_fact: + ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_constraints_order'" + when: __sap_ha_pacemaker_cluster_constraints_order is defined + ansible.builtin.set_fact: + ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_extra_packages'" + when: __sap_ha_pacemaker_cluster_extra_packages is defined + ansible.builtin.set_fact: + ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_fence_agent_packages'" + when: __sap_ha_pacemaker_cluster_fence_agent_packages is defined + ansible.builtin.set_fact: + ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_hacluster_password'" + when: __sap_ha_pacemaker_cluster_hacluster_password is defined + ansible.builtin.set_fact: + ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" + no_log: true # secure the credential + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" + when: __sap_ha_pacemaker_cluster_repos is defined + ansible.builtin.set_fact: + ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_clones'" + when: __sap_ha_pacemaker_cluster_resource_clones is defined + ansible.builtin.set_fact: + ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_groups'" + when: __sap_ha_pacemaker_cluster_resource_groups is defined + ansible.builtin.set_fact: + ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" + +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_primitives'" + when: __sap_ha_pacemaker_cluster_resource_primitives is defined + ansible.builtin.set_fact: + ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" + no_log: true # be paranoid, there could be credentials in it diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index 96a4bdb63..6553e8f98 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -1,29 +1,49 @@ --- -# Create or combine input parameters for the ha_cluster role. +# Combine input parameters with inherited vars from the 'ha_cluster' role. +# The inherited values take precedence. Some parameters are not required to be set. +# The 'ha_cluster' LSR will apply its role defaults. +# For mandatory parameters, sanity checks will be done separately. +# sap_ha_pacemaker_cluster_cluster_name -> user-defined or default inherited from {{ ha_cluster_cluster_name }} - name: "SAP HA Prepare Pacemaker - Set cluster name" + when: + - __sap_ha_pacemaker_cluster_cluster_name is not defined + - sap_ha_pacemaker_cluster_cluster_name is defined ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default(sap_ha_pacemaker_cluster_cluster_name) }}" + __sap_ha_pacemaker_cluster_cluster_name: "{{ sap_ha_pacemaker_cluster_cluster_name }}" +# sap_ha_pacemaker_cluster_hacluster_password -> user-defined or default inherited from {{ ha_cluster_hacluster_password }} - name: "SAP HA Prepare Pacemaker - Register the 'hacluster' user password" + when: + - __sap_ha_pacemaker_cluster_hacluster_password is not defined + - sap_ha_pacemaker_cluster_hacluster_password ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password | default(sap_ha_pacemaker_cluster_hacluster_password) }}" - no_log: true + __sap_ha_pacemaker_cluster_hacluster_password: "{{ sap_ha_pacemaker_cluster_hacluster_password }}" + no_log: true # secure the credential + + +# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default +# sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* for certain target environments +# sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* +# Empty defaults defined here for optional non-user-facing parameters. - name: "SAP HA Prepare Pacemaker - Combine extra packages lists" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_extra_packages: "{{ sap_ha_pacemaker_cluster_extra_packages - + - sap_ha_pacemaker_cluster_sap_extra_packages | default([]) - + - sap_ha_pacemaker_cluster_platform_extra_packages | default([]) + + sap_ha_pacemaker_cluster_sap_extra_packages | default([]) + + sap_ha_pacemaker_cluster_platform_extra_packages | default([]) }}" + +# sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default +# sap_ha_pacemaker_cluster_fence_agent_packages -> global default +# __sap_ha_pacemaker_cluster_fence_agent_packages -> internal default (vars/main.yml) + - name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ - sap_ha_pacemaker_cluster_fence_agent_packages - + - __sap_ha_pacemaker_cluster_fence_agent_packages + sap_ha_pacemaker_cluster_fence_agent_minimal_packages + + sap_ha_pacemaker_cluster_fence_agent_packages + + __sap_ha_pacemaker_cluster_fence_agent_packages }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index 9859b979a..43da8bf1b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -7,7 +7,7 @@ # This block is entered when # - no default stonith resource is defined and no custom is defined either # - an empty custom is defined to override any default (defined or not) -- name: "SAP HA Prepare Pacemaker - Block when no STONITH resource is defined" +- name: "SAP HA Prepare Pacemaker - (STONITH) Block when no STONITH resource is defined" when: - ( sap_ha_pacemaker_cluster_stonith_custom is defined @@ -34,7 +34,7 @@ ) block: - - name: "SAP HA Prepare Pacemaker - Set STONITH to disabled when no fencing resource is defined" + - name: "SAP HA Prepare Pacemaker - (STONITH) Set to disabled when no fencing resource is defined" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_cluster_properties: "{{ sap_ha_pacemaker_cluster_cluster_properties | combine({ 'stonith-enabled': false }) }}" @@ -53,13 +53,15 @@ # END of block for disabling stonith -- name: "SAP HA Prepare Pacemaker - Define cluster stonith properties" +- name: "SAP HA Prepare Pacemaker - (STONITH) Define cluster properties" when: - sap_ha_pacemaker_cluster_cluster_properties is defined - sap_ha_pacemaker_cluster_cluster_properties is iterable - sap_ha_pacemaker_cluster_cluster_properties | length > 0 ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_cluster_properties: + __sap_ha_pacemaker_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties | default([]) + __stonith_properties }}" + vars: + __stonith_properties: - attrs: |- {% set attrs = __sap_ha_pacemaker_cluster_cluster_properties | map(attribute='attrs') | flatten -%} {%- for default_cluster_properties in (sap_ha_pacemaker_cluster_cluster_properties | dict2items) -%} @@ -83,7 +85,7 @@ # - generic pacemaker fence resource options # (see defaults: sap_ha_pacemaker_cluster_fence_options) -- name: "SAP HA Prepare Pacemaker - Assemble the stonith resource definition from platform default" +- name: "SAP HA Prepare Pacemaker - (STONITH) Assemble the resource definition from platform default" when: - sap_ha_pacemaker_cluster_stonith_default is defined - sap_ha_pacemaker_cluster_stonith_custom is not defined @@ -117,7 +119,7 @@ {%- endfor %} {{ attrs }} -- name: "SAP HA Prepare Pacemaker - Assemble the stonith resources from custom definition" +- name: "SAP HA Prepare Pacemaker - (STONITH) Assemble the resources from custom definition" when: - sap_ha_pacemaker_cluster_stonith_custom is defined ansible.builtin.set_fact: @@ -144,7 +146,7 @@ # The STONITH resource is an element in the cluster_resource_primitives list -- name: "SAP HA Prepare Pacemaker - Construct stonith resources definition" +- name: "SAP HA Prepare Pacemaker - (STONITH) Construct resources definition" when: - __sap_ha_pacemaker_cluster_stonith_resource is defined ansible.builtin.set_fact: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 98a49b57c..fda53ca9b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -2,7 +2,7 @@ # Reminder: This file is included in a loop over a dictionary. # VIP resource definition itself -- name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" +- name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }} ({{ sap_ha_pacemaker_cluster_vip_resource_agent }})" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: @@ -17,3 +17,4 @@ value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" when: - __sap_ha_pacemaker_cluster_vip_resource_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - '"IPaddr2" in sap_ha_pacemaker_cluster_vip_resource_agent' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml new file mode 100644 index 000000000..6598e8ff3 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml @@ -0,0 +1,94 @@ +--- +# If there are "ha_cluster" Linux System Role parameters already defined in the +# inventory, we will include these custom specifications and they take precedence. + +# Only parameters which need to be adjusted or enhanced by the SAP HA role +# need to be included here. + + +### Take the following template to add additional parameters to be inherited: +# - name: "SAP HA Prepare Pacemaker - Register ha_cluster_" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_: "{{ ha_cluster_ }}" +# when: ha_cluster_ is defined + + +# ha_cluster +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster'" + when: ha_cluster is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" + +# ha_cluster_cluster_name +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_name'" + when: ha_cluster_cluster_name is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name }}" + +# ha_cluster_cluster_properties +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_cluster_properties'" + when: ha_cluster_cluster_properties is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_cluster_properties: "{{ ha_cluster_cluster_properties }}" + +#__sap_ha_pacemaker_cluster_resource_groups ha_cluster_constraints_colocation +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_colocation'" + when: ha_cluster_constraints_colocation is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ ha_cluster_constraints_colocation }}" + +# ha_cluster_constraints_location +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_location'" + when: ha_cluster_constraints_location is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_location: "{{ ha_cluster_constraints_location }}" + +# ha_cluster_constraints_order +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_constraints_order'" + when: ha_cluster_constraints_order is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ ha_cluster_constraints_order }}" + +# ha_cluster_extra_packages +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_extra_packages'" + when: ha_cluster_extra_packages is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages }}" + +# ha_cluster_fence_agent_packages +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_fence_agent_packages'" + when: ha_cluster_fence_agent_packages is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ha_cluster_fence_agent_packages }}" + +# ha_cluster_hacluster_password +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" + when: ha_cluster_hacluster_password is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" + no_log: true # handle credentials with care + +# ha_cluster_repos +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" + when: ha_cluster_repos is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_repos: "{{ ha_cluster_repos }}" + +# ha_cluster_resource_clones +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_clones'" + when: ha_cluster_resource_clones is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ ha_cluster_resource_clones }}" + +# ha_cluster_resource_groups +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_groups'" + when: ha_cluster_resource_groups is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_groups: "{{ ha_cluster_resource_groups }}" + +# ha_cluster_resource_primitives +- name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_resource_primitives'" + when: ha_cluster_resource_primitives is defined + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ ha_cluster_resource_primitives }}" + no_log: true # be paranoid, there could be credentials in it diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 8d7f4e92d..02deaebbc 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -21,8 +21,8 @@ # Make sure that all parameters already set for 'ha_cluster' are also inherited. # Add to this file a task for EACH parameter which this SAP cluster role # supports. -- name: "SAP HA Prepare Pacemaker - Include tasks for checking 'ha_cluster' predefinitions" - ansible.builtin.import_tasks: ascertain_ha_cluster_in_inventory.yml +- name: "SAP HA Prepare Pacemaker - Include tasks from 'ha_cluster' role definitions" + ansible.builtin.import_tasks: import_hacluster_vars_from_inventory.yml - name: "SAP HA Prepare Pacemaker - Include facts and common variables" ansible.builtin.import_tasks: include_vars_common.yml @@ -94,6 +94,17 @@ when: - "'nwas_java' in nwas_build_item" +# All of the SAP HA role constructed parameters must be translated to +# 'ha_cluster' Linux System Role parameters. +- name: "SAP HA Prepare Pacemaker - Translate all parameters to 'ha_cluster' input variables" + ansible.builtin.include_tasks: + file: construct_final_hacluster_vars.yml + + +########################################################## +# BLOCK which covers actual changes on the target systems +########################################################## + - name: "SAP HA Install Pacemaker - Block with actual changes" block: @@ -124,19 +135,19 @@ - __sap_ha_pacemaker_cluster_disable_services.failed - '"Could not find the requested service" not in __sap_ha_pacemaker_cluster_disable_services.msg' - # Before we are ready to call the ha_cluster role, we want to validate - # that the minimum required parameters are defined and not empty. - # TODO: make this smarter, currently all these vars are pre-defined anyway - - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" - ansible.builtin.assert: - that: - - __sap_ha_pacemaker_cluster_cluster_properties is defined - - __sap_ha_pacemaker_cluster_extra_packages is defined - - __sap_ha_pacemaker_cluster_resource_primitives is defined - - __sap_ha_pacemaker_cluster_resource_clones is defined - - __sap_ha_pacemaker_cluster_constraints_order is defined - - __sap_ha_pacemaker_cluster_constraints_colocation is defined - fail_msg: "Cluster build parameter construction has failed for this parameter." +# # Before we are ready to call the ha_cluster role, we want to validate +# # that the minimum required parameters are defined and not empty. +# # TODO: make this smarter, currently all these vars are pre-defined anyway +# - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" +# ansible.builtin.assert: +# that: +# - __sap_ha_pacemaker_cluster_cluster_properties is defined +# - __sap_ha_pacemaker_cluster_extra_packages is defined +# - __sap_ha_pacemaker_cluster_resource_primitives is defined +# - __sap_ha_pacemaker_cluster_resource_clones is defined +# - __sap_ha_pacemaker_cluster_constraints_order is defined +# - __sap_ha_pacemaker_cluster_constraints_colocation is defined +# fail_msg: "Cluster build parameter construction has failed for this parameter." - name: "SAP HA Install Pacemaker - Query if CIB already exists" ansible.builtin.command: @@ -167,20 +178,22 @@ tags: ha_cluster no_log: true # some parameters contain secrets no_log: true # some parameters contain secrets - vars: - __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" - ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" - ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" - ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" - ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" - ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" - ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" - ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" - ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" - ha_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" - ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" - ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" - ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" +# +# Remove hard-coded parameters and set 'ha_cluster' LSR parameters in this play right +# before the 'ha_cluster' role is included. +# vars: +# __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" +# ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" +# ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" +# ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" +# ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" +# ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" +# ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" +# ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" +# ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" +# ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" +# ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" +# ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" tags: ha_cluster # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 27b93aee8..70c7d6a8c 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -48,18 +48,23 @@ __sap_ha_pacemaker_cluster_supported_platforms: # - conditionals (if applicable) # - config report template # -__sap_ha_pacemaker_cluster_cluster_name: '' -__sap_ha_pacemaker_cluster_cluster_properties: [] -__sap_ha_pacemaker_cluster_constraints_colocation: [] -__sap_ha_pacemaker_cluster_constraints_location: [] -__sap_ha_pacemaker_cluster_constraints_order: [] -__sap_ha_pacemaker_cluster_extra_packages: [] -__sap_ha_pacemaker_cluster_fence_agent_packages: [] -__sap_ha_pacemaker_cluster_hacluster_password: -__sap_ha_pacemaker_cluster_repos: [] -__sap_ha_pacemaker_cluster_resource_primitives: [] -__sap_ha_pacemaker_cluster_resource_groups: [] -__sap_ha_pacemaker_cluster_resource_clones: [] - +# TODO: verify that the task flow logic works without these explicit +# pre-definitions. Otherwise there is a need to hard-code parameters +# which have defaults in the 'ha_cluster' LSR. +# Remove this section when validated. +# +#__sap_ha_pacemaker_cluster_cluster_name: '' +#__sap_ha_pacemaker_cluster_cluster_properties: [] +#__sap_ha_pacemaker_cluster_constraints_colocation: [] +#__sap_ha_pacemaker_cluster_constraints_location: [] +#__sap_ha_pacemaker_cluster_constraints_order: [] +#__sap_ha_pacemaker_cluster_extra_packages: [] +#__sap_ha_pacemaker_cluster_fence_agent_packages: [] +#__sap_ha_pacemaker_cluster_hacluster_password: +#__sap_ha_pacemaker_cluster_repos: [] +#__sap_ha_pacemaker_cluster_resource_primitives: [] +#__sap_ha_pacemaker_cluster_resource_groups: [] +#__sap_ha_pacemaker_cluster_resource_clones: [] +# # Predefine host_map for variable construction __sap_ha_pacemaker_cluster_pcmk_host_map: '' From d2520a4cb98849dac915a9aef0083b8782db6560 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 22 Sep 2023 08:13:13 +0200 Subject: [PATCH 139/179] sap_install_media_detect: Handle db and db client separately ... for solving issue #467. --- .../tasks/find_files_after_extraction.yml | 12 ++++-------- .../tasks/prepare/create_file_list_phase_2.yml | 12 ++++-------- .../tasks/set_global_vars.yml | 6 +----- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 646fabd3c..523c575c1 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -34,8 +34,7 @@ register: sap_hana_client_path ignore_errors: true when: - - sap_install_media_detect_db == 'saphana' or - sap_install_media_detect_db_client == 'saphana' + - sap_install_media_detect_db_client == 'saphana' - name: SAP Install Media Detect - Find files after extraction - Find IBM Db2 ansible.builtin.find: @@ -56,8 +55,7 @@ use_regex: true register: detect_directory_ibmdb2_client_extracted when: - - sap_install_media_detect_db == 'ibmdb2' or - sap_install_media_detect_db_client == 'ibmdb2' + - sap_install_media_detect_db_client == 'ibmdb2' - name: SAP Install Media Detect - Find files after extraction - Find Oracle DB ansible.builtin.find: @@ -78,8 +76,7 @@ use_regex: true register: detect_directory_oracledb_client_extracted when: - - sap_install_media_detect_db == 'oracledb' or - sap_install_media_detect_db_client == 'oracledb' + - sap_install_media_detect_db_client == 'oracledb' - name: SAP Install Media Detect - Find files after extraction - Find SAP ASE ansible.builtin.find: @@ -100,8 +97,7 @@ use_regex: true register: detect_directory_sapase_client_extracted when: - - sap_install_media_detect_db == 'sapase' or - sap_install_media_detect_db_client == 'sapase' + - sap_install_media_detect_db_client == 'sapase' - name: SAP Install Media Detect - Find files after extraction - Find SAP MaxDB ansible.builtin.find: diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index e65f93859..66096e7bd 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -223,8 +223,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'saphana_client') | length > 0 fail_msg: "No file found for saphana_client" when: - - sap_install_media_detect_db == 'saphana' or - sap_install_media_detect_db_client == 'saphana' + - sap_install_media_detect_db_client == 'saphana' - name: SAP Install Media Detect - Prepare - Assert that sapase is present ansible.builtin.assert: @@ -240,8 +239,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'sapase_client') | length > 0 fail_msg: "No file found for sapase_client" when: - - sap_install_media_detect_db == 'sapase' or - sap_install_media_detect_db_client == 'sapase' + - sap_install_media_detect_db_client == 'sapase' - name: SAP Install Media Detect - Prepare - Assert that sapmaxdb is present ansible.builtin.assert: @@ -265,8 +263,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'oracledb_client') | length > 0 fail_msg: "No file found for oracledb_client" when: - - sap_install_media_detect_db == 'oracledb' or - sap_install_media_detect_db_client == 'oracledb' + - sap_install_media_detect_db_client == 'oracledb' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2 is present ansible.builtin.assert: @@ -282,8 +279,7 @@ - __sap_install_media_detect_fact_files_sapfile_results | selectattr('sap_file_type', 'equalto', 'ibmdb2_client') | length > 0 fail_msg: "No file found for ibmdb2_client" when: - - sap_install_media_detect_db == 'ibmdb2' or - sap_install_media_detect_db_client == 'ibmdb2' + - sap_install_media_detect_db_client == 'ibmdb2' - name: SAP Install Media Detect - Prepare - Assert that ibmdb2_license is present ansible.builtin.assert: diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 7cf50b8f6..32e07d394 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -59,15 +59,13 @@ ignore_errors: true when: - sap_install_media_detect_move_or_copy_archives - - sap_install_media_detect_db == 'saphana' or - sap_install_media_detect_db_client == 'saphana' + - sap_install_media_detect_db_client == 'saphana' # In 'find_files_after_extraction.yml', we search for a directory named 'LINUXX86_64'. For the role sap_swpm, we need to set # exactly this path - name: SAP Install Media Detect - Detection completed - Set facts for IBM Db2 ansible.builtin.set_fact: sap_swpm_cd_ibmdb2_path: "{{ detect_directory_ibmdb2_extracted.files[0].path }}/" # for sap_swpm Ansible Role - sap_swpm_cd_ibmdb2_client_path: "{{ detect_directory_ibmdb2_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == 'ibmdb2' @@ -84,7 +82,6 @@ ansible.builtin.set_fact: sap_anydb_install_oracle_extract_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_anydb_install_oracle Ansible Role sap_swpm_cd_oracle_path: "{{ detect_directory_oracledb_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role - sap_swpm_cd_oracle_client_path: "{{ detect_directory_oracledb_client_extracted.files[0].path | dirname }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == 'oracledb' @@ -100,7 +97,6 @@ - name: SAP Install Media Detect - Detection completed - Set facts for SAP ASE ansible.builtin.set_fact: sap_swpm_cd_sapase_path: "{{ detect_directory_sapase_extracted.files[0].path }}/" # for sap_swpm Ansible Role - sap_swpm_cd_sapase_client_path: "{{ detect_directory_sapase_client_extracted.files[0].path }}/" # for sap_swpm Ansible Role ignore_errors: true when: sap_install_media_detect_db == 'sapase' From 9d39fd59b2580e602e057aefb0cd039b60af27d3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 22 Sep 2023 09:51:48 +0200 Subject: [PATCH 140/179] sap_install_media_detect: only copy the database or client files where specified --- .../tasks/prepare/create_file_list_phase_2.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 66096e7bd..63e655f7d 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -56,25 +56,19 @@ (sap_install_media_detect_webdisp and item.stdout.split(';')[1] == 'sap_webdisp') or (sap_install_media_detect_db == 'saphana' and ( item.stdout.split(';')[1] == 'saphana' or - item.stdout.split(';')[1] == 'saphana_client' or item.stdout.split(';')[1] == 'saphana_other') ) or (sap_install_media_detect_db_client == 'saphana' and item.stdout.split(';')[1] == 'saphana_client') or (sap_install_media_detect_db == 'sapmaxdb' and item.stdout.split(';')[1] == 'sapmaxdb') or - (sap_install_media_detect_db == 'sapase' and ( - item.stdout.split(';')[1] == 'sapase' or - item.stdout.split(';')[1] == 'sapase_client') - ) or + (sap_install_media_detect_db == 'sapase' and item.stdout.split(';')[1] == 'sapase') or (sap_install_media_detect_db_client == 'sapase' and item.stdout.split(';')[1] == 'sapase_client') or (sap_install_media_detect_db == 'oracledb' and ( item.stdout.split(';')[1] == 'oracledb' or - item.stdout.split(';')[1] == 'oracledb_client' or item.stdout.split(';')[1] == 'oracledb_tools') ) or (sap_install_media_detect_db_client == 'oracledb' and item.stdout.split(';')[1] == 'oracledb_client') or (sap_install_media_detect_db == 'ibmdb2' and ( item.stdout.split(';')[1] == 'ibmdb2' or - item.stdout.split(';')[1] == 'ibmdb2_client' or item.stdout.split(';')[1] == 'ibmdb2_license') ) or (sap_install_media_detect_db_client == 'ibmdb2' and item.stdout.split(';')[1] == 'ibmdb2_client') or From efc0092942dca718d84d2578f47c46b14269ccf6 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 11:43:21 +0200 Subject: [PATCH 141/179] sap_ha_pacemaker_cluster: fix: typo --- roles/sap_ha_pacemaker_cluster/README.md | 6 ++-- .../meta/argument_specs.yml | 28 ++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 7caef631d..70e8916de 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -293,7 +293,7 @@ Mandatory for the cluster setup on GCP instances.
- _Type:_ `str` -Goocle Cloud Platform region zone ID.
+Google Cloud Platform region zone ID.
Mandatory for the cluster setup on GCP instances.
### sap_ha_pacemaker_cluster_ha_cluster @@ -406,14 +406,14 @@ The default is a 2-node SAP HANA scale-up cluster.
- _Type:_ `str` The API key which is required to allow the control of instances (for example for fencing operations).
-Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances.
+Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `str` The IBM Cloud VS region name in which the instances are running.
-Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances.
+Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_msazure_resource_group diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index d5c82623c..c052bff53 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -799,7 +799,7 @@ argument_specs: sap_ha_pacemaker_cluster_gcp_region_zone: description: - - Goocle Cloud Platform region zone ID. + - Google Cloud Platform region zone ID. - Mandatory for the cluster setup on GCP instances. required: false type: str @@ -812,35 +812,49 @@ argument_specs: sap_ha_pacemaker_cluster_ibmcloud_api_key: description: - The API key which is required to allow the control of instances (for example for fencing operations). - - Mandatory for the cluster setup on IBM Cloud V or IBM Cloud Power VS instances. + - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. required: false type: str sap_ha_pacemaker_cluster_ibmcloud_region: description: - The IBM Cloud VS region name in which the instances are running. - - Mandatory for the cluster setup on IBM Cloud VS or IBM Cloud Power VS instances. + - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. required: false type: str ########################################################################## - # Platforms: IBM Cloud Power VS specific parameters + # Platforms: IBM Power VS on IBM Cloud specific parameters ########################################################################## # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: # description: # - -# - Mandatory for the cluster setup on IBM Cloud Power VS instances. +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. # required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: -# +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: -# +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: +# description: +# - +# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. +# required: false +# type: str ########################################################################## From 636ef8524d8485211f175defc7e8b76a7f17121d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 22 Sep 2023 12:55:26 +0200 Subject: [PATCH 142/179] sap_install_media_detect: Fix SAPCAR extraction error for SAP ASE Client Solves issue #470. --- .../tasks/organize_files.yml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 40598ecd4..6b9adeb02 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -140,7 +140,7 @@ group: root mode: '0755' -- name: SAP Install Media Detect - Organize all files - Extract sapcar archive files +- name: SAP Install Media Detect - Organize all files - Extract HANA sapcar archive files ansible.builtin.shell: >- {{ __sap_install_media_detect_fact_sapcar_path }} -R {{ __sap_install_media_detect_software_main_directory }}/tmp_extract @@ -148,7 +148,7 @@ -manifest SIGNATURE.SMF && extracted_dir=$(ls -d */) && mv SIGNATURE.SMF $extracted_dir - && mkdir -p {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/$extracted_dir + && mkdir -p {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} && mv $extracted_dir {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}/ args: chdir: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" @@ -157,8 +157,26 @@ loop_var: line_item when: - sap_install_media_detect_extract_archives + - line_item.extract_archive == 'y' - line_item.archive_type == 'sapcar' + - line_item.sap_file_type is search('saphana') + +- name: SAP Install Media Detect - Organize all files - Extract non-HANA sapcar archive files + ansible.builtin.shell: >- + {{ __sap_install_media_detect_fact_sapcar_path }} + -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} + -xvf {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} + -manifest SIGNATURE.SMF + args: + chdir: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }}" + loop: "{{ __sap_install_media_detect_fact_files_sapfile_results }}" + loop_control: + loop_var: line_item + when: + - sap_install_media_detect_extract_archives - line_item.extract_archive == 'y' + - line_item.archive_type == 'sapcar' + - not line_item.sap_file_type is search('saphana') - name: SAP Install Media Detect - Organize all files - Remove temp dir - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract ansible.builtin.file: From 7a0e1339abb1ce9ba7ceec3e59b6798f2fe8a738 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 14:44:45 +0200 Subject: [PATCH 143/179] sap_ha_pacemaker_cluster: enh: additional checks and variable re-org - added pre-flight checks for instance numbers - removed default required/type entries from argument_specifications - regenerated README - added prefix to internal vars and pre-defined them in vars/main.yml - simplified configuration output file structure and changed to 'ha_cluster' vars - fixed: the __ha_cluster_repos LSR variable has a __ prefix --- roles/sap_ha_pacemaker_cluster/README.md | 144 +++++---- .../defaults/main.yml | 29 +- .../meta/argument_specs.yml | 284 ++++-------------- .../tasks/construct_final_hacluster_vars.yml | 4 +- .../tasks/construct_vars_common.yml | 18 +- .../tasks/validate_input_parameters.yml | 53 ++++ .../templates/cluster_create_config.j2 | 42 +-- .../vars/hana_scaleout_common.yml | 2 +- .../vars/hana_scaleup_common.yml | 2 +- roles/sap_ha_pacemaker_cluster/vars/main.yml | 36 ++- .../vars/nwas_common.yml | 2 +- .../vars/platform_cloud_aws_ec2_vs.yml | 2 +- .../vars/platform_cloud_gcp_ce_vm.yml | 2 +- .../vars/platform_cloud_ibmcloud_powervs.yml | 2 +- .../vars/platform_cloud_ibmcloud_vs.yml | 2 +- .../vars/platform_cloud_msazure_vm.yml | 2 +- .../vars/platform_hyp_ibmpower_vm.yml | 2 +- 17 files changed, 254 insertions(+), 374 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 70e8916de..fb18aff22 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -131,30 +131,29 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions ## Role Input Parameters -Minimum required parameters: +Minimum required parameters for all clusters: - [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) -- [sap_ha_pacemaker_cluster_hana_instance_number](#sap_ha_pacemaker_cluster_hana_instance_number) -- [sap_ha_pacemaker_cluster_hana_sid](#sap_ha_pacemaker_cluster_hana_sid) +Additional minimum requirements depend on the type of cluster setup and on the target platform. ### sap_ha_pacemaker_cluster_aws_access_key_id -- _Type:_ `str` +- _Type:_ `string` AWS access key to allow control of instances (for example for fencing operations).
Mandatory for the cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_region -- _Type:_ `str` +- _Type:_ `string` The AWS region in which the instances to be used for the cluster setup are located.
Mandatory for cluster nodes setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_secret_access_key -- _Type:_ `str` +- _Type:_ `string` AWS secret key, paired with the access key for instance control.
Mandatory for the cluster setup on AWS EC2 instances.
@@ -168,7 +167,7 @@ Mandatory for the VIP resource configuration in AWS EC2 environments.
### sap_ha_pacemaker_cluster_cluster_name -- _Type:_ `str` +- _Type:_ `string` The name of the pacemaker cluster.
Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined.
@@ -181,15 +180,16 @@ If not defined, the `ha_cluster` Linux System Role default will be used.
List of cluster nodes and associated attributes to describe the target SAP HA environment.
This is required for the HANA System Replication configuration.
Synonym for this parameter is `sap_hana_cluster_nodes`.
+Mandatory to be defined for HANA clusters.
- **hana_site**
- Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
This is required for HANA System Replication configuration. + Site of the cluster and/or SAP HANA System Replication node (for example 'DC01').
Mandatory for HANA clusters (sudo config for system replication). - **node_ip**
- IP address of the node used for HANA System Replication. + IP address of the node used for HANA System Replication.
_Optional. Currently not needed/used in cluster configuration._ - **node_name**
- Name of the cluster node, should match the remote systems' hostnames.
This is needed by the cluster members to know all their partner nodes. + Name of the cluster node, should match the remote systems' hostnames.
_Optional. Currently not needed/used in cluster configuration._ - **node_role**
- Role of this node in the SAP cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes. + Role of the defined `node_name` in the SAP HANA cluster setup.
There must be only **one** primary, but there can be multiple secondary nodes.
_Optional. Currently not needed/used in cluster configuration._ Example: @@ -200,9 +200,6 @@ sap_ha_pacemaker_cluster_cluster_nodes: node_name: nodeA node_role: primary - hana_site: DC02 - node_ip: 192.168.5.2 - node_name: nodeB - node_role: secondary ``` ### sap_ha_pacemaker_cluster_cluster_properties @@ -224,7 +221,7 @@ sap_ha_pacemaker_cluster_cluster_properties: ### sap_ha_pacemaker_cluster_create_config_dest -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `_resource_config.yml` The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory.
@@ -284,14 +281,14 @@ sap_ha_pacemaker_cluster_fence_options: ### sap_ha_pacemaker_cluster_gcp_project -- _Type:_ `str` +- _Type:_ `string` Google Cloud project name in which the target instances are installed.
Mandatory for the cluster setup on GCP instances.
### sap_ha_pacemaker_cluster_gcp_region_zone -- _Type:_ `str` +- _Type:_ `string` Google Cloud Platform region zone ID.
Mandatory for the cluster setup on GCP instances.
@@ -318,7 +315,7 @@ sap_ha_pacemaker_cluster_ha_cluster: ### sap_ha_pacemaker_cluster_hacluster_password required -- _Type:_ `str` +- _Type:_ `string` The password of the `hacluster` user which is created during pacemaker installation.
Inherits the value of `ha_cluster_hacluster_password`, when defined.
@@ -341,12 +338,13 @@ Time difference needed between to primary time stamps, if a dual-primary situati If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status.
This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed.
-### sap_ha_pacemaker_cluster_hana_instance_number required +### sap_ha_pacemaker_cluster_hana_instance_number -- _Type:_ `str` +- _Type:_ `string` The instance number of the SAP HANA database which this role will configure in the cluster.
Inherits the value of `sap_hana_instance_number`, when defined.
+Mandatory for SAP HANA cluster setups.
### sap_ha_pacemaker_cluster_hana_prefer_site_takeover @@ -359,43 +357,44 @@ When set to "true" (default) a failover to secondary will be initiated on resour ### sap_ha_pacemaker_cluster_hana_resource_clone_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHana__-clone` Customize the cluster resource name of the SAP HANA DB resource clone.
### sap_ha_pacemaker_cluster_hana_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHana__` Customize the cluster resource name of the SAP HANA DB resource.
-### sap_ha_pacemaker_cluster_hana_sid required +### sap_ha_pacemaker_cluster_hana_sid -- _Type:_ `str` +- _Type:_ `string` The SAP HANA SID of the instance that will be configured in the cluster.
The SID must follow SAP specifications - see SAP Note 1979280.
Inherits the value of `sap_hana_sid`, when defined.
+Mandatory for SAP HANA cluster setups.
### sap_ha_pacemaker_cluster_hana_topology_resource_clone_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHanaTopology__-clone` Customize the cluster resource name of the SAP HANA Topology resource clone.
### sap_ha_pacemaker_cluster_hana_topology_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPHanaTopology__` Customize the cluster resource name of the SAP HANA Topology resource.
### sap_ha_pacemaker_cluster_host_type -- _Type:_ `str` +- _Type:_ `list` - _Default:_ `hana_scaleup_perf` The SAP landscape to for which the cluster is to be configured.
@@ -403,35 +402,35 @@ The default is a 2-node SAP HANA scale-up cluster.
### sap_ha_pacemaker_cluster_ibmcloud_api_key -- _Type:_ `str` +- _Type:_ `string` The API key which is required to allow the control of instances (for example for fencing operations).
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_ibmcloud_region -- _Type:_ `str` +- _Type:_ `string` The IBM Cloud VS region name in which the instances are running.
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
### sap_ha_pacemaker_cluster_msazure_resource_group -- _Type:_ `str` +- _Type:_ `string` Resource group name/ID in which the target instances are defined.
Mandatory for the cluster setup on MS Azure instances.
### sap_ha_pacemaker_cluster_msazure_subscription_id -- _Type:_ `str` +- _Type:_ `string` Subscription ID of the MS Azure environment containing the target instances.
Mandatory for the cluster setup on MS Azure instances.
### sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP AAS instance.
Mandatory for NetWeaver AAS cluster configuration.
@@ -445,21 +444,21 @@ Standard NetWeaver paths in "/usr/sap" and automatically appended to the configu ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ASCS__` Name of the filesystem resource for the ASCS instance.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `3000` NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
@@ -473,7 +472,7 @@ NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `60` NetWeaver ASCS instance failure-timeout attribute.
@@ -481,7 +480,7 @@ Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ens ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `1` NetWeaver ASCS instance migration-threshold setting attribute.
@@ -489,42 +488,42 @@ Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ens ### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name -- _Type:_ `str` +- _Type:_ `string` The name of the ASCS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ASCS__` Name of the ASCS instance resource.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `5000` NetWeaver ASCS instance resource stickiness attribute.
### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string -- _Type:_ `str` +- _Type:_ `string` The full path and name of the ASCS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ERS__` Name of the filesystem resource for the ERS instance.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
@@ -538,28 +537,28 @@ NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name -- _Type:_ `str` +- _Type:_ `string` The name of the ERS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ERS__` Name of the ERS instance resource.
### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string -- _Type:_ `str` +- _Type:_ `string` The full path and name of the ERS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster.
### sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number -- _Type:_ `str` +- _Type:_ `string` Instance number of the NetWeaver ABAP PAS instance.
Mandatory for NetWeaver PAS cluster configuration.
@@ -574,7 +573,7 @@ Set this parameter to 'true' to configure it as ENSA1.
### sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_SAPMNT_` Filesystem resource name for the shared filesystem /sapmnt.
@@ -590,15 +589,16 @@ Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/ ### sap_ha_pacemaker_cluster_netweaver_sid -- _Type:_ `str` +- _Type:_ `string` SID of the NetWeaver instances.
Mandatory for NetWeaver cluster configuration.
Uses `sap_swpm_sid` if defined.
+Mandatory for NetWeaver cluster setups.
### sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_SYS_` Filesystem resource name for the transports filesystem /usr/sap//SYS.
@@ -607,21 +607,13 @@ Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_file ### sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `Filesystem_NWAS_TRANS_` Filesystem resource name for the transports filesystem /usr/sap/trans.
Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
-### sap_ha_pacemaker_cluster_replication_type - -- _Type:_ `str` -- _Default:_ `none` - -The type of SAP HANA site replication across multiple hosts.
-_Not yet supported_
- ### sap_ha_pacemaker_cluster_resource_defaults - _Type:_ `dict` @@ -710,27 +702,27 @@ sap_ha_pacemaker_cluster_storage_definition: ### sap_ha_pacemaker_cluster_storage_nfs_filesytem_type -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `nfs` Filesystem type of the NFS filesystems that are part of the cluster configuration.
### sap_ha_pacemaker_cluster_storage_nfs_mount_options -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `defaults` Mount options of the NFS filesystems that are part of the cluster configuration.
### sap_ha_pacemaker_cluster_storage_nfs_server -- _Type:_ `str` +- _Type:_ `string` Default address of the NFS server, if not defined individually by filesystem.
### sap_ha_pacemaker_cluster_system_roles_collection -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `fedora.linux_system_roles` Reference to the Ansible Collection used for the Linux System Roles.
@@ -739,91 +731,91 @@ For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_syste ### sap_ha_pacemaker_cluster_vip_client_interface -- _Type:_ `str` +- _Type:_ `string` OS device name of the network interface to use for the Virtual IP configuration.
When there is only one interface on the system, its name will be used by default.
### sap_ha_pacemaker_cluster_vip_hana_primary_ip_address -- _Type:_ `str` +- _Type:_ `string` The virtual IP of the primary HANA instance.
Mandatory parameter for HANA clusters.
### sap_ha_pacemaker_cluster_vip_hana_primary_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip_` Customize the name of the resource managing the Virtual IP of the primary HANA instance.
### sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address -- _Type:_ `str` +- _Type:_ `string` The virtual IP for read-only access to the secondary HANA instance.
Optional parameter in HANA clusters.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver AAS instance.
Mandatory for NetWeaver AAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___aas` Name of the SAPInstance resource for NetWeaver AAS.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___ascs` Name of the SAPInstance resource for NetWeaver ASCS.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___ers` Name of the SAPInstance resource for NetWeaver ERS.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address -- _Type:_ `str` +- _Type:_ `string` Virtual IP of the NetWeaver PAS instance.
Mandatory for NetWeaver PAS cluster setup.
### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip___pas` Name of the SAPInstance resource for NetWeaver PAS.
### sap_ha_pacemaker_cluster_vip_secondary_resource_name -- _Type:_ `str` +- _Type:_ `string` - _Default:_ `vip_` Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance.
diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index d2d8b1752..c654ab685 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -24,6 +24,10 @@ sap_ha_pacemaker_cluster_create_config_varfile: false sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" # Inherit SAP common (global synonyms) parameters when defined. + +# This variable is currently only required for HANA nodes to define +# - hana_site: +# Other options are needed in the separate HSR setup role. sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes | default([]) }}" # Make sure that there is always the minimal default fed into the included role. @@ -49,6 +53,7 @@ sap_ha_pacemaker_cluster_resource_defaults: {} # 'sap_ha_pacemaker_cluster_host_type' is converted from string to list type in # 'tasks/ascertain_sap_landscape.yml'. +# TODO: review with testers, updated arg specs now require it to be a list from the start sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default(['hana_scaleup_perf']) }}" # Currently unused parameter. Keeping for future functionality. @@ -76,28 +81,32 @@ sap_ha_pacemaker_cluster_vip_client_interface: '' #sap_ha_pacemaker_cluster_stonith_custom: [] +# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native +# 'ha_cluster_cluster_properties' parameter. +sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true ################################################################################ # Inherit from 'ha_cluster' Linux System Role parameters when defined ################################################################################ -sap_ha_pacemaker_cluster_ha_cluster: "{{ ha_cluster }}" -sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my-cluster') }}" +# Optional without a default. The 'ha_cluster' LSR defaults will apply when not defined. +#sap_ha_pacemaker_cluster_ha_cluster: +#sap_ha_pacemaker_cluster_cluster_name: -sap_ha_pacemaker_cluster_extra_packages: "{{ ha_cluster_extra_packages | default([]) }}" +# Optional. Set a default here and not in the code. +sap_ha_pacemaker_cluster_extra_packages: [] # Optional: additional fence agent packages. This is combined with the above "minimal" list. sap_ha_pacemaker_cluster_fence_agent_packages: [] -# Mandatory. Inherit 'ha_cluster' LSR variable when defined, but do not set a default otherwise. +# Mandatory. +# Either inherit from the 'ha_cluster' LSR variable when defined, but do not set a default. +# This fails the argument validation when none of the 2 vars are defined. sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" -# Simpler definition format here which gets transformed into the 'ha_cluster' LSR native -# 'ha_cluster_cluster_properties' parameter. -sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true ################################################################################ # HANA diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index c052bff53..131a26662 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -36,8 +36,6 @@ argument_specs: - Reference to the Ansible Collection used for the Linux System Roles. - For community/upstream, use 'fedora.linux_system_roles'. - For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'. - required: false - type: str sap_ha_pacemaker_cluster_create_config_dest: default: _resource_config.yml @@ -46,72 +44,62 @@ argument_specs: - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. - Specify a path/filename to save the file in a custom location. - The file can be used as input vars file for an Ansible playbook running the 'ha_cluster' Linux System Role. - required: false - type: str sap_ha_pacemaker_cluster_create_config_varfile: + type: bool default: false description: - When enabled, all cluster configuration parameters this role constructs for executing the 'ha_cluster' Linux System role will be written into a file in Yaml format. - This allows using the output file later as input file for additional custom steps using the 'ha_cluster' role and covering the resource configuration in a cluster that was set up using this 'sap_ha_pacemaker_cluster' role. - When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes. - WARNING! This report may include sensitive details like secrets required for certain cluster resources! - required: false - type: bool - sap_ha_pacemaker_cluster_cluster_nodes: + type: list description: - List of cluster nodes and associated attributes to describe the target SAP HA environment. - This is required for the HANA System Replication configuration. - Synonym for this parameter is `sap_hana_cluster_nodes`. - - example: - sap_ha_pacemaker_cluster_cluster_nodes: - - node_name: nodeA - node_role: primary - hana_site: DC01 - node_ip: 192.168.5.1 - - node_name: nodeB - node_role: secondary - hana_site: DC02 - node_ip: 192.168.5.2 - - required: false - type: list + - Mandatory to be defined for HANA clusters. elements: dict options: node_ip: description: - IP address of the node used for HANA System Replication. - required: true + - _Optional. Currently not needed/used in cluster configuration._ node_name: description: - Name of the cluster node, should match the remote systems' hostnames. - - This is needed by the cluster members to know all their partner nodes. - required: true + - _Optional. Currently not needed/used in cluster configuration._ node_role: choices: - primary - secondary description: - - Role of this node in the SAP cluster setup. + - Role of the defined `node_name` in the SAP HANA cluster setup. - There must be only **one** primary, but there can be multiple secondary nodes. - required: true + - _Optional. Currently not needed/used in cluster configuration._ hana_site: description: - Site of the cluster and/or SAP HANA System Replication node (for example 'DC01'). - - This is required for HANA System Replication configuration. - required: true + - Mandatory for HANA clusters (sudo config for system replication). + + example: + sap_ha_pacemaker_cluster_cluster_nodes: + - hana_site: DC01 + node_name: nodeA + node_role: primary + node_ip: 192.168.5.1 + - hana_site: DC02 sap_ha_pacemaker_cluster_fence_agent_minimal_packages: + type: list default: ['fence-agents-all'] description: - The minimal set of fence agent packages that will be installed. - required: false - type: list sap_ha_pacemaker_cluster_resource_defaults: + type: dict default: resource-stickiness: 3000 migration-threshold: 5000 @@ -122,10 +110,8 @@ argument_specs: resource-stickiness: 1000 migration-threshold: 5000 - required: false - type: dict - sap_ha_pacemaker_cluster_host_type: + type: list choices: # - hana_scaleup_costopt - hana_scaleup_perf @@ -138,26 +124,22 @@ argument_specs: description: - The SAP landscape to for which the cluster is to be configured. - The default is a 2-node SAP HANA scale-up cluster. - required: false - type: str - sap_ha_pacemaker_cluster_replication_type: - choices: - - mtr - - none - default: none - description: - - The type of SAP HANA site replication across multiple hosts. - - _Not yet supported_ - required: false - type: str +# sap_ha_pacemaker_cluster_replication_type: +# choices: +# - mtr +# - none +# default: none +# description: +# - The type of SAP HANA site replication across multiple hosts. +# - _Not yet supported_ sap_ha_pacemaker_cluster_fence_options: + type: dict default: pcmk_reboot_retries: 4 pcmk_reboot_timeout: 400 power_timeout: 240 - description: - STONITH resource common parameters that apply to most fencing agents. - These options are applied to fencing resources this role uses automatically for pre-defined platforms (like AWS EC2 VS, IBM Cloud VS). @@ -170,40 +152,32 @@ argument_specs: pcmk_reboot_timeout: 400 power_timeout: 240 - required: false - type: dict sap_ha_pacemaker_cluster_vip_client_interface: description: - OS device name of the network interface to use for the Virtual IP configuration. - When there is only one interface on the system, its name will be used by default. - required: false - type: str sap_ha_pacemaker_cluster_stonith_custom: + type: list description: - Custom list of STONITH resource(s) to be configured in the cluster. - This definition override any defaults the role would apply otherwise. - required: false - type: list elements: dict options: name: description: - Name that will be used as the resource ID (name). required: true - type: str agent: description: - Resource agent name, must contain the prefix "stonith:" to avoid mismatches or failures. required: true - type: str options: description: - The resource options listed in dictionary format, one option per line. - Requires the mandatory options for the particular stonith resource agent to be defined, otherwise the setup will fail. required: true - type: str example: sap_ha_pacemaker_cluster_stonith_custom: @@ -216,18 +190,36 @@ argument_specs: pcmk_host_list: node1,node2 power_wait: 3 + sap_ha_pacemaker_cluster_cluster_properties: + type: dict + default: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + description: + - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. + - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. + + example: + sap_ha_pacemaker_cluster_cluster_properties: + stonith-enabled: true + stonith-timeout: 900 + concurrent-fencing: true + ########################################################################## # Parameters that are optionally imported from 'ha_cluster' LSR parameters ########################################################################## sap_ha_pacemaker_cluster_ha_cluster: + type: dict description: - The `ha_cluster` LSR native parameter `ha_cluster` can be used as a synonym. - Optional _**host_vars**_ parameter - if defined it must be set for each node. - Dictionary that can contain various node options for the pacemaker cluster configuration. - Supported options can be reviewed in the `ha_cluster` Linux System Role [https://github.com/linux-system-roles/ha_cluster/blob/master/README.md]. - If not defined, the `ha_cluster` Linux System Role default will be used. + example: sap_ha_pacemaker_cluster_ha_cluster: corosync_addresses: @@ -235,30 +227,24 @@ argument_specs: - 192.168.2.10 node_name: nodeA - required: false - type: dict sap_ha_pacemaker_cluster_cluster_name: description: - The name of the pacemaker cluster. - Inherits the `ha_cluster` LSR native parameter `ha_cluster_cluster_name` if not defined. - If not defined, the `ha_cluster` Linux System Role default will be used. - required: false - type: str sap_ha_pacemaker_cluster_extra_packages: + type: list description: - Additional extra packages to be installed, for instance specific resource packages. - For SAP clusters configured by this role, the relevant standard packages for the target scenario are automatically included. - required: false - type: list sap_ha_pacemaker_cluster_fence_agent_packages: + type: list description: - Additional fence agent packages to be installed. - This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`. - required: false - type: list sap_ha_pacemaker_cluster_hacluster_password: description: @@ -266,26 +252,6 @@ argument_specs: - Inherits the value of `ha_cluster_hacluster_password`, when defined. no_log: true required: true - type: str - - sap_ha_pacemaker_cluster_cluster_properties: - default: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - description: - - Standard pacemaker cluster properties are configured with recommended settings for cluster node fencing. - - When no STONITH resource is defined, STONITH will be disabled and a warning displayed. - - example: - sap_ha_pacemaker_cluster_cluster_properties: - stonith-enabled: true - stonith-timeout: 900 - concurrent-fencing: true - - required: false - type: dict ########################################################################## @@ -297,35 +263,32 @@ argument_specs: - The SAP HANA SID of the instance that will be configured in the cluster. - The SID must follow SAP specifications - see SAP Note 1979280. - Inherits the value of `sap_hana_sid`, when defined. - required: true - type: str + - Mandatory for SAP HANA cluster setups. sap_ha_pacemaker_cluster_hana_instance_number: description: - The instance number of the SAP HANA database which this role will configure in the cluster. - Inherits the value of `sap_hana_instance_number`, when defined. - required: true - type: str + - Mandatory for SAP HANA cluster setups. sap_ha_pacemaker_cluster_hana_automated_register: + type: bool default: true description: - Parameter for the 'SAPHana' cluster resource. - Define if a former primary should be re-registered automatically as secondary. - required: false - type: bool sap_ha_pacemaker_cluster_hana_duplicate_primary_timeout: + type: int default: 900 description: - Parameter for the 'SAPHana' cluster resource. - Time difference needed between to primary time stamps, if a dual-primary situation occurs. - If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status. - This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed. - required: false - type: int sap_ha_pacemaker_cluster_hana_prefer_site_takeover: + type: bool choices: - true - false @@ -334,64 +297,46 @@ argument_specs: - Parameter for the 'SAPHana' cluster resource. - Set to "false" if the cluster should first attempt to restart the instance on the same node. - When set to "true" (default) a failover to secondary will be initiated on resource failure. - required: false - type: bool sap_ha_pacemaker_cluster_hana_resource_name: default: "SAPHana__" description: - Customize the cluster resource name of the SAP HANA DB resource. - required: false - type: str sap_ha_pacemaker_cluster_hana_resource_clone_name: default: "SAPHana__-clone" description: - Customize the cluster resource name of the SAP HANA DB resource clone. - required: false - type: str sap_ha_pacemaker_cluster_hana_topology_resource_name: default: "SAPHanaTopology__" description: - Customize the cluster resource name of the SAP HANA Topology resource. - required: false - type: str sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: default: "SAPHanaTopology__-clone" description: - Customize the cluster resource name of the SAP HANA Topology resource clone. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: description: - The virtual IP of the primary HANA instance. - Mandatory parameter for HANA clusters. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: default: "vip_" description: - Customize the name of the resource managing the Virtual IP of the primary HANA instance. - required: false - type: str sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: description: - The virtual IP for read-only access to the secondary HANA instance. - Optional parameter in HANA clusters. - required: false - type: str sap_ha_pacemaker_cluster_vip_secondary_resource_name: default: "vip_" description: - Customize the name of the resource managing the Virtual IP of read-only access to the secondary HANA instance. - required: false - type: str ########################################################################## @@ -399,61 +344,50 @@ argument_specs: ########################################################################## sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: + type: bool default: false description: - The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2. - Set this parameter to 'true' to configure it as ENSA1. - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_sid: description: - SID of the NetWeaver instances. - Mandatory for NetWeaver cluster configuration. - Uses `sap_swpm_sid` if defined. - required: false - type: str + - Mandatory for NetWeaver cluster setups. sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: description: - Instance number of the NetWeaver ABAP ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: description: - Instance number of the NetWeaver ABAP ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: description: - Instance number of the NetWeaver ABAP PAS instance. - Mandatory for NetWeaver PAS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: description: - Instance number of the NetWeaver ABAP AAS instance. - Mandatory for NetWeaver AAS cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_definition: + type: list description: - List of filesystem definitions used for filesystem cluster resources. - Uses `sap_storage_setup_definition` when defined. - elements: dict options: name: description: - Unique name of the filesystem definition entry. required: true - type: str mountpoint: description: @@ -461,34 +395,25 @@ argument_specs: - Mandatory for all filesystems that have a mountpoint. - Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap//" and "/usr/sap//SYS". required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input) - type: str nfs_filesystem_type: default: description: - NFS filesystem type used to mount this filesystem. - required: false - type: str nfs_mount_options: default: description: - Mount options to be used for this specific filesystem. - required: false - type: str nfs_path: description: - Path to the filesystem source directory on the NFS server. - required: false - type: str nfs_server: default: description: - Name of the NFS server for this particular filesystem. - required: false - type: str example: sap_ha_pacemaker_cluster_storage_definition: @@ -507,93 +432,68 @@ argument_specs: nfs_path: /sapmnt nfs_server: "nfs-server.example.com:/" - required: false - type: list sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: default: nfs description: - Filesystem type of the NFS filesystems that are part of the cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_nfs_mount_options: default: defaults description: - Mount options of the NFS filesystems that are part of the cluster configuration. - required: false - type: str sap_ha_pacemaker_cluster_storage_nfs_server: description: - Default address of the NFS server, if not defined individually by filesystem. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + type: list default: - /ASCS - /ERS description: - Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`. - required: false - type: list sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: description: - Virtual IP of the NetWeaver ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: default: vip___ascs description: - Name of the SAPInstance resource for NetWeaver ASCS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: description: - Virtual IP of the NetWeaver ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: default: vip___ers description: - Name of the SAPInstance resource for NetWeaver ERS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: description: - Virtual IP of the NetWeaver PAS instance. - Mandatory for NetWeaver PAS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: default: vip___pas description: - Name of the SAPInstance resource for NetWeaver PAS. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: description: - Virtual IP of the NetWeaver AAS instance. - Mandatory for NetWeaver AAS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: default: vip___aas description: - Name of the SAPInstance resource for NetWeaver AAS. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: default: Filesystem_NWAS_SAPMNT_ @@ -601,8 +501,6 @@ argument_specs: - Filesystem resource name for the shared filesystem /sapmnt. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: default: Filesystem_NWAS_TRANS_ @@ -610,8 +508,6 @@ argument_specs: - Filesystem resource name for the transports filesystem /usr/sap/trans. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: default: Filesystem_NWAS_SYS_ @@ -619,15 +515,12 @@ argument_specs: - Filesystem resource name for the transports filesystem /usr/sap//SYS. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: + type: bool default: false description: - Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources. - required: false - type: bool ########################################################################## @@ -638,66 +531,49 @@ argument_specs: description: - The name of the ASCS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: description: - The full path and name of the ASCS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ASCS__ description: - Name of the filesystem resource for the ASCS instance. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ASCS__ description: - Name of the ASCS instance resource. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + type: bool default: false description: - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: default: 5000 description: - NetWeaver ASCS instance resource stickiness attribute. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: default: 1 description: - NetWeaver ASCS instance migration-threshold setting attribute. - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: default: 60 description: - NetWeaver ASCS instance failure-timeout attribute. - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: default: 3000 description: - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. - required: false - type: str ########################################################################## @@ -708,36 +584,27 @@ argument_specs: description: - The name of the ERS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: description: - The full path and name of the ERS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + type: bool default: false description: - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". - required: false - type: bool sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ERS__ description: - Name of the filesystem resource for the ERS instance. - required: false - type: str sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ERS__ description: - Name of the ERS instance resource. - required: false - type: str ########################################################################## @@ -758,32 +625,25 @@ argument_specs: ########################################################################## sap_ha_pacemaker_cluster_aws_vip_update_rt: + type: list description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. - Mandatory for the VIP resource configuration in AWS EC2 environments. - required: false - type: list sap_ha_pacemaker_cluster_aws_region: description: - The AWS region in which the instances to be used for the cluster setup are located. - Mandatory for cluster nodes setup on AWS EC2 instances. - required: false - type: str sap_ha_pacemaker_cluster_aws_access_key_id: description: - AWS access key to allow control of instances (for example for fencing operations). - Mandatory for the cluster nodes setup on AWS EC2 instances. - required: false - type: str sap_ha_pacemaker_cluster_aws_secret_access_key: description: - AWS secret key, paired with the access key for instance control. - Mandatory for the cluster setup on AWS EC2 instances. - required: false - type: str ########################################################################## @@ -794,15 +654,11 @@ argument_specs: description: - Google Cloud project name in which the target instances are installed. - Mandatory for the cluster setup on GCP instances. - required: false - type: str sap_ha_pacemaker_cluster_gcp_region_zone: description: - Google Cloud Platform region zone ID. - Mandatory for the cluster setup on GCP instances. - required: false - type: str ########################################################################## @@ -813,15 +669,11 @@ argument_specs: description: - The API key which is required to allow the control of instances (for example for fencing operations). - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. - required: false - type: str sap_ha_pacemaker_cluster_ibmcloud_region: description: - The IBM Cloud VS region name in which the instances are running. - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. - required: false - type: str ########################################################################## @@ -832,29 +684,21 @@ argument_specs: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str # # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: # description: # - # - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# required: false -# type: str ########################################################################## @@ -865,12 +709,8 @@ argument_specs: description: - Subscription ID of the MS Azure environment containing the target instances. - Mandatory for the cluster setup on MS Azure instances. - required: false - type: str sap_ha_pacemaker_cluster_msazure_resource_group: description: - Resource group name/ID in which the target instances are defined. - Mandatory for the cluster setup on MS Azure instances. - required: false - type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml index 5a7084754..db3eded7f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml @@ -22,7 +22,7 @@ # __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages # __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages # __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password -# __sap_ha_pacemaker_cluster_repos ha_cluster_repos +# __sap_ha_pacemaker_cluster_repos __ha_cluster_repos # __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones # __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups # __sap_ha_pacemaker_cluster_resource_primitives ha_cluster_resource_primitives @@ -76,7 +76,7 @@ - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" when: __sap_ha_pacemaker_cluster_repos is defined ansible.builtin.set_fact: - ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" + __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_resource_clones'" when: __sap_ha_pacemaker_cluster_resource_clones is defined diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index 6553e8f98..d990853b9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -22,18 +22,18 @@ no_log: true # secure the credential -# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default -# sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* for certain target environments -# sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* +# sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default +# __sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* +# __sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* # Empty defaults defined here for optional non-user-facing parameters. - name: "SAP HA Prepare Pacemaker - Combine extra packages lists" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_extra_packages: "{{ + __sap_ha_pacemaker_cluster_extra_packages: "{{ ( sap_ha_pacemaker_cluster_extra_packages - + sap_ha_pacemaker_cluster_sap_extra_packages | default([]) - + sap_ha_pacemaker_cluster_platform_extra_packages | default([]) - }}" + + __sap_ha_pacemaker_cluster_sap_extra_packages + + __sap_ha_pacemaker_cluster_platform_extra_packages + ) | unique }}" # sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default @@ -42,8 +42,8 @@ - name: "SAP HA Prepare Pacemaker - Combine fence agent packages lists" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ + __sap_ha_pacemaker_cluster_fence_agent_packages: "{{ ( sap_ha_pacemaker_cluster_fence_agent_minimal_packages + sap_ha_pacemaker_cluster_fence_agent_packages + __sap_ha_pacemaker_cluster_fence_agent_packages - }}" + ) | unique }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 6d77a1c67..00bfc6eec 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -11,6 +11,28 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 +- name: "SAP HA Prepare Pacemaker - (SAP HANA) Validate SAP Instance Number" + ansible.builtin.assert: + that: + - ( + sap_ha_pacemaker_cluster_hana_instance_number | type_debug != 'int' + and sap_ha_pacemaker_cluster_hana_instance_number | length == 2 + ) + or + ( + sap_ha_pacemaker_cluster_hana_instance_number | type_debug == 'int' + and sap_ha_pacemaker_cluster_hana_instance_number is regex("^[0-9][0-9]$") + ) + fail_msg: | + + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires 'sap_ha_pacemaker_cluster_hana_instance_number' to be defined. + + The instance number must be exactly 2 digits. + Add quotes if the number starts with a 0! + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + - name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP System ID" ansible.builtin.assert: that: @@ -22,6 +44,37 @@ when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 +- name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP Instance Number" + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap') | length > 0 + ansible.builtin.assert: + that: + - ( + ascs_ers_nr_item | type_debug != 'int' + and ascs_ers_nr_item | length == 2 + ) + or + ( + ascs_ers_nr_item | type_debug == 'int' + and ascs_ers_nr_item is regex("^[0-9][0-9]$") + ) + fail_msg: | + + Host type = {{ sap_ha_pacemaker_cluster_host_type }} + Requires the ASCS/ERS instance numbers to be defined: + - sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number + - sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number + + The instance number must be exactly 2 digits. + Add quotes if the number starts with a 0! + + loop: + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + loop_control: + loop_var: ascs_ers_nr_item + + # NIC definition validation - name: "SAP HA Prepare Pacemaker - Verify that a custom NIC name is defined when multiple NICs exist" ansible.builtin.assert: diff --git a/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 b/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 index 5f35649d0..87a96a067 100644 --- a/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 +++ b/roles/sap_ha_pacemaker_cluster/templates/cluster_create_config.j2 @@ -5,66 +5,46 @@ # Created by: {{ ansible_role_name }} # The name of the cluster -ha_cluster_cluster_name: {{ __sap_ha_pacemaker_cluster_cluster_name }} +ha_cluster_cluster_name: {{ ha_cluster_cluster_name | default('') }} -{% if __sap_ha_pacemaker_cluster_cluster_properties is defined and __sap_ha_pacemaker_cluster_cluster_properties|length > 0 %} # Properties that enable and control cluster behavior ha_cluster_cluster_properties: -{{ __sap_ha_pacemaker_cluster_cluster_properties | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_cluster_properties | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_colocation is defined and __sap_ha_pacemaker_cluster_constraints_colocation|length > 0 %} # Definition of resources which depend on other resources ha_cluster_constraints_colocation: -{{ __sap_ha_pacemaker_cluster_constraints_colocation | to_nice_yaml(indent=2) }} -{%- endif -%} +{{ ha_cluster_constraints_colocation | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_location is defined and __sap_ha_pacemaker_cluster_constraints_location|length > 0 %} # Definition of resources which have specific location dependencies or preferences ha_cluster_constraints_location: -{{ __sap_ha_pacemaker_cluster_constraints_location | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_constraints_location | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_constraints_order is defined and __sap_ha_pacemaker_cluster_constraints_order|length > 0 %} # Definition of an order in which resources must be started. # They are automatically stopped in reverse order. ha_cluster_constraints_order: -{{ __sap_ha_pacemaker_cluster_constraints_order | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_constraints_order | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_extra_packages is defined and __sap_ha_pacemaker_cluster_extra_packages|length > 0 %} # Extra packages that are needed for this HA environment ha_cluster_extra_packages: -{{ __sap_ha_pacemaker_cluster_extra_packages | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_extra_packages | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_fence_agent_packages is defined and __sap_ha_pacemaker_cluster_fence_agent_packages|length > 0 %} # Fence agent package(s) for this HA environment ha_cluster_fence_agent_packages: -{{ __sap_ha_pacemaker_cluster_fence_agent_packages | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_fence_agent_packages | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_repos is defined and __sap_ha_pacemaker_cluster_repos|length > 0 %} # Definition of repositories to enable (if disable) to ensure # access to all required packages __ha_cluster_repos: -{{ __sap_ha_pacemaker_cluster_repos | to_nice_yaml(indent=2) }} -{%- endif %} +{{ __ha_cluster_repos | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_clones is defined and __sap_ha_pacemaker_cluster_resource_clones|length > 0 %} # Definition of resources that are cloned and monitored on all nodes ha_cluster_resource_clones: -{{ __sap_ha_pacemaker_cluster_resource_clones | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_clones | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_groups is defined and __sap_ha_pacemaker_cluster_resource_groups|length > 0 %} # Definition of resources that are grouped together ha_cluster_resource_groups: -{{ __sap_ha_pacemaker_cluster_resource_groups | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_groups | default() | to_nice_yaml(indent=2) }} -{% if __sap_ha_pacemaker_cluster_resource_primitives is defined and __sap_ha_pacemaker_cluster_resource_primitives|length > 0 %} # Definition of all cluster resources ha_cluster_resource_primitives: -{{ __sap_ha_pacemaker_cluster_resource_primitives | to_nice_yaml(indent=2) }} -{%- endif %} +{{ ha_cluster_resource_primitives | default()| to_nice_yaml(indent=2) }} diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml index 4e356cae9..4175257b5 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml @@ -3,7 +3,7 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap-hana-scaleout sap_ha_pacemaker_cluster_ra_hana: SAPHanaController diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml index 5c76b2497..85043b5c5 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml @@ -3,7 +3,7 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap-hana sap_ha_pacemaker_cluster_ra_hana: SAPHana diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 70c7d6a8c..1590917a3 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -31,12 +31,11 @@ __sap_ha_pacemaker_cluster_required_facts: # This is automatically adjusted during preparation tasks. __sap_ha_pacemaker_cluster_nic_multi_bool: false -# Define empty parameters to avoid undefined input variables. -# The arguments_spec check complains. -# The actual values must be empty, they are set by various tasks! # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' + +# __sap_ha_pacemaker_cluster_supported_platforms: - cloud_aws_ec2_vs - cloud_msazure_vm @@ -53,18 +52,25 @@ __sap_ha_pacemaker_cluster_supported_platforms: # which have defaults in the 'ha_cluster' LSR. # Remove this section when validated. # -#__sap_ha_pacemaker_cluster_cluster_name: '' -#__sap_ha_pacemaker_cluster_cluster_properties: [] -#__sap_ha_pacemaker_cluster_constraints_colocation: [] -#__sap_ha_pacemaker_cluster_constraints_location: [] -#__sap_ha_pacemaker_cluster_constraints_order: [] -#__sap_ha_pacemaker_cluster_extra_packages: [] -#__sap_ha_pacemaker_cluster_fence_agent_packages: [] +# Never set defaults for these: +#__sap_ha_pacemaker_cluster_cluster_name: #__sap_ha_pacemaker_cluster_hacluster_password: -#__sap_ha_pacemaker_cluster_repos: [] -#__sap_ha_pacemaker_cluster_resource_primitives: [] -#__sap_ha_pacemaker_cluster_resource_groups: [] -#__sap_ha_pacemaker_cluster_resource_clones: [] -# + + +# Pre-define internal optional parameters to avoid defaults in the code: +__sap_ha_pacemaker_cluster_sap_extra_packages: [] +__sap_ha_pacemaker_cluster_platform_extra_packages: [] + +__sap_ha_pacemaker_cluster_cluster_properties: [] +__sap_ha_pacemaker_cluster_constraints_colocation: [] +__sap_ha_pacemaker_cluster_constraints_location: [] +__sap_ha_pacemaker_cluster_constraints_order: [] +__sap_ha_pacemaker_cluster_extra_packages: [] +__sap_ha_pacemaker_cluster_fence_agent_packages: [] +__sap_ha_pacemaker_cluster_repos: [] +__sap_ha_pacemaker_cluster_resource_primitives: [] +__sap_ha_pacemaker_cluster_resource_groups: [] +__sap_ha_pacemaker_cluster_resource_clones: [] + # Predefine host_map for variable construction __sap_ha_pacemaker_cluster_pcmk_host_map: '' diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml index 21dd17d20..e23244431 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml @@ -3,5 +3,5 @@ # # TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_sap_extra_packages: +__sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index 9153f6591..238960267 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-aws -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - awscli __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index 160f6135d..34e9ade20 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-gce -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - resource-agents-gcp __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml index af35b0202..588f97be0 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-ibm-powervs -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml index 5430a4608..076495c61 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-ibm-vpc -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml index 2d056bf12..cf23a19a2 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-azure-arm -sap_ha_pacemaker_cluster_platform_extra_packages: +__sap_ha_pacemaker_cluster_platform_extra_packages: - socat __sap_ha_pacemaker_cluster_repos: 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 dfcb407fd..083622f47 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 @@ -6,7 +6,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-lpar -#sap_ha_pacemaker_cluster_platform_extra_packages: +#__sap_ha_pacemaker_cluster_platform_extra_packages: # - __sap_ha_pacemaker_cluster_repos: From a707185e811f7240ee8b7113af49c8a7f5d930b3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 15:45:32 +0200 Subject: [PATCH 144/179] sap_ha_pacemaker_cluster: IBM Power VS adjustments --- roles/sap_ha_pacemaker_cluster/README.md | 22 ++++++++++++ .../defaults/main.yml | 1 - .../meta/argument_specs.yml | 34 ++++++++----------- .../tasks/platform/include_vars_platform.yml | 4 +-- ...egister_sysinfo_cloud_ibmcloud_powervs.yml | 19 ++++++++--- .../vars/platform_cloud_ibmcloud_powervs.yml | 8 ++--- 6 files changed, 58 insertions(+), 30 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index fb18aff22..3e212c297 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -407,6 +407,28 @@ The default is a 2-node SAP HANA scale-up cluster.
The API key which is required to allow the control of instances (for example for fencing operations).
Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud.
+### sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type + +- _Type:_ `string` + +IBM Power Virtual Server API Endpoint type (public or private) dependent on network interface attachments for the target instances.
+['Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.']
+ +### sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url + +- _Type:_ `string` + +IBM Power Virtual Server forward proxy url when IBM Power Virtual Server API Endpoint type is set to private.
+When public network interface, can be ignored.
+When private network interface, mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.
+ +### sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn + +- _Type:_ `string` + +IBM Power Virtual Server Workspace service cloud resource name (CRN) identifier which contains the target instances
+Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud.
+ ### sap_ha_pacemaker_cluster_ibmcloud_region - _Type:_ `string` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index c654ab685..062c04aa3 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -293,7 +293,6 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: # sap_ha_pacemaker_cluster_ibmcloud_api_key # sap_ha_pacemaker_cluster_ibmcloud_region # sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid # sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type # sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 131a26662..eddf1b298 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -680,25 +680,21 @@ argument_specs: # Platforms: IBM Power VS on IBM Cloud specific parameters ########################################################################## -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. -# -# sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: -# description: -# - -# - Mandatory for the cluster setup on IBM Cloud Virtual Server instances or IBM Power Virtual Server on IBM Cloud. + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn: + description: + - IBM Power Virtual Server Workspace service cloud resource name (CRN) identifier which contains the target instances + - Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. + + sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type: + description: + - IBM Power Virtual Server API Endpoint type (public or private) dependent on network interface attachments for the target instances. + - - Mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. + + sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url: + description: + - IBM Power Virtual Server forward proxy url when IBM Power Virtual Server API Endpoint type is set to private. + - When public network interface, can be ignored. + - When private network interface, mandatory for the cluster setup on IBM Power Virtual Server from IBM Cloud. ########################################################################## 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 f48692a74..82181c6fb 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 @@ -20,10 +20,10 @@ {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs" - - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid }}" when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... @@ -31,7 +31,7 @@ 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_ibmcloud_powervs_host_guid }} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmcloud_powervs_instance_id }} {%- if not loop.last %};{% endif %} {% endfor %} when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml index c31078c72..157beee98 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml @@ -1,9 +1,20 @@ --- # Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture. -# Identify from RSCT binary instead. -- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Register instance ID" + +# The IBM Power Virtual Server Workspace GUID is different from the IBM Power Virtual Server Workspace CRN, +# and the CRN cannot be detected from inside the IBM Power Virtual Server instance +- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server Workspace GUID ansible.builtin.shell: | - /opt/rsct/bin/ctgethscid -value PartitionUUID - register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host + set -o pipefail && cat /run/cloud-init/instance-data.json | grep project_id | cut -d \" -f4 + register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_instance_id + changed_when: false + check_mode: false + +# alt command using IBM Power RSCT binary: /opt/rsct/bin/ctgethscid | grep PartitionUUID | cut -d \" -f2 +# alt command using cloud-init data: cat /run/cloud-init/instance-data.json | grep uuid | cut -d \" -f4 +- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server instance ID + ansible.builtin.shell: | + set -o pipefail && echo $(tr -d '\0' < /proc/device-tree/ibm,partition-name) + register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid changed_when: false check_mode: false diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml index 588f97be0..82e71e1c9 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -28,10 +28,10 @@ sap_ha_pacemaker_cluster_stonith_default: token: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" region: "{{ sap_ha_pacemaker_cluster_ibmcloud_region }}" crn: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn }}" - instance: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid }}" - plug: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }}" # Identified during execution initial tasks, populated when variables are imported - api-type: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type | default('private') }}" - proxy: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url }}" + instance: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid }}" # Identified during execution initial tasks, populated when variables are imported + plug: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_instance_id }}" # Identified during execution initial tasks, populated when variables are imported + api-type: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type | default('public') }}" # Dependent on network interface attachments, if no public network interface then 'private' value must be provided. + proxy: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url | default('') }}" # Dependent on network interface attachments, if no public network interface then a valid HTTP Proxy URL value must be provided. sap_ha_pacemaker_cluster_fence_options: pcmk_reboot_retries: 4 From df6d9cd1418ea6c1eee8f9ea4c9e9cd498e7094c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 17:00:40 +0200 Subject: [PATCH 145/179] sap_ha_pacemaker_cluster: minor IBM Power VS vars adjustments --- .../tasks/platform/include_vars_platform.yml | 2 +- .../platform/register_sysinfo_cloud_ibmcloud_powervs.yml | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) 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 82181c6fb..2779d9d65 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 @@ -23,7 +23,7 @@ - name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" - sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_guid }}" + sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid: '{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_workspace_crn | replace("::","") | regex_replace(".*\:") }}' when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" # pcmk_host_map format: :;:... diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml index 157beee98..63be853f6 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml @@ -1,15 +1,6 @@ --- # Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture. -# The IBM Power Virtual Server Workspace GUID is different from the IBM Power Virtual Server Workspace CRN, -# and the CRN cannot be detected from inside the IBM Power Virtual Server instance -- name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server Workspace GUID - ansible.builtin.shell: | - set -o pipefail && cat /run/cloud-init/instance-data.json | grep project_id | cut -d \" -f4 - register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_instance_id - changed_when: false - check_mode: false - # alt command using IBM Power RSCT binary: /opt/rsct/bin/ctgethscid | grep PartitionUUID | cut -d \" -f2 # alt command using cloud-init data: cat /run/cloud-init/instance-data.json | grep uuid | cut -d \" -f4 - name: SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - IBM Power Virtual Server instance ID From ea827c35b73133f0e06268404b8570ba011b800c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 22 Sep 2023 17:01:38 +0200 Subject: [PATCH 146/179] sap_install_media_detect: add comments to explain the SAPCAR file extraction methods --- .../tasks/organize_files.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 6b9adeb02..7fbd528e6 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -132,6 +132,10 @@ - line_item.archive_type == 'rarexe' - line_item.extract_archive == 'y' +# SAP HANA sapcar archive files have a directory structure with a single directory (e.g. SAP_HANA_DATBASE) which contains all files. +# We want the extracted files to be placed in extraction_dir under this directory name, allowing multiple directories in extraction_dir. +# So we create a temporary directory, move the file SIGNATURE.SMF (which the sapcar command extracts to the level above) to this directory, +# and then move the single directory to the extraction_dir. - name: SAP Install Media Detect - Organize all files - Create temp dir for sapcar archive files - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract ansible.builtin.file: path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" @@ -161,6 +165,14 @@ - line_item.archive_type == 'sapcar' - line_item.sap_file_type is search('saphana') +- name: SAP Install Media Detect - Organize all files - Remove temp dir - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract + ansible.builtin.file: + path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" + state: absent + +# Non-SAP HANA sapcar archive files can have various different directory structures: Can be all flat, or up to 13 directory levels. +# We want the extracted files to be placed in the extraction_dir for this file, each file tree having its own separate directory. +# So we can directly extract the sapcar files to the final extraction_dir. - name: SAP Install Media Detect - Organize all files - Extract non-HANA sapcar archive files ansible.builtin.shell: >- {{ __sap_install_media_detect_fact_sapcar_path }} @@ -178,11 +190,6 @@ - line_item.archive_type == 'sapcar' - not line_item.sap_file_type is search('saphana') -- name: SAP Install Media Detect - Organize all files - Remove temp dir - {{ __sap_install_media_detect_software_main_directory }}/tmp_extract - ansible.builtin.file: - path: "{{ __sap_install_media_detect_software_main_directory }}/tmp_extract" - state: absent - - name: SAP Install Media Detect - Organize all files - Copy certain files to 'sap_hana' directory ansible.builtin.copy: src: "{{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }}" From 2aace3534ebf0102c4b121691cd7ee647d6422b6 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 17:55:01 +0200 Subject: [PATCH 147/179] sap_ha_pacemaker_cluster: improved default VIP logic and removal of validated commented blocks --- .../defaults/main.yml | 1 + .../tasks/include_construct_vip_resources.yml | 8 ++--- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 31 ------------------- roles/sap_ha_pacemaker_cluster/vars/main.yml | 4 --- 4 files changed, 5 insertions(+), 39 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 062c04aa3..f3845dace 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -69,6 +69,7 @@ sap_ha_pacemaker_cluster_fence_options: # Currently there is no task for a different default VIP resource agent. # Leaving out of meta/argument_specs.yml. # Platform specific defaults are defined separately. +sap_ha_pacemaker_cluster_vip_method: ipaddr # intended internal usage, but overridable for testing sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 1007f703b..7d2d2ad03 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -40,8 +40,8 @@ loop_var: vip_list_item label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - - vip_list_item.value != '' + - sap_ha_pacemaker_cluster_vip_method == 'ipaddr' + - vip_list_item.value | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" @@ -52,8 +52,8 @@ loop_var: vip_list_item label: "{{ vip_list_item.key }} - {{ vip_list_item.value }}" when: - - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms - - vip_list_item.value != '' + - sap_ha_pacemaker_cluster_vip_method != 'ipaddr' + - vip_list_item.value | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 02deaebbc..f13fe361a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -135,20 +135,6 @@ - __sap_ha_pacemaker_cluster_disable_services.failed - '"Could not find the requested service" not in __sap_ha_pacemaker_cluster_disable_services.msg' -# # Before we are ready to call the ha_cluster role, we want to validate -# # that the minimum required parameters are defined and not empty. -# # TODO: make this smarter, currently all these vars are pre-defined anyway -# - name: "SAP HA Install Pacemaker - Validate parameters for 'ha_cluster' role input" -# ansible.builtin.assert: -# that: -# - __sap_ha_pacemaker_cluster_cluster_properties is defined -# - __sap_ha_pacemaker_cluster_extra_packages is defined -# - __sap_ha_pacemaker_cluster_resource_primitives is defined -# - __sap_ha_pacemaker_cluster_resource_clones is defined -# - __sap_ha_pacemaker_cluster_constraints_order is defined -# - __sap_ha_pacemaker_cluster_constraints_colocation is defined -# fail_msg: "Cluster build parameter construction has failed for this parameter." - - name: "SAP HA Install Pacemaker - Query if CIB already exists" ansible.builtin.command: cmd: cibadmin --query @@ -177,23 +163,6 @@ apply: tags: ha_cluster no_log: true # some parameters contain secrets - no_log: true # some parameters contain secrets -# -# Remove hard-coded parameters and set 'ha_cluster' LSR parameters in this play right -# before the 'ha_cluster' role is included. -# vars: -# __ha_cluster_repos: "{{ __sap_ha_pacemaker_cluster_repos }}" -# ha_cluster_cluster_name: "{{ __sap_ha_pacemaker_cluster_cluster_name }}" -# ha_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order }}" -# ha_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation }}" -# ha_cluster_constraints_location: "{{ __sap_ha_pacemaker_cluster_constraints_location }}" -# ha_cluster_cluster_properties: "{{ __sap_ha_pacemaker_cluster_cluster_properties }}" -# ha_cluster_extra_packages: "{{ __sap_ha_pacemaker_cluster_extra_packages }}" -# ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" -# ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" -# ha_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones }}" -# ha_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups }}" -# ha_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives }}" tags: ha_cluster # Resource defaults settings were added to "ha_cluster" in Apr 2023 (GH version 1.9.0) diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 1590917a3..5ad6c4503 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -35,10 +35,6 @@ __sap_ha_pacemaker_cluster_nic_multi_bool: false # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' -# -__sap_ha_pacemaker_cluster_supported_platforms: - - cloud_aws_ec2_vs - - cloud_msazure_vm # ATTENTION: # Any variables for 'ha_cluster' which this SAP role supports/inherits should also From 621bad64c8a9bd5f2f7035d0e1ae911c736b206f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 22 Sep 2023 18:15:33 +0200 Subject: [PATCH 148/179] sap_ha_pacemaker_cluster: move var and comment out PowerVM include --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 1 - .../tasks/platform/ascertain_platform_type.yml | 12 ++++++------ roles/sap_ha_pacemaker_cluster/vars/main.yml | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index f3845dace..062c04aa3 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -69,7 +69,6 @@ sap_ha_pacemaker_cluster_fence_options: # Currently there is no task for a different default VIP resource agent. # Leaving out of meta/argument_specs.yml. # Platform specific defaults are defined separately. -sap_ha_pacemaker_cluster_vip_method: ipaddr # intended internal usage, but overridable for testing sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_client_interface: '' 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 26715c375..a12ee9c30 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 @@ -98,12 +98,12 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_powervs -#- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVC" -# when: -# - ansible_architecture == "ppc64le" -# - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVM" + when: + - ansible_architecture == "ppc64le" + - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm #- name: "SAP HA Prepare Pacemaker - Check if platform is VMware vSphere" # when: diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 5ad6c4503..22384d3de 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -31,6 +31,9 @@ __sap_ha_pacemaker_cluster_required_facts: # This is automatically adjusted during preparation tasks. __sap_ha_pacemaker_cluster_nic_multi_bool: false +# By default use the construction of IPaddr2 VIP resources. +# Platforms define different methods as applicable. +sap_ha_pacemaker_cluster_vip_method: ipaddr # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' From e1d763407485f6c28f3a6f6f231972911d9ff1ed Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 22 Sep 2023 18:35:21 +0200 Subject: [PATCH 149/179] sap_install_media_detect: replace shell by command module where possible. --- roles/sap_install_media_detect/tasks/organize_files.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/organize_files.yml b/roles/sap_install_media_detect/tasks/organize_files.yml index 7fbd528e6..8605d257a 100644 --- a/roles/sap_install_media_detect/tasks/organize_files.yml +++ b/roles/sap_install_media_detect/tasks/organize_files.yml @@ -174,7 +174,7 @@ # We want the extracted files to be placed in the extraction_dir for this file, each file tree having its own separate directory. # So we can directly extract the sapcar files to the final extraction_dir. - name: SAP Install Media Detect - Organize all files - Extract non-HANA sapcar archive files - ansible.builtin.shell: >- + ansible.builtin.command: >- {{ __sap_install_media_detect_fact_sapcar_path }} -R {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.extraction_dir }} -xvf {{ __sap_install_media_detect_software_main_directory }}/{{ line_item.file }} From 98df7769588b67cb498ddcad3299c866ba17ca25 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 25 Sep 2023 17:42:21 +0200 Subject: [PATCH 150/179] 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 --- roles/sap_ha_pacemaker_cluster/README.md | 8 + .../defaults/main.yml | 4 + .../meta/argument_specs.yml | 7 + ...re_netweaver_ascs_ers_postinstallation.yml | 200 ++++++++++++++++++ .../configure_netweaver_postinstallation.yml | 97 --------- .../tasks/construct_vars_common.yml | 5 +- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 2 +- .../vars/nwas_abap_ascs_ers.yml | 6 + .../vars/nwas_common.yml | 1 + .../sap_ha_pacemaker_cluster/vars/redhat.yml | 13 ++ roles/sap_ha_pacemaker_cluster/vars/suse.yml | 13 ++ 11 files changed, 255 insertions(+), 101 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml delete mode 100644 roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/suse.yml diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 3e212c297..e34db31e5 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -239,6 +239,14 @@ This allows using the output file later as input file for additional custom step When enabled this parameters file is also created when the playbook is run in check_mode (`--check`) and can be used to review the configuration parameters without executing actual changes on the target nodes.
WARNING! This report may include sensitive details like secrets required for certain cluster resources!
+### sap_ha_pacemaker_cluster_enable_cluster_connector + +- _Type:_ `bool` +- _Default:_ `True` + +Enables/Disables the SAP HA Interface for SAP ABAP application server instances, also known as `sap_cluster_connector`.
+Set this parameter to 'false' if the SAP HA interface should not be installed and configured.
+ ### sap_ha_pacemaker_cluster_extra_packages - _Type:_ `list` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 062c04aa3..760b03bd9 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -149,6 +149,10 @@ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacema # set this parameter to 'true'. sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false +# Enable/Disable sap_cluster_connector. +# Ref.: https://access.redhat.com/solutions/3606101 +sap_ha_pacemaker_cluster_enable_cluster_connector: true + # Inherit common synonym NetWeaver parameters when defined. sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}" diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index eddf1b298..19e2a063a 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -350,6 +350,13 @@ argument_specs: - The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2. - Set this parameter to 'true' to configure it as ENSA1. + sap_ha_pacemaker_cluster_enable_cluster_connector: + type: bool + default: true + description: + - Enables/Disables the SAP HA Interface for SAP ABAP application server instances, also known as `sap_cluster_connector`. + - Set this parameter to 'false' if the SAP HA interface should not be installed and configured. + sap_ha_pacemaker_cluster_netweaver_sid: description: - SID of the NetWeaver instances. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml new file mode 100644 index 000000000..0660a3aab --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml @@ -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. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml deleted file mode 100644 index e23612358..000000000 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_postinstallation.yml +++ /dev/null @@ -1,97 +0,0 @@ ---- -# 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 units" - 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 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index d990853b9..f25a1504f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -25,7 +25,6 @@ # sap_ha_pacemaker_cluster_extra_packages -> user-defined, empty by global default # __sap_ha_pacemaker_cluster_sap_extra_packages -> included from vars/* # __sap_ha_pacemaker_cluster_platform_extra_packages -> included from vars/platform* -# Empty defaults defined here for optional non-user-facing parameters. - name: "SAP HA Prepare Pacemaker - Combine extra packages lists" ansible.builtin.set_fact: @@ -33,8 +32,8 @@ sap_ha_pacemaker_cluster_extra_packages + __sap_ha_pacemaker_cluster_sap_extra_packages + __sap_ha_pacemaker_cluster_platform_extra_packages - ) | unique }}" - + ) | unique | select() }}" + # remove duplicates and empty elements # sap_ha_pacemaker_cluster_fence_agent_minimal_packages -> global default # sap_ha_pacemaker_cluster_fence_agent_packages -> global default diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index f13fe361a..71139b5d5 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -202,7 +202,7 @@ - name: "SAP HA Install Pacemaker - Include NetWeaver ASCS/ERS post installation" ansible.builtin.include_tasks: - file: configure_netweaver_postinstallation.yml + file: configure_netweaver_ascs_ers_postinstallation.yml apply: tags: nwas_postinst tags: nwas_postinst diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml index 04197d622..46e12821a 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml @@ -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 }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml index e23244431..c74b238e6 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml @@ -5,3 +5,4 @@ __sap_ha_pacemaker_cluster_sap_extra_packages: - resource-agents-sap + - "{% if sap_ha_pacemaker_cluster_enable_cluster_connector %}{{ __sap_ha_pacemaker_cluster_halib_package }}{% endif %}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml index a65619099..72ed6ca32 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml @@ -4,3 +4,16 @@ __sap_ha_pacemaker_cluster_repos: - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rpms" name: High Availability + +__sap_ha_pacemaker_cluster_halib_package: sap-cluster-connector + +# List of configuration lines that must be added to the instance profiles. +# Used in tasks/configure_netweaver_ascs_ers_postinstallation.yml for SAP HAlib setup. +__sap_ha_pacemaker_cluster_connector_config_lines: + - "service/halib = $(DIR_EXECUTABLE)/saphascriptco.so" + - "service/halib_cluster_connector = /usr/bin/sap_cluster_connector" + +# Cluster command to manage resources - pcs commands in Redhat OS family. +__sap_ha_pacemaker_cluster_command: + resource_stop: "pcs resource disable" + resource_start: "pcs resource enable" diff --git a/roles/sap_ha_pacemaker_cluster/vars/suse.yml b/roles/sap_ha_pacemaker_cluster/vars/suse.yml new file mode 100644 index 000000000..6b54f8c59 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/suse.yml @@ -0,0 +1,13 @@ +--- +__sap_ha_pacemaker_cluster_halib_package: sap-suse-cluster-connector + +# List of configuration lines that must be added to the instance profiles. +# Used in tasks/configure_netweaver_ascs_ers_postinstallation.yml for SAP HAlib setup. +__sap_ha_pacemaker_cluster_connector_config_lines: + - "service/halib = $(DIR_EXECUTABLE)/saphascriptco.so" + - "service/halib_cluster_connector = /usr/bin/sap_suse_cluster_connector" + +# Cluster commands to manage resources - crmsh commands in SUSE OS family. +__sap_ha_pacemaker_cluster_command: + resource_stop: "crm resource stop" + resource_start: "crm resource start" From 05f89d3f19a9f92a1560c55937d7ca244f920f42 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 25 Sep 2023 18:10:23 +0200 Subject: [PATCH 151/179] sap_ha_pacemaker_cluster: moved cluster commands to rhel/sles chosen syntax --- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 4 ++-- roles/sap_ha_pacemaker_cluster/vars/redhat.yml | 2 ++ roles/sap_ha_pacemaker_cluster/vars/suse.yml | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 71139b5d5..efcb6aed0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -172,7 +172,7 @@ - name: "SAP HA Install Pacemaker - Check resource defaults" ansible.builtin.command: cmd: | - pcs resource defaults config + {{ __sap_ha_pacemaker_cluster_command.resource_defaults_show }} register: __sap_ha_pacemaker_cluster_check_resource_defaults run_once: true changed_when: false @@ -185,7 +185,7 @@ - __sap_ha_pacemaker_cluster_resource_defaults | length > 0 ansible.builtin.command: cmd: | - pcs resource defaults update {{ item.key }}={{ item.value }} + {{ __sap_ha_pacemaker_cluster_command.resource_defaults_update }} {{ item.key }}={{ item.value }} loop: "{{ __sap_ha_pacemaker_cluster_resource_defaults | dict2items }}" loop_control: label: "{{ item.key }}={{ item.value }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml index 72ed6ca32..e8bcccc3c 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml @@ -17,3 +17,5 @@ __sap_ha_pacemaker_cluster_connector_config_lines: __sap_ha_pacemaker_cluster_command: resource_stop: "pcs resource disable" resource_start: "pcs resource enable" + resource_defaults_show: "pcs resource defaults config" + resource_defaults_update: "pcs resource defaults update" diff --git a/roles/sap_ha_pacemaker_cluster/vars/suse.yml b/roles/sap_ha_pacemaker_cluster/vars/suse.yml index 6b54f8c59..33314e950 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/suse.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/suse.yml @@ -11,3 +11,5 @@ __sap_ha_pacemaker_cluster_connector_config_lines: __sap_ha_pacemaker_cluster_command: resource_stop: "crm resource stop" resource_start: "crm resource start" + resource_defaults_show: "crm configure show type:rsc_defaults" + resource_defaults_update: "crm configure rsc_defaults" From b625184263525b08417af872b40a8d80fb249f20 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 25 Sep 2023 18:36:06 +0200 Subject: [PATCH 152/179] sap_install_media_detect: Solve issue #474 --- roles/sap_install_media_detect/tasks/main.yml | 8 ++++ .../prepare/create_file_list_phase_1.yml | 2 +- .../prepare/create_file_list_phase_2.yml | 2 +- .../prepare/move_files_to_main_directory.yml | 47 +++++++++++++++++++ 4 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 932a540ec..9a996eae6 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -47,6 +47,14 @@ tags: sap_install_media_detect_add_file_extension tags: sap_install_media_detect_add_file_extension +- name: SAP Install Media Detect - Move any files from subdirectories to main directory + ansible.builtin.include_tasks: + file: prepare/move_files_to_main_directory.yml + apply: + tags: sap_install_media_detect_move_files_to_main_directory + tags: sap_install_media_detect_move_files_to_main_directory + when: not sap_install_media_detect_file_server_only + - name: SAP Install Media Detect - Create a list of all required files, phase 2 ansible.builtin.include_tasks: file: prepare/create_file_list_phase_2.yml diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml index 15f6c24d6..3240c91ad 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_1.yml @@ -4,7 +4,7 @@ # With implicit initialization (by using the default filter), the variables would be appended again if the role # was called more than once in a playbook. # See https://github.com/sap-linuxlab/community.sap_install/issues/402 . -- name: SAP Install Media Detect - Prepare - Initialize fact variables +- name: SAP Install Media Detect - Prepare - Initialize fact variables, phase 1 ansible.builtin.set_fact: __sap_install_media_detect_fact_find_result_phase_1: [] __sap_install_media_detect_fact_files_without_extension: [] diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml index 63e655f7d..7d06d4efe 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list_phase_2.yml @@ -4,7 +4,7 @@ # With implicit initialization (by using the default filter), the variables would be appended again if the role # was called more than once in a playbook. # See https://github.com/sap-linuxlab/community.sap_install/issues/402 . -- name: SAP Install Media Detect - Prepare - Initialize fact variables +- name: SAP Install Media Detect - Prepare - Initialize fact variables, phase 2 ansible.builtin.set_fact: __sap_install_media_detect_fact_find_result_phase_2: [] __sap_install_media_detect_fact_files_sapfile_results: [] diff --git a/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml new file mode 100644 index 000000000..8b20bca14 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/move_files_to_main_directory.yml @@ -0,0 +1,47 @@ +--- + +- name: SAP Install Media Detect - Prepare - Initialize fact variables, phase 1b + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result_phase_1b: [] + +# If any files have been moved to non-extract subdirectories already, move them back to the top level, making the role idempotent +# Reason for noqa: When using pipefail and there is no result from the grep -v, this tail will fail but it should never fail +- name: SAP Install Media Detect - Prepare - Find existing non-extract subdirectories # noqa risky-shell-pipe + ansible.builtin.shell: ls -d {{ __sap_install_media_detect_software_main_directory }}/*/ | grep -v '_extracted' + register: __sap_install_media_detect_register_subdirectories_phase_1b + changed_when: false + failed_when: false + +- name: SAP Install Media Detect - Prepare - Create list of all files one level below '{{ __sap_install_media_detect_software_main_directory }}' + ansible.builtin.find: + paths: "{{ line_item }}" + patterns: '*' + recurse: false + use_regex: false + loop: + - "{{ __sap_install_media_detect_register_subdirectories_phase_1b.stdout_lines }}" + loop_control: + loop_var: line_item + register: __sap_install_media_detect_register_find_result_phase_1b + +- name: SAP Install Media Detect - Prepare - Set fact from find result, phase 1b + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result_phase_1b: "{{ __sap_install_media_detect_fact_find_result_phase_1b + [item.1.path] }}" + with_subelements: + - "{{ __sap_install_media_detect_register_find_result_phase_1b.results }}" + - files + +# Reason for noqa: Too much additional code required for determing if anything has changed or not +- name: SAP Install Media Detect - Prepare - Move files back to '{{ __sap_install_media_detect_software_main_directory }}' # noqa no-changed-when + ansible.builtin.command: "mv {{ line_item }} {{ __sap_install_media_detect_software_main_directory }}/" + loop: "{{ __sap_install_media_detect_fact_find_result_phase_1b }}" + loop_control: + loop_var: line_item + +- name: SAP Install Media Detect - Prepare - Remove the subdirectories + ansible.builtin.file: + path: "{{ line_item }}" + state: absent + loop: "{{ __sap_install_media_detect_register_subdirectories_phase_1b.stdout_lines }}" + loop_control: + loop_var: line_item From e85c390d0c9ddae472c567e1a9961420cfa11f82 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 26 Sep 2023 09:41:38 +0200 Subject: [PATCH 153/179] sap_ha_pacemaker_cluster: updated hana sample and added nw sample playbook --- ...-sap-ha-deployment-hana-2-node-cluster.yml | 5 +- ...ample-sap-nwas-ascs-ers-2-node-cluster.yml | 77 +++++++++++++++++++ 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml diff --git a/playbooks/sample-sap-ha-deployment-hana-2-node-cluster.yml b/playbooks/sample-sap-ha-deployment-hana-2-node-cluster.yml index db15fcb50..46d6166a6 100644 --- a/playbooks/sample-sap-ha-deployment-hana-2-node-cluster.yml +++ b/playbooks/sample-sap-ha-deployment-hana-2-node-cluster.yml @@ -48,10 +48,9 @@ node_role: secondary hana_site: DC02 - sap_hana_vip: - primary: 192.168.1.100 + sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: 192.168.1.100 - ha_cluster_fence_agent_packages: + sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-rhevm sap_ha_pacemaker_cluster_stonith_custom: diff --git a/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml new file mode 100644 index 000000000..7363a3350 --- /dev/null +++ b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml @@ -0,0 +1,77 @@ +--- +# This playbook will +# - install and configure a basic pacemaker cluster +# - configure the SAP NetWeaver ASCS/ERS resource groups with each +# - an instance filesystem +# - the instance resource +# - an instance service VIP + +# To use this playbook in your test environment +# please update the "vars" parameters with values +# corresponding to your individual naming standards +# and infrastructure (e.g. IP definitions matching your network). +# +# NOTE: +# For simplicity the sample password values are plain text. Please make sure to +# apply security measures to any credentials, for instance using ansible-vault +# encryption. + +- name: "Install and Configure a Pacemaker Cluster on 2 NetWeaver ASCS/ERS nodes" + hosts: ascs-node, ers-node + become: true +# any_error_fatal: true + + vars: + ############################################################################ + ### MANDATORY parameter definitions for a NetWeaver ASCS/ERS cluster setup. + ############################################################################ + + ### General minimum pacemaker cluster definitions. + sap_ha_pacemaker_cluster_cluster_name: ascs-ers-cluster + sap_ha_pacemaker_cluster_hacluster_password: my-hacluster-vault-password + + ### NetWeaver specific definitions + sap_ha_pacemaker_cluster_storage_nfs_server: "nfs-server1.example.com:/" + + # Underlying filesystems are derived from the parent "/usr/sap" definition. + sap_ha_pacemaker_cluster_storage_definition: + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap + nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}" + + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans + nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}" + + - name: sapmnt + mountpoint: /sapmnt + nfs_path: /sapmnt + nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}" + + # SID and Instance Numbers for ASCS and ERS. + sap_ha_pacemaker_cluster_netweaver_sid: ABC + sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "02" + sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "12" + + # Profile name created by the installer, for example: _ASCS_ + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: ABC_ASCS02_ascs-node-ha + sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ASCS02_ascs-node-ha + + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: ABC_ERS12_ers-node-ha + sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ERS12_ers-node-ha + + # Required to go through the configuration flow for a NetWeaver ASCS/ERS cluster. + sap_ha_pacemaker_cluster_host_type: + - nwas_abap_ascs_ers + + # Virtual IP addresses, one per instance. + # These IPs will switch between the nodes together with the instance. + sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: 192.168.10.102 + sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: 192.168.10.112 + + + roles: + + - name: sap_ha_pacemaker_cluster From 80a4bf87faf8871e53ff7679389ef81793c6930f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 26 Sep 2023 11:31:19 +0200 Subject: [PATCH 154/179] sap_ha_pacemaker_cluster: fix: avoid optional parameter reference in defaults --- playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml | 5 +++++ roles/sap_ha_pacemaker_cluster/defaults/main.yml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml index 7363a3350..4d97ea022 100644 --- a/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml +++ b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml @@ -27,6 +27,11 @@ ############################################################################ ### General minimum pacemaker cluster definitions. + + # Cluster name is optional, the default of the 'ha_cluster' Linux System Role + # would be applied when missing. + # However, for convenience it is defined along with the rest of the mandatory + # parameters in this example. sap_ha_pacemaker_cluster_cluster_name: ascs-ers-cluster sap_ha_pacemaker_cluster_hacluster_password: my-hacluster-vault-password diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 760b03bd9..5d84e32c3 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -21,7 +21,7 @@ sap_ha_pacemaker_cluster_system_roles_collection: 'fedora.linux_system_roles' # config file. # Useful for parameter review or re-use with the 'ha_cluster' LSR. sap_ha_pacemaker_cluster_create_config_varfile: false -sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" +sap_ha_pacemaker_cluster_create_config_dest: "review_resource_config.yml" # Inherit SAP common (global synonyms) parameters when defined. From 4a69fe88e9549ac131c2eb44c5c99ebb9c11a9a4 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 26 Sep 2023 11:53:41 +0200 Subject: [PATCH 155/179] sap_ha_pacemaker_cluster: improve search logic --- .../tasks/ascertain_sap_landscape.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index aa4afc90b..a01cf87e0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -10,12 +10,12 @@ # 2 nodes are also valid for other scenarios. # TODO: collect possible rules for target landscapes -- name: SAP HA Prepare Pacemaker - Fail if there is only 1 target host +- name: "SAP HA Prepare Pacemaker - Fail if there is only 1 target host" ansible.builtin.assert: that: - ansible_play_hosts | length > 1 -- name: SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list +- name: "SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list" ansible.builtin.set_fact: sap_ha_pacemaker_cluster_host_type: | {% if sap_ha_pacemaker_cluster_host_type | type_debug != 'list' -%} @@ -24,21 +24,21 @@ {{ sap_ha_pacemaker_cluster_host_type }} {%- endif %} -- name: SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used +- name: "SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used" ansible.builtin.assert: that: - ansible_play_hosts | length == 2 when: - - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana_scaleup') | length > 0 -- name: SAP HA Prepare Pacemaker - Include HANA specific variables +- name: "SAP HA Prepare Pacemaker - Include HANA specific variables" ansible.builtin.include_tasks: file: include_vars_hana.yml when: - - "'hana' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana_scaleup') | length > 0 -- name: SAP HA Prepare Pacemaker - Include NETWEAVER specific variables +- name: "SAP HA Prepare Pacemaker - Include NETWEAVER specific variables" ansible.builtin.include_tasks: file: include_vars_netweaver.yml when: - - "'nwas' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 From 8162ef6d33cbbd9adcc4e204946aa55b90218c36 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 26 Sep 2023 12:51:33 +0200 Subject: [PATCH 156/179] sap_ha_pacemaker_cluster: fix: removed storage definition options and refer to storage role instead --- .../meta/argument_specs.yml | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 19e2a063a..f2756a8a6 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -389,38 +389,9 @@ argument_specs: description: - List of filesystem definitions used for filesystem cluster resources. - Uses `sap_storage_setup_definition` when defined. + - For all options, see documentation of role `sap_storage_setup`. + - Options relevant for the HA setup, see below example. elements: dict - options: - name: - description: - - Unique name of the filesystem definition entry. - required: true - - mountpoint: - description: - - Path under which the filesystem will be mounted. - - Mandatory for all filesystems that have a mountpoint. - - Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap//" and "/usr/sap//SYS". - required: false # for compatibility with definitions that contain swap filesystems as well (sap_storage_setup role input) - - nfs_filesystem_type: - default: - description: - - NFS filesystem type used to mount this filesystem. - - nfs_mount_options: - default: - description: - - Mount options to be used for this specific filesystem. - - nfs_path: - description: - - Path to the filesystem source directory on the NFS server. - - nfs_server: - default: - description: - - Name of the NFS server for this particular filesystem. example: sap_ha_pacemaker_cluster_storage_definition: From 0955ea65b9fe3a877d0f02830207198057104ea5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 26 Sep 2023 15:45:56 +0200 Subject: [PATCH 157/179] sap_install_media_detect: Adapt README.md --- roles/sap_install_media_detect/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index 48cedcb89..dc2a7c068 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -29,7 +29,7 @@ will be disabled as the last task. - A new list of all files with the correct final file names will then be created, and for each of the files, the SAP file types are determined using the `sapfile` tool, either using the file names or - if this information is not sufficient - from information inside the file. - We then assert that there is at least (or exactly, depending on the file type) one file available for each of the `sap_install_media_detect_*` parameters. For example, if `sap_install_media_detect_kernel_db` is set to `saphana`, then there must be one SAP Kernel DB dependent file for SAP HANA. - In case of `remote_dir`, the next step is to copy all files from `sap_install_media_detect_source_directory` to `sap_install_media_detect_target_directory`. -- Then we extract files which are configured in `sapfile` to be extracted, and copy or move files which are configured in `sapfile` to be copied or moved. Certain files like SAPCAR*.EXE and SAP Host Agent will be copied to two different directories. +- Then we extract files which are configured in `sapfile` to be extracted, and copy or move files which are configured in `sapfile` to be copied or moved. Certain files like `SAPCAR*.EXE` and `SAP Host Agent` will be copied to two different directories. - Once all necessary files have been extracted and all files are copied or moved to where we want them to be, we are using the Ansible find module to identify the different file types by using file or directory name patterns. - The last step is to fill all required `sap_swpm` parameters from the result of the previous find step, and display all the variables. @@ -53,9 +53,13 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_install_media_detect_create_file_list_phase_1`: Create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. - tag `sap_install_media_detect_create_file_list_phase_2`: Create a final list of all required files in `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) - tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files into the target directories if specified by the output of the sapfile command. +- tag `sap_install_media_detect_move_files_to_main_directory`: Move SAP archive files from level 1 subdirectories (where they might reside after the role has been used initially) back to the main software directory. Those subdirectories will afterwards be removed. This is to make sure the run will produce the same result no matter how often it is executed (= idempotency). The directories with pattern `*_extracted` will remain in place. - tag `sap_install_media_detect_find_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. - tag `sap_install_media_detect_set_global_vars`: Set all final variables for later use by Ansible roles or tasks. +Note: After running the role with the following four tags, the SAP archive files will be in the same place as before running the role the first time. The directories with pattern `*_extracted` will remain in place. +`sap_install_media_detect_provide_sapfile_utility,sap_install_media_detect_check_directories,sap_install_media_detect_create_file_list_phase_1,sap_install_media_detect_move_files_to_main_directory` + ## License Apache license 2.0 From 0e5eb625984d0cee56561c2362677b92feca5caa Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 26 Sep 2023 15:52:23 +0200 Subject: [PATCH 158/179] sap_install_media_detect: Fix typos in README.md --- roles/sap_install_media_detect/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index dc2a7c068..d936b39bd 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -29,7 +29,7 @@ will be disabled as the last task. - A new list of all files with the correct final file names will then be created, and for each of the files, the SAP file types are determined using the `sapfile` tool, either using the file names or - if this information is not sufficient - from information inside the file. - We then assert that there is at least (or exactly, depending on the file type) one file available for each of the `sap_install_media_detect_*` parameters. For example, if `sap_install_media_detect_kernel_db` is set to `saphana`, then there must be one SAP Kernel DB dependent file for SAP HANA. - In case of `remote_dir`, the next step is to copy all files from `sap_install_media_detect_source_directory` to `sap_install_media_detect_target_directory`. -- Then we extract files which are configured in `sapfile` to be extracted, and copy or move files which are configured in `sapfile` to be copied or moved. Certain files like `SAPCAR*.EXE` and `SAP Host Agent` will be copied to two different directories. +- Then we extract files which are configured in `sapfile` to be extracted, and copy or move files which are configured in `sapfile` to be copied or moved. Certain files like `SAPCAR*.EXE` and the SAP Host Agent will be copied to two different directories. - Once all necessary files have been extracted and all files are copied or moved to where we want them to be, we are using the Ansible find module to identify the different file types by using file or directory name patterns. - The last step is to fill all required `sap_swpm` parameters from the result of the previous find step, and display all the variables. @@ -53,7 +53,7 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_install_media_detect_create_file_list_phase_1`: Create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. - tag `sap_install_media_detect_create_file_list_phase_2`: Create a final list of all required files in `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) - tag `sap_install_media_detect_organize_files`: Copies all required files from `sap_install_media_detect_source_directory` or `sap_install_media_detect_target_directory` (if that one is defined) and extracts all required files into the target directories if specified by the output of the sapfile command. -- tag `sap_install_media_detect_move_files_to_main_directory`: Move SAP archive files from level 1 subdirectories (where they might reside after the role has been used initially) back to the main software directory. Those subdirectories will afterwards be removed. This is to make sure the run will produce the same result no matter how often it is executed (= idempotency). The directories with pattern `*_extracted` will remain in place. +- tag `sap_install_media_detect_move_files_to_main_directory`: Move SAP archive files from level 1 subdirectories (where they might reside after the role has been used initially) back to the main software directory. Those subdirectories will afterwards be removed. This is to make sure the role will produce the same result no matter how often it is executed (= idempotency). The directories with pattern `*_extracted` will remain in place. - tag `sap_install_media_detect_find_files_after_extraction`: Finds all required files after they have been extracted so the final variables can be filled in the next step. - tag `sap_install_media_detect_set_global_vars`: Set all final variables for later use by Ansible roles or tasks. From 39e582310722aa0de89a3ae18f99e5829f422477 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Tue, 26 Sep 2023 16:28:33 +0100 Subject: [PATCH 159/179] sap_install_media_detect: unar for sles --- .../tasks/prepare/enable_rar_handling.yml | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index cf2810ef6..774154ac7 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -1,7 +1,9 @@ --- - name: SAP Install Media Detect - Prepare - Install the unar package from EPEL - when: sap_install_media_detect_rar_package == 'EPEL' + when: + - sap_install_media_detect_rar_package == 'EPEL' + - ansible_os_family == 'RedHat' block: # Reason for noqa: Too much effort for now to examine the output of the yum module for the presence of a package @@ -52,11 +54,30 @@ __sap_install_media_detect_rar_extract: '/usr/bin/unar' __sap_install_media_detect_rar_extract_directory_argument: ' -o' -- name: SAP Install Media Detect - Prepare - Install an unrar package - when: sap_install_media_detect_rar_package != 'EPEL' + +- name: SAP Install Media Detect - Prepare - Install the unar package (SLES) + when: + - ansible_os_family == 'Suse' + block: + + # Requires SLES Basesystem_Module_* to obtain package + - name: SAP Install Media Detect - Prepare - SLES - Install the unar package + ansible.builtin.package: + name: unar + state: present + + - name: SAP Install Media Detect - Prepare - SLES - Set facts + ansible.builtin.set_fact: + __sap_install_media_detect_rar_list: '/usr/bin/lsar' + __sap_install_media_detect_rar_extract: '/usr/bin/unar' + __sap_install_media_detect_rar_extract_directory_argument: ' -o' + + +- name: SAP Install Media Detect - Prepare - Install a rar extractor package (no EPEL) + when: sap_install_media_detect_rar_package != 'EPEL' # When default is overriden block: - - name: SAP Install Media Detect - Prepare - unrar - Set facts + - name: SAP Install Media Detect - Prepare - rar extractor - Set facts ansible.builtin.set_fact: __sap_install_media_detect_rar_list: "{{ sap_install_media_detect_rar_list }}" __sap_install_media_detect_rar_extract: "{{ sap_install_media_detect_rar_extract }}" From c7ad443f1b8ed978ae57249eff7480629bccc638 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Tue, 26 Sep 2023 17:54:51 +0100 Subject: [PATCH 160/179] sap_install_media_detect: skip epel cleanup for sles --- roles/sap_install_media_detect/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 932a540ec..baabc5bb5 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -87,6 +87,7 @@ tags: sap_install_media_detect_rar_handling when: - sap_install_media_detect_rar_package == 'EPEL' + - ansible_os_family == 'RedHat' - __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' - name: SAP Install Media Detect - Cleanup - Remove sapfile utility From 000f7e366271bd0b6228172486c2e4de783168dd Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 27 Sep 2023 11:19:02 +0200 Subject: [PATCH 161/179] sap_ha_pacemaker_cluster: improved arg specs explanation for storage definition --- roles/sap_ha_pacemaker_cluster/README.md | 23 +++++-------------- .../meta/argument_specs.yml | 9 +++++--- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index e34db31e5..f26e5a3e7 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -692,23 +692,12 @@ sap_ha_pacemaker_cluster_stonith_custom: - _Type:_ `list` List of filesystem definitions used for filesystem cluster resources.
-Uses `sap_storage_setup_definition` when defined.
- -- **mountpoint**
- Path under which the filesystem will be mounted.
Mandatory for all filesystems that have a mountpoint.
Special treatment for a generic "/usr/sap" which will automatically be duplicated into the 2 standard sub-directories "/usr/sap//" and "/usr/sap//SYS". -- **name**
- Unique name of the filesystem definition entry. -- **nfs_filesystem_type**
- _Default:_ ``
- NFS filesystem type used to mount this filesystem. -- **nfs_mount_options**
- _Default:_ ``
- Mount options to be used for this specific filesystem. -- **nfs_path**
- Path to the filesystem source directory on the NFS server. -- **nfs_server**
- _Default:_ ``
- Name of the NFS server for this particular filesystem. +Options relevant, see example.
+Mandatory for SAP NetWeaver HA cluster configurations.
+Reuse `sap_storage_setup_definition` if defined.
+Reuse `sap_storage_setup_definition` will extract values 'mountpoint', 'nfs_filesystem_type', 'nfs_mount_options', 'nfs_path', 'nfs_server'.
+Reuse `sap_storage_setup_definition` all options are documented under Ansible Role `sap_storage_setup`.
+Note! For this variable, the argument specification does not list options, to avoid errors during reuse of `sap_storage_setup_definition` if defined.
Example: diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index f2756a8a6..84ff1487b 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -388,9 +388,12 @@ argument_specs: type: list description: - List of filesystem definitions used for filesystem cluster resources. - - Uses `sap_storage_setup_definition` when defined. - - For all options, see documentation of role `sap_storage_setup`. - - Options relevant for the HA setup, see below example. + - Options relevant, see example. + - Mandatory for SAP NetWeaver HA cluster configurations. + - Reuse `sap_storage_setup_definition` if defined. + - Reuse `sap_storage_setup_definition` will extract values 'mountpoint', 'nfs_filesystem_type', 'nfs_mount_options', 'nfs_path', 'nfs_server'. + - Reuse `sap_storage_setup_definition` all options are documented under Ansible Role `sap_storage_setup`. + - Note! For this variable, the argument specification does not list options, to avoid errors during reuse of `sap_storage_setup_definition` if defined. elements: dict example: From a0e921d10ba47ae4b336f751ee522ab12681a312 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 27 Sep 2023 14:48:18 +0200 Subject: [PATCH 162/179] sap_ha_pacemaker_cluster: default adjusted to actual default --- roles/sap_ha_pacemaker_cluster/README.md | 2 +- roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index f26e5a3e7..825374cfe 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -222,7 +222,7 @@ sap_ha_pacemaker_cluster_cluster_properties: ### sap_ha_pacemaker_cluster_create_config_dest - _Type:_ `string` -- _Default:_ `_resource_config.yml` +- _Default:_ `review_resource_config.yml` The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory.
Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file.
diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 84ff1487b..4449754e4 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -38,7 +38,7 @@ argument_specs: - For RHEL System Roles for SAP, or Red Hat Automation Hub, use 'redhat.rhel_system_roles'. sap_ha_pacemaker_cluster_create_config_dest: - default: _resource_config.yml + default: review_resource_config.yml description: - The pacemaker cluster resource configuration optionally created by this role will be saved in a Yaml file in the current working directory. - Requires `sap_ha_pacemaker_cluster_create_config_varfile` to be enabled for generating the output file. From 5eee6209993f2bd26ff239a87065014e0f67720d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 27 Sep 2023 16:04:43 +0200 Subject: [PATCH 163/179] sap_install_media_detect: Detect MP XML files and move them into 'sap_swpm_download_basket' --- roles/sap_install_media_detect/files/tmp/sapfile | 16 +++++++++++++--- .../tasks/organize_files.yml | 3 ++- .../tasks/prepare/create_file_list_phase_2.yml | 4 +++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/files/tmp/sapfile b/roles/sap_install_media_detect/files/tmp/sapfile index 860e1bf8f..6a37c1f7d 100755 --- a/roles/sap_install_media_detect/files/tmp/sapfile +++ b/roles/sap_install_media_detect/files/tmp/sapfile @@ -197,6 +197,7 @@ for _FILE in "$@"; do /RAR archive data/{_file_type="rar"} /Zip archive data/{_file_type="zip"} /SAPCAR archive data/{_file_type="sapcar"} + /XML/&&/ASCII/{_file_type="xml"} /directory/{_file_type="dir"} END{print _file_type}') if [[ ${_GENERIC_FILE_TYPE}. == "rarexe." ]]; then @@ -207,6 +208,8 @@ for _FILE in "$@"; do _list_content="zipinfo -1" elif [[ ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then _list_content="${_SAPCAR_FILE} -tvf" + elif [[ ${_GENERIC_FILE_TYPE}. == "xml." ]]; then + _list_content="cat" elif [[ ${_GENERIC_FILE_TYPE}. == "dir." ]]; then _list_content="" fi @@ -240,7 +243,7 @@ for _FILE in "$@"; do /S4/&&/LANG/{_sap_file_type="sap_s4hana_lang"} /S4/&&/EXPORT/{_sap_file_type="sap_export_s4hana"} /BW4/&&/EXPORT/{_sap_file_type="sap_export_bw4hana"} - /VCH/&&/\.SAR/{_sap_file_type="sap_vch_afl"} + /VCH/&&/\.SAR/{_sap_file_type="saphana_vch_afl"} END{print _sap_file_type}') if [[ ${SAP_FILE_TYPE_FROM_FILENAME}. == "sap_kernel_db." ]]; then SAP_FILE_TYPE_FROM_FILENAME=$(eval "${_list_content}" "${_FILE}" | awk ' @@ -256,7 +259,8 @@ for _FILE in "$@"; do elif [[ ${_GENERIC_FILE_TYPE}. == "rarexe." || ${_GENERIC_FILE_TYPE}. == "rar." || ${_GENERIC_FILE_TYPE}. == "zip." || - ${_GENERIC_FILE_TYPE}. == "sapcar." ]]; then + ${_GENERIC_FILE_TYPE}. == "sapcar." || + ${_GENERIC_FILE_TYPE}. == "xml." ]]; then _SAP_FILE_TYPE=$(eval "${_list_content}" "${_FILE}" | awk ' BEGIN{_sap_file_type="sap_unknown"} /BD_SYBASE_ASE/{_sap_file_type="sapase"} @@ -273,6 +277,7 @@ for _FILE in "$@"; do /DATA_UNITS\/EXP[0-9]/{_sap_file_type="sap_export_nwas_abap"} /DATA_UNITS\/JAVA_EXPORT_JDMP/{_sap_file_type="sap_export_nwas_java"} /DATA_UNITS\/SOLMAN/&&/_JAVA_UT/{_sap_file_type="sap_export_solman_java"} + / Date: Wed, 27 Sep 2023 16:36:01 +0200 Subject: [PATCH 164/179] sap_install_media_detect: Also identify the MP XML files and set the related variables --- roles/sap_install_media_detect/defaults/main.yml | 1 + .../tasks/find_files_after_extraction.yml | 8 ++++++++ roles/sap_install_media_detect/tasks/set_global_vars.yml | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 961ffd693..a1a1fe264 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -74,6 +74,7 @@ sap_install_media_detect_kernel: false sap_install_media_detect_kernel_db: '' # saphana, sapase, sapmaxdb, oracledb, ibmdb2 # (only necessary if there is more than one SAPEXEDB file in the source directory) sap_install_media_detect_webdisp: false +sap_install_media_detect_mpstack: false sap_install_media_detect_export: '' # saps4hana, sapbw4hana, sapecc, sapecc_ides, # sapnwas_abap, sapnwas_java, sapsolman_abap, sapsolman_java diff --git a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml index 523c575c1..fcf0ccbd7 100644 --- a/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml +++ b/roles/sap_install_media_detect/tasks/find_files_after_extraction.yml @@ -269,6 +269,14 @@ - sap_install_media_detect_webdisp - sap_swpm_web_dispatcher_file_name_get.stdout_lines | count > 1 +- name: SAP Install Media Detect - Find files after extraction - Find Maintenance Planner Stack XML file + ansible.builtin.shell: set -o pipefail && ls -1tr *.xml | tail -1 + args: + chdir: "{{ sap_swpm_software_path }}" + register: sap_swpm_mp_xml_file_name_get + changed_when: false + when: sap_install_media_detect_mpstack + - name: SAP Install Media Detect - Find files after extraction - Find SAP ECC Export ansible.builtin.find: paths: "{{ __sap_install_media_detect_software_main_directory }}/sap_export_ecc_extracted" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 32e07d394..659090141 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -148,6 +148,13 @@ sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" when: sap_install_media_detect_igs +- name: SAP Install Media Detect - Detection completed - Set facts for SAP Maintenance Planner Stack XML files + ansible.builtin.set_fact: + sap_swpm_mp_stack_path: "{{ sap_swpm_software_path }}/" + sap_swpm_mp_stack_file_name: "{{ sap_swpm_mp_xml_file_name_get.stdout }}" + ignore_errors: true + when: sap_install_media_detect_mpstack + - name: SAP Install Media Detect - Detection completed - Set facts for WebDisp ansible.builtin.set_fact: sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}/" @@ -241,6 +248,8 @@ - sap_swpm_kernel_independent_file_name - sap_swpm_web_dispatcher_path - sap_swpm_web_dispatcher_file_name + - sap_swpm_mp_stack_path + - sap_swpm_mp_stack_file_name - name: SAP Install Media Detect - Detection completed - Display result ansible.builtin.debug: From b9f934f4acf4038254f95f8a9c30a0cc251e8716 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Wed, 27 Sep 2023 18:50:17 +0100 Subject: [PATCH 165/179] sap_hana_install: selinux logic for sles --- roles/sap_hana_install/tasks/pre_install.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/sap_hana_install/tasks/pre_install.yml b/roles/sap_hana_install/tasks/pre_install.yml index 56e1339dc..3e20526c0 100644 --- a/roles/sap_hana_install/tasks/pre_install.yml +++ b/roles/sap_hana_install/tasks/pre_install.yml @@ -83,6 +83,13 @@ - '/hana/data' tags: sap_hana_install_chown_hana_directories + # SELinux is not currently supported by SAP using SLES4SAP + # This is a workaround to avoid change to default to enable SELinux + - name: SAP HANA Pre Install - Ensure SELinux does not execute for SLES + ansible.builtin.set_fact: + sap_hana_install_modify_selinux_labels: false + when: ansible_os_family == "Suse" + - name: SAP HANA Pre Install - Configure '/hana' SELinux file contexts ansible.builtin.include_role: name: '{{ sap_hana_install_system_roles_collection }}.selinux' From b5e61086160bb2b04ca41754d88baaf5492d050d Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Wed, 27 Sep 2023 20:57:20 +0100 Subject: [PATCH 166/179] sap_swpm: mp stack xml path handling --- roles/sap_swpm/tasks/pre_install.yml | 4 ++-- .../install_type/ha_maint_plan_stack_install.yml | 14 +++++++------- .../install_type/maint_plan_stack_install.yml | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 38c0e6478..598348af2 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -20,7 +20,7 @@ sap_swpm_swpm_command_product_id: "SAPINST_EXECUTE_PRODUCT_ID={{ sap_swpm_product_catalog_id }}" # If SWPM is running a normal install Ansible Variable sap_swpm_swpm_command_virtual_hostname is blank # IF SWPM is running a HA installation, Ansible Variable sap_swpm_swpm_command_virtual_hostname is set and contains "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true" - # If SWPM is running a MP Stack XML installation, Ansible Variable sap_swpm_swpm_command_mp_stack is set and contains "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + # If SWPM is running a MP Stack XML installation, Ansible Variable sap_swpm_swpm_command_mp_stack is set and contains "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }} + '/' (if needed) + {{ sap_swpm_mp_stack_file_name }}" sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true SAPINST_START_GUISERVER=false {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}" tags: sap_swpm_sapinst_commandline @@ -62,7 +62,7 @@ - " WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} " - " SAPCAR - {{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }} " - " SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} " - - " MP Stack - {{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }} " + - " MP Stack - {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" - " Backup - {{ sap_swpm_backup_location }} " - name: SAP SWPM - Installation Process diff --git a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml index c725e3bf8..5de0723db 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml @@ -18,7 +18,7 @@ # Install using SAP Maintenance Planner Stack XML # Check for MP Stack XML if filename not given -- name: SAP SWPM Pre Install - MP Stack XML - Get from {{ sap_swpm_mp_stack_path }} +- name: SAP SWPM Pre Install - MP Stack XML - Search for MP_*.xml file in {{ sap_swpm_mp_stack_path }} ansible.builtin.shell: | ls MP*.xml args: @@ -31,7 +31,7 @@ (sap_swpm_mp_stack_file_name is none) or (sap_swpm_mp_stack_file_name | length == 0) -- name: SAP SWPM Pre Install - MP Stack XML - Set fact +- name: SAP SWPM Pre Install - MP Stack XML - Set fact for filename ansible.builtin.set_fact: sap_swpm_mp_stack_file_name: "{{ sap_swpm_mp_stack_file_get.stdout }}" # Test if variable string is not defined or None / blank @@ -41,22 +41,22 @@ (sap_swpm_mp_stack_file_name is none) or (sap_swpm_mp_stack_file_name | length == 0) -- name: SAP SWPM Pre Install - MP Stack XML - Set fact +- name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + path: "{{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' diff --git a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml index ee5dd79f3..3ef0701a8 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml @@ -3,7 +3,7 @@ # Install using SAP Maintenance Planner Stack XML # Check for MP Stack XML if filename not given -- name: SAP SWPM Pre Install - MP Stack XML - Get from {{ sap_swpm_mp_stack_path }} +- name: SAP SWPM Pre Install - MP Stack XML - Search for MP_*.xml file in {{ sap_swpm_mp_stack_path }} ansible.builtin.shell: | ls MP*.xml args: @@ -16,7 +16,7 @@ (sap_swpm_mp_stack_file_name is none) or (sap_swpm_mp_stack_file_name | length == 0) -- name: SAP SWPM Pre Install - MP Stack XML - Set fact +- name: SAP SWPM Pre Install - MP Stack XML - Set fact for filename ansible.builtin.set_fact: sap_swpm_mp_stack_file_name: "{{ sap_swpm_mp_stack_file_get.stdout }}" # Test if variable string is not defined or None / blank @@ -26,22 +26,22 @@ (sap_swpm_mp_stack_file_name is none) or (sap_swpm_mp_stack_file_name | length == 0) -- name: SAP SWPM Pre Install - MP Stack XML - Set fact +- name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + path: "{{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' From 12c4683fe97347ae0d283c9f8a5e324057f18263 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 28 Sep 2023 11:10:48 +0200 Subject: [PATCH 167/179] Fix issue #479 --- .../tasks/RedHat/generic/configure-selinux.yml | 2 +- .../tasks/RedHat/generic/configure-selinux.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml index dfa7208e4..3415cf2ac 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -36,7 +36,7 @@ __sap_general_preconfigure_register_selinux_config_type_changed.changed or __sap_general_preconfigure_fact_selinux_mode != sap_general_preconfigure_selinux_state -- name: Call Reboot handler if necessary +- name: SELinux - Call Reboot handler if necessary ansible.builtin.command: /bin/true notify: __sap_general_preconfigure_reboot_handler when: __sap_general_preconfigure_fact_selinux_mode != sap_general_preconfigure_selinux_state diff --git a/roles/sap_hana_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_hana_preconfigure/tasks/RedHat/generic/configure-selinux.yml index 1c59a7e4e..fa2905ba2 100644 --- a/roles/sap_hana_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_hana_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -1,6 +1,6 @@ --- -- name: SAP HANA Pre Install - Configure SELinux file contexts +- name: SELinux - Configure SELinux file contexts ansible.builtin.include_role: name: '{{ sap_hana_preconfigure_system_roles_collection }}.selinux' vars: From bad897480ebc53360647b80f2e8c50cf0ee2ba6b Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 28 Sep 2023 11:13:19 +0200 Subject: [PATCH 168/179] Fix jinja[spacing] for ternary --- .../tasks/RedHat/generic/configure-selinux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml index 3415cf2ac..19a406c90 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-selinux.yml @@ -22,7 +22,7 @@ # the value of the 'mode' member ('permissive' or 'enforcing') - name: SELinux - Set an SELinux mode variable ansible.builtin.set_fact: - __sap_general_preconfigure_fact_selinux_mode: "{{ (ansible_selinux.status == 'disabled') | ternary (ansible_selinux.status, ansible_selinux.mode) }}" + __sap_general_preconfigure_fact_selinux_mode: "{{ (ansible_selinux.status == 'disabled') | ternary(ansible_selinux.status, ansible_selinux.mode) }}" - name: SELinux - Display the current SELinux mode or status ansible.builtin.debug: From 856d0004d2eefdf746f4981319e068de3ffc69f5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 28 Sep 2023 14:22:48 +0200 Subject: [PATCH 169/179] sap_ha_pacemaker_cluster: variable and file name adjustments --- ...ample-sap-nwas-ascs-ers-2-node-cluster.yml | 20 ++-- roles/sap_ha_pacemaker_cluster/README.md | 103 ++++++++---------- .../defaults/main.yml | 101 ++++++++--------- .../meta/argument_specs.yml | 84 +++++++------- .../tasks/ascertain_sap_landscape.yml | 2 +- ...figure_nwas_ascs_ers_postinstallation.yml} | 68 ++++++------ .../tasks/construct_final_hacluster_vars.yml | 6 +- .../tasks/construct_vars_common.yml | 8 +- ... => construct_vars_nwas_abap_ascs_ers.yml} | 96 ++++++++-------- ...l => construct_vars_nwas_abap_pas_aas.yml} | 52 ++++----- ...mon.yml => construct_vars_nwas_common.yml} | 26 ++--- ...l => construct_vars_nwas_java_scs_ers.yml} | 64 +++++------ .../import_hacluster_vars_from_inventory.yml | 2 +- .../tasks/include_construct_vip_resources.yml | 8 +- ...rs_netweaver.yml => include_vars_nwas.yml} | 0 roles/sap_ha_pacemaker_cluster/tasks/main.yml | 10 +- ...ct_vars_vip_resources_cloud_msazure_vm.yml | 2 +- .../tasks/validate_input_parameters.yml | 38 +++---- roles/sap_ha_pacemaker_cluster/vars/main.yml | 2 +- .../vars/nwas_abap_ascs_ers.yml | 17 ++- .../sap_ha_pacemaker_cluster/vars/redhat.yml | 2 +- roles/sap_ha_pacemaker_cluster/vars/suse.yml | 2 +- 22 files changed, 349 insertions(+), 364 deletions(-) rename roles/sap_ha_pacemaker_cluster/tasks/{configure_netweaver_ascs_ers_postinstallation.yml => configure_nwas_ascs_ers_postinstallation.yml} (70%) rename roles/sap_ha_pacemaker_cluster/tasks/{construct_vars_netweaver_abap_ascs_ers.yml => construct_vars_nwas_abap_ascs_ers.yml} (73%) rename roles/sap_ha_pacemaker_cluster/tasks/{construct_vars_netweaver_abap_pas_aas.yml => construct_vars_nwas_abap_pas_aas.yml} (66%) rename roles/sap_ha_pacemaker_cluster/tasks/{construct_vars_netweaver_common.yml => construct_vars_nwas_common.yml} (83%) rename roles/sap_ha_pacemaker_cluster/tasks/{construct_vars_netweaver_java_scs_ers.yml => construct_vars_nwas_java_scs_ers.yml} (72%) rename roles/sap_ha_pacemaker_cluster/tasks/{include_vars_netweaver.yml => include_vars_nwas.yml} (100%) diff --git a/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml index 4d97ea022..0a2d80c35 100644 --- a/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml +++ b/playbooks/sample-sap-nwas-ascs-ers-2-node-cluster.yml @@ -33,7 +33,7 @@ # However, for convenience it is defined along with the rest of the mandatory # parameters in this example. sap_ha_pacemaker_cluster_cluster_name: ascs-ers-cluster - sap_ha_pacemaker_cluster_hacluster_password: my-hacluster-vault-password + sap_ha_pacemaker_cluster_hacluster_user_password: my-hacluster-vault-password ### NetWeaver specific definitions sap_ha_pacemaker_cluster_storage_nfs_server: "nfs-server1.example.com:/" @@ -56,16 +56,16 @@ nfs_server: "{{ sap_ha_pacemaker_cluster_storage_nfs_server }}" # SID and Instance Numbers for ASCS and ERS. - sap_ha_pacemaker_cluster_netweaver_sid: ABC - sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "02" - sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "12" + sap_ha_pacemaker_cluster_nwas_abap_sid: ABC + sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr: "02" + sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr: "12" # Profile name created by the installer, for example: _ASCS_ - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: ABC_ASCS02_ascs-node-ha - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ASCS02_ascs-node-ha + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name: ABC_ASCS02_ascs-node-ha + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ASCS02_ascs-node-ha - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: ABC_ERS12_ers-node-ha - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ERS12_ers-node-ha + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name: ABC_ERS12_ers-node-ha + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string: /sapmnt/ABC/profile/ABC_ERS12_ers-node-ha # Required to go through the configuration flow for a NetWeaver ASCS/ERS cluster. sap_ha_pacemaker_cluster_host_type: @@ -73,8 +73,8 @@ # Virtual IP addresses, one per instance. # These IPs will switch between the nodes together with the instance. - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: 192.168.10.102 - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: 192.168.10.112 + sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address: 192.168.10.102 + sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address: 192.168.10.112 roles: diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 825374cfe..ca8e6e500 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -133,7 +133,7 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions Minimum required parameters for all clusters: -- [sap_ha_pacemaker_cluster_hacluster_password](#sap_ha_pacemaker_cluster_hacluster_password) +- [sap_ha_pacemaker_cluster_hacluster_user_password](#sap_ha_pacemaker_cluster_hacluster_user_password) Additional minimum requirements depend on the type of cluster setup and on the target platform. @@ -321,7 +321,7 @@ sap_ha_pacemaker_cluster_ha_cluster: node_name: nodeA ``` -### sap_ha_pacemaker_cluster_hacluster_password required +### sap_ha_pacemaker_cluster_hacluster_user_password required - _Type:_ `string` @@ -458,191 +458,184 @@ Mandatory for the cluster setup on MS Azure instances.
Subscription ID of the MS Azure environment containing the target instances.
Mandatory for the cluster setup on MS Azure instances.
-### sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number +### sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr - _Type:_ `string` Instance number of the NetWeaver ABAP AAS instance.
Mandatory for NetWeaver AAS cluster configuration.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems +### sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1 -- _Type:_ `list` -- _Default:_ `['/ASCS', '/ERS']` +- _Type:_ `bool` +- _Default:_ `False` -Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`.
+The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2.
+Set this parameter to 'true' to configure it as ENSA1.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name +### sap_ha_pacemaker_cluster_nwas_abap_ascs_filesystem_resource_name - _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ASCS__` Name of the filesystem resource for the ASCS instance.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness +### sap_ha_pacemaker_cluster_nwas_abap_ascs_group_stickiness - _Type:_ `string` - _Default:_ `3000` NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number +### sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr - _Type:_ `string` Instance number of the NetWeaver ABAP ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_automatic_recover_bool - _Type:_ `bool` - _Default:_ `False` NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER".
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_failure_timeout - _Type:_ `string` - _Default:_ `60` NetWeaver ASCS instance failure-timeout attribute.
-Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1`). Default setup is ENSA2.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_migration_threshold - _Type:_ `string` - _Default:_ `1` NetWeaver ASCS instance migration-threshold setting attribute.
-Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2.
+Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1`). Default setup is ENSA2.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name - _Type:_ `string` The name of the ASCS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name - _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ASCS__` Name of the ASCS instance resource.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_stickiness - _Type:_ `string` - _Default:_ `5000` NetWeaver ASCS instance resource stickiness attribute.
-### sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string +### sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string - _Type:_ `string` The full path and name of the ASCS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name +### sap_ha_pacemaker_cluster_nwas_abap_ers_filesystem_resource_name - _Type:_ `string` - _Default:_ `Filesystem_NWAS_ABAP_ERS__` Name of the filesystem resource for the ERS instance.
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number +### sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr - _Type:_ `string` Instance number of the NetWeaver ABAP ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster configuration.
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool +### sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool - _Type:_ `bool` - _Default:_ `False` NetWeaver ERS instance resource option "AUTOMATIC_RECOVER".
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name +### sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name - _Type:_ `string` The name of the ERS instance, typically the profile name.
Mandatory for the NetWeaver ASCS/ERS cluster setup.
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name +### sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name - _Type:_ `string` - _Default:_ `SAPInstance_NWAS_ABAP_ERS__` Name of the ERS instance resource.
-### sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string +### sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string - _Type:_ `string` The full path and name of the ERS instance profile.
Mandatory for the NetWeaver ASCS/ERS cluster.
-### sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number +### sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr - _Type:_ `string` Instance number of the NetWeaver ABAP PAS instance.
Mandatory for NetWeaver PAS cluster configuration.
-### sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 +### sap_ha_pacemaker_cluster_nwas_abap_sid -- _Type:_ `bool` -- _Default:_ `False` +- _Type:_ `string` -The standard NetWeaver ASCS/ERS cluster will be set up as ENSA2.
-Set this parameter to 'true' to configure it as ENSA1.
+SID of the NetWeaver instances.
+Mandatory for NetWeaver cluster configuration.
+Uses `sap_swpm_sid` if defined.
+Mandatory for NetWeaver cluster setups.
-### sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name +### sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name - _Type:_ `string` - _Default:_ `Filesystem_NWAS_SAPMNT_` Filesystem resource name for the shared filesystem /sapmnt.
Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
-Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`.
-### sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed +### sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed - _Type:_ `bool` - _Default:_ `False` Change this parameter to 'true' if the 3 shared filesystems `/usr/sap/trans`, `/usr/sap//SYS` and '/sapmnt' shall be configured as cloned cluster resources.
-### sap_ha_pacemaker_cluster_netweaver_sid - -- _Type:_ `string` - -SID of the NetWeaver instances.
-Mandatory for NetWeaver cluster configuration.
-Uses `sap_swpm_sid` if defined.
-Mandatory for NetWeaver cluster setups.
- -### sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name +### sap_ha_pacemaker_cluster_nwas_sys_filesystem_resource_name - _Type:_ `string` - _Default:_ `Filesystem_NWAS_SYS_` Filesystem resource name for the transports filesystem /usr/sap//SYS.
Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
-Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`.
-### sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name +### sap_ha_pacemaker_cluster_nwas_transports_filesystem_resource_name - _Type:_ `string` - _Default:_ `Filesystem_NWAS_TRANS_` Filesystem resource name for the transports filesystem /usr/sap/trans.
Optional, this is typically managed by the OS, but can as well be added to the cluster configuration.
-Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`.
+Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`.
### sap_ha_pacemaker_cluster_resource_defaults @@ -776,56 +769,56 @@ Customize the name of the resource managing the Virtual IP of the primary HANA i The virtual IP for read-only access to the secondary HANA instance.
Optional parameter in HANA clusters.
-### sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address +### sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address - _Type:_ `string` Virtual IP of the NetWeaver AAS instance.
Mandatory for NetWeaver AAS cluster setup.
-### sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name +### sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name - _Type:_ `string` - _Default:_ `vip___aas` Name of the SAPInstance resource for NetWeaver AAS.
-### sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address +### sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address - _Type:_ `string` Virtual IP of the NetWeaver ASCS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
-### sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name +### sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name - _Type:_ `string` - _Default:_ `vip___ascs` Name of the SAPInstance resource for NetWeaver ASCS.
-### sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address +### sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address - _Type:_ `string` Virtual IP of the NetWeaver ERS instance.
Mandatory for NetWeaver ASCS/ERS cluster setup.
-### sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name +### sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name - _Type:_ `string` - _Default:_ `vip___ers` Name of the SAPInstance resource for NetWeaver ERS.
-### sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address +### sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address - _Type:_ `string` Virtual IP of the NetWeaver PAS instance.
Mandatory for NetWeaver PAS cluster setup.
-### sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name +### sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name - _Type:_ `string` - _Default:_ `vip___pas` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 5d84e32c3..e5a04aa08 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -105,7 +105,7 @@ sap_ha_pacemaker_cluster_fence_agent_packages: [] # Mandatory. # Either inherit from the 'ha_cluster' LSR variable when defined, but do not set a default. # This fails the argument validation when none of the 2 vars are defined. -sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" +sap_ha_pacemaker_cluster_hacluster_user_password: "{{ ha_cluster_hacluster_password }}" ################################################################################ @@ -147,21 +147,21 @@ sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacema # Default will be ENSA2. To configure HA resources for ENSA1, # set this parameter to 'true'. -sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: false +sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1: false # Enable/Disable sap_cluster_connector. # Ref.: https://access.redhat.com/solutions/3606101 sap_ha_pacemaker_cluster_enable_cluster_connector: true # Inherit common synonym NetWeaver parameters when defined. -sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr | default('') }}" -sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_nwas_abap_sid: "{{ sap_swpm_sid | default('') }}" +sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr: "{{ sap_swpm_ascs_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr: "{{ sap_swpm_ers_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr: "{{ sap_swpm_pas_instance_nr | default('') }}" +sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr: "{{ sap_swpm_aas_instance_nr | default('') }}" # Prepare in case JAVA SCS/ERS will be included later. -#sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr | default('') }}" -#sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr | default('') }}" +#sap_ha_pacemaker_cluster_nwas_java_scs_instance_nr: "{{ sap_swpm_java_scs_instance_nr | default('') }}" +#sap_ha_pacemaker_cluster_nwas_java_ers_instance_nr: "{{ sap_swpm_java_ers_instance_nr | default('') }}" # Definitions for filesystems resources. Currently limited to NFS filesystems. sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_setup_definition | default([]) }}" @@ -174,24 +174,17 @@ sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | defaul # TODO: review later and move to internal vars in vars/main.yml? sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe -# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage -# definition. -# Therefore, the /usr/sap prefix must be left out of the listed path items. -sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" - # Multiple VIP parameters can be defined and will be combined. # See tasks/include_construct_vip_resources.yml -sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: '' -sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_ascs" -sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: '' -sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_ers" -sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: '' -sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}_pas" -sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: '' -sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}_aas" +sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address: '' +sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name: "vip_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}_ascs" +sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address: '' +sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name: "vip_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}_ers" +sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address: '' +sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr }}_pas" +sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address: '' +sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name: "vip_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr }}_aas" # SAP NetWeaver common - Resource IDs (names) as convenience parameters @@ -199,14 +192,14 @@ sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: "vip_{{ sap_ha_pacemak # - /sapmnt # - /usr/sap/trans # - /usr/sap/<>/SYS -sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" -sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" -sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name: "Filesystem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}" +sap_ha_pacemaker_cluster_nwas_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}" +sap_ha_pacemaker_cluster_nwas_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}" # The shared filesystems are not required to be configured in the cluster. # By default it is assumed that they are mounted by the system and available on all cluster nodes. # Set this parameter to "true" to configure the 3 shared filesystems as part of the cluster. -sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false +sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed: false ################################################################################ @@ -214,39 +207,39 @@ sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: false ################################################################################ # Name of the instance profile - mandatory to be user-defined -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: '' +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name: '' # Full path with instance profile name - mandatory to be user-defined -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: '' +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string: '' # SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/ASCS<> # - /usr/sap/<>/ERS<> -sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: false -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: 5000 -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: 1 -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: 60 +sap_ha_pacemaker_cluster_nwas_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}" +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name }}-clone" +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_automatic_recover_bool: false +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_stickiness: 5000 +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_migration_threshold: 1 +sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_failure_timeout: 60 # Stickiness of the ASCS group -sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: 3000 +sap_ha_pacemaker_cluster_nwas_abap_ascs_group_stickiness: 3000 ################################################################################ # ERS resource defaults ################################################################################ # Name of the instance profile - mandatory to be user-defined -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: '' +sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name: '' # Full path with instance profile name - mandatory to be user-defined -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: '' +sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string: '' -sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: false +sap_ha_pacemaker_cluster_nwas_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}" +sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name }}-clone" +sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool: false ################################################################################ @@ -254,10 +247,10 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: ################################################################################ # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/D<> -#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" +#sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr }}" ################################################################################ # JAVA SCS/ERS resource defaults @@ -265,12 +258,12 @@ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: # SAP NetWeaver JAVA SCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/SCS<> # - /usr/sap/<>/ERS<> -#sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name: "Filesytem_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" -#sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name: "Filesytem_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" +#sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_resource_name: "Filesytem_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_java_scs_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_java_scs_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name }}-clone" +#sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_resource_name: "Filesytem_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_java_ers_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ sap_ha_pacemaker_cluster_nwas_java_ers_instance_nr }}" +#sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name }}-clone" ################################################################################ diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 4449754e4..cbc437a9d 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -246,7 +246,7 @@ argument_specs: - Additional fence agent packages to be installed. - This is automatically combined with `sap_ha_pacemaker_cluster_fence_agent_minimal_packages`. - sap_ha_pacemaker_cluster_hacluster_password: + sap_ha_pacemaker_cluster_hacluster_user_password: description: - The password of the `hacluster` user which is created during pacemaker installation. - Inherits the value of `ha_cluster_hacluster_password`, when defined. @@ -343,7 +343,7 @@ argument_specs: # NetWeaver specific parameters ########################################################################## - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1: + sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1: type: bool default: false description: @@ -357,29 +357,29 @@ argument_specs: - Enables/Disables the SAP HA Interface for SAP ABAP application server instances, also known as `sap_cluster_connector`. - Set this parameter to 'false' if the SAP HA interface should not be installed and configured. - sap_ha_pacemaker_cluster_netweaver_sid: + sap_ha_pacemaker_cluster_nwas_abap_sid: description: - SID of the NetWeaver instances. - Mandatory for NetWeaver cluster configuration. - Uses `sap_swpm_sid` if defined. - Mandatory for NetWeaver cluster setups. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: + sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr: description: - Instance number of the NetWeaver ABAP ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: + sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr: description: - Instance number of the NetWeaver ABAP ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster configuration. - sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: + sap_ha_pacemaker_cluster_nwas_abap_pas_instance_nr: description: - Instance number of the NetWeaver ABAP PAS instance. - Mandatory for NetWeaver PAS cluster configuration. - sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: + sap_ha_pacemaker_cluster_nwas_abap_aas_instance_nr: description: - Instance number of the NetWeaver ABAP AAS instance. - Mandatory for NetWeaver AAS cluster configuration. @@ -428,76 +428,68 @@ argument_specs: description: - Default address of the NFS server, if not defined individually by filesystem. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: - type: list - default: - - /ASCS - - /ERS - description: - - Standard NetWeaver paths in "/usr/sap" and automatically appended to the configuration, when "/usr/sap" is in the list of `sap_ha_pacemaker_cluster_storage_definition`. - - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address: + sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address: description: - Virtual IP of the NetWeaver ASCS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: + sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name: default: vip___ascs description: - Name of the SAPInstance resource for NetWeaver ASCS. - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address: + sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address: description: - Virtual IP of the NetWeaver ERS instance. - Mandatory for NetWeaver ASCS/ERS cluster setup. - sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: + sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name: default: vip___ers description: - Name of the SAPInstance resource for NetWeaver ERS. - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address: + sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address: description: - Virtual IP of the NetWeaver PAS instance. - Mandatory for NetWeaver PAS cluster setup. - sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: + sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name: default: vip___pas description: - Name of the SAPInstance resource for NetWeaver PAS. - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address: + sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address: description: - Virtual IP of the NetWeaver AAS instance. - Mandatory for NetWeaver AAS cluster setup. - sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: + sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name: default: vip___aas description: - Name of the SAPInstance resource for NetWeaver AAS. - sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: + sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name: default: Filesystem_NWAS_SAPMNT_ description: - Filesystem resource name for the shared filesystem /sapmnt. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. + - Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`. - sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: + sap_ha_pacemaker_cluster_nwas_transports_filesystem_resource_name: default: Filesystem_NWAS_TRANS_ description: - Filesystem resource name for the transports filesystem /usr/sap/trans. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. + - Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`. - sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: + sap_ha_pacemaker_cluster_nwas_sys_filesystem_resource_name: default: Filesystem_NWAS_SYS_ description: - Filesystem resource name for the transports filesystem /usr/sap//SYS. - Optional, this is typically managed by the OS, but can as well be added to the cluster configuration. - - Enable this resource setup using `sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed`. + - Enable this resource setup using `sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed`. - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed: + sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed: type: bool default: false description: @@ -508,50 +500,50 @@ argument_specs: # NetWeaver ASCS specific parameters ########################################################################## - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name: description: - The name of the ASCS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string: description: - The full path and name of the ASCS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: + sap_ha_pacemaker_cluster_nwas_abap_ascs_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ASCS__ description: - Name of the filesystem resource for the ASCS instance. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ASCS__ description: - Name of the ASCS instance resource. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_automatic_recover_bool: type: bool default: false description: - NetWeaver ASCS instance resource option "AUTOMATIC_RECOVER". - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_stickiness: default: 5000 description: - NetWeaver ASCS instance resource stickiness attribute. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_migration_threshold: default: 1 description: - NetWeaver ASCS instance migration-threshold setting attribute. - - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1`). Default setup is ENSA2. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout: + sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_failure_timeout: default: 60 description: - NetWeaver ASCS instance failure-timeout attribute. - - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1`). Default setup is ENSA2. + - Only used for ENSA1 setups (see `sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1`). Default setup is ENSA2. - sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness: + sap_ha_pacemaker_cluster_nwas_abap_ascs_group_stickiness: default: 3000 description: - NetWeaver ASCS resource group stickiness to prefer the ASCS group to stay on the node it was started on. @@ -561,28 +553,28 @@ argument_specs: # NetWeaver ERS specific parameters ########################################################################## - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name: + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name: description: - The name of the ERS instance, typically the profile name. - Mandatory for the NetWeaver ASCS/ERS cluster setup. - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string: + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string: description: - The full path and name of the ERS instance profile. - Mandatory for the NetWeaver ASCS/ERS cluster. - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool: + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool: type: bool default: false description: - NetWeaver ERS instance resource option "AUTOMATIC_RECOVER". - sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: + sap_ha_pacemaker_cluster_nwas_abap_ers_filesystem_resource_name: default: Filesystem_NWAS_ABAP_ERS__ description: - Name of the filesystem resource for the ERS instance. - sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: + sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name: default: SAPInstance_NWAS_ABAP_ERS__ description: - Name of the ERS instance resource. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index a01cf87e0..b6bdaaa58 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -39,6 +39,6 @@ - name: "SAP HA Prepare Pacemaker - Include NETWEAVER specific variables" ansible.builtin.include_tasks: - file: include_vars_netweaver.yml + file: include_vars_nwas.yml when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml similarity index 70% rename from roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml rename to roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml index 0660a3aab..0bc12838e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_netweaver_ascs_ers_postinstallation.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml @@ -5,14 +5,14 @@ - 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 }}" + path: "{{ sap_ha_pacemaker_cluster_nwas_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 }}" + path: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string }}" backup: true regexp: 'Restart_Program_00' replace: 'Start_Program_00' @@ -27,20 +27,20 @@ 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 }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name }}" + - "{{ sap_ha_pacemaker_cluster_nwas_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" + path: "/etc/systemd/system/SAP{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ systemd_item }}.service" loop: - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}" loop_control: loop_var: systemd_item - label: "SAP{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ systemd_item }}.service" + label: "SAP{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_{{ systemd_item }}.service" register: __sap_ha_pacemaker_cluster_register_instance_service - name: "SAP HA Pacemaker - (systemd) Save found ASCS/ERS services" @@ -103,91 +103,91 @@ # # 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" +- name: "SAP HA Pacemaker - (SAP HA Interface) 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" + - name: "SAP HA Pacemaker - (SAP HA Interface) Add {{sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm user to 'haclient' group" ansible.builtin.user: - name: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" + name: "{{ sap_ha_pacemaker_cluster_nwas_abap_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" + - name: "SAP HA Pacemaker - (SAP HA Interface) 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 + loop: "{{ __sap_ha_pacemaker_cluster_nwas_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" + - name: "SAP HA Pacemaker - (SAP HA Interface) Check where ASCS is running" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }} -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" + - name: "SAP HA Pacemaker - (SAP HA Interface) Check where ERS is running" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function GetProcessList changed_when: false failed_when: false - - name: "SAP HA Pacemaker - (SAP HAlib) Restart the ASCS service" + - name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ASCS service" when: - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 - become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }} -function RestartService changed_when: __sap_ha_pacemaker_cluster_register_restart_ascs.rc == 0 - - name: "SAP HA Pacemaker - (SAP HAlib) Restart the ERS service" + - name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ERS service" when: - __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 - become_user: "{{ sap_ha_pacemaker_cluster_netweaver_sid | lower }}adm" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function RestartService changed_when: __sap_ha_pacemaker_cluster_register_restart_ers.rc == 0 - - name: "SAP HA Pacemaker - (SAP HAlib) Run HA check for ASCS" + - name: "SAP HA Pacemaker - (SAP HA Interface) 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" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }} -function HACheckConfig changed_when: false - - name: "SAP HA Pacemaker - (SAP HAlib) Run HA check for ERS" + - name: "SAP HA Pacemaker - (SAP HA Interface) 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" + become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_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 + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function HACheckConfig changed_when: false - - name: "SAP HA Pacemaker - (SAP HAlib) Display HA check results for ASCS" + - name: "SAP HA Pacemaker - (SAP HA Interface) 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" + - name: "SAP HA Pacemaker - (SAP HA Interface) Display HA check results for ERS" when: - __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 ansible.builtin.debug: @@ -195,6 +195,6 @@ {{ __sap_ha_pacemaker_cluster_register_ers_ha.stdout }} - # TODO: verification checks that the instances are running and HAlib is enabled + # TODO: verification checks that the instances are running and HA Interface is enabled ### END of BLOCK for sap_cluster_connector. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml index db3eded7f..a919561a4 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_final_hacluster_vars.yml @@ -21,7 +21,7 @@ # __sap_ha_pacemaker_cluster_constraints_order ha_cluster_constraints_order # __sap_ha_pacemaker_cluster_extra_packages ha_cluster_extra_packages # __sap_ha_pacemaker_cluster_fence_agent_packages ha_cluster_fence_agent_packages -# __sap_ha_pacemaker_cluster_hacluster_password ha_cluster_hacluster_password +# __sap_ha_pacemaker_cluster_hacluster_user_password ha_cluster_hacluster_password # __sap_ha_pacemaker_cluster_repos __ha_cluster_repos # __sap_ha_pacemaker_cluster_resource_clones ha_cluster_resource_clones # __sap_ha_pacemaker_cluster_resource_groups ha_cluster_resource_groups @@ -68,9 +68,9 @@ ha_cluster_fence_agent_packages: "{{ __sap_ha_pacemaker_cluster_fence_agent_packages }}" - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_hacluster_password'" - when: __sap_ha_pacemaker_cluster_hacluster_password is defined + when: __sap_ha_pacemaker_cluster_hacluster_user_password is defined ansible.builtin.set_fact: - ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_password }}" + ha_cluster_hacluster_password: "{{ __sap_ha_pacemaker_cluster_hacluster_user_password }}" no_log: true # secure the credential - name: "SAP HA Prepare Pacemaker - (ha_cluster) Define parameter 'ha_cluster_repos'" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml index f25a1504f..bc6e17140 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_common.yml @@ -12,13 +12,13 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_cluster_name: "{{ sap_ha_pacemaker_cluster_cluster_name }}" -# sap_ha_pacemaker_cluster_hacluster_password -> user-defined or default inherited from {{ ha_cluster_hacluster_password }} +# sap_ha_pacemaker_cluster_hacluster_user_password -> user-defined or default inherited from {{ ha_cluster_hacluster_password }} - name: "SAP HA Prepare Pacemaker - Register the 'hacluster' user password" when: - - __sap_ha_pacemaker_cluster_hacluster_password is not defined - - sap_ha_pacemaker_cluster_hacluster_password + - __sap_ha_pacemaker_cluster_hacluster_user_password is not defined + - sap_ha_pacemaker_cluster_hacluster_user_password ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_hacluster_password: "{{ sap_ha_pacemaker_cluster_hacluster_password }}" + __sap_ha_pacemaker_cluster_hacluster_user_password: "{{ sap_ha_pacemaker_cluster_hacluster_user_password }}" no_log: true # secure the credential diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_ascs_ers.yml similarity index 73% rename from roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml rename to roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_ascs_ers.yml index 2f3b687fc..5d6b32cc9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_ascs_ers.yml @@ -23,39 +23,39 @@ ### Different SAPInstance resource attributes for ENSA1 and ENSA2 - name: "SAP HA Prepare Pacemaker - Define default ASCS/ERS instance attributes (ENSA2)" - when: not sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + when: not sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1 ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs: + __sap_ha_pacemaker_cluster_nwas_ascs_sapinstance_meta_attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_stickiness }}" - __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs: + __sap_ha_pacemaker_cluster_nwas_ers_sapinstance_instance_attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool | string }}" - name: "SAP HA Prepare Pacemaker - Define ASCS/ERS instance attributes (ENSA1)" - when: sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + when: sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1 ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs: + __sap_ha_pacemaker_cluster_nwas_ascs_sapinstance_meta_attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_stickiness }}" - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_migration_threshold }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_migration_threshold }}" - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_ensa1_failure_timeout }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_ensa1_failure_timeout }}" - __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs: + __sap_ha_pacemaker_cluster_nwas_ers_sapinstance_instance_attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool | string }}" - name: IS_ERS value: true @@ -68,9 +68,9 @@ __resource_filesystem: id: |- {%- if '/ASCS' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_abap_ascs_filesystem_resource_name %} {%- elif '/ERS' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_abap_ers_filesystem_resource_name %} {%- endif -%} {{ idname }} agent: "ocf:heartbeat:Filesystem" @@ -151,7 +151,7 @@ {%- endfor %} __mountpoint: "{{ fsres_item }}" - loop: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems }}" + loop: "{{ __sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_filesystems }}" loop_control: loop_var: fsres_item label: "{{ fsres_item }}" @@ -167,18 +167,18 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" vars: __resource_sapinstance: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_automatic_recover_bool | string }}" meta_attrs: - - attrs: "{{ __sap_ha_pacemaker_cluster_netweaver_ascs_sapinstance_meta_attrs }}" + - attrs: "{{ __sap_ha_pacemaker_cluster_nwas_ascs_sapinstance_meta_attrs }}" operations: - action: start attrs: @@ -210,10 +210,10 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" vars: __resource_sapinstance_ers: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - - attrs: "{{ __sap_ha_pacemaker_cluster_netweaver_ers_sapinstance_instance_attrs }}" + - attrs: "{{ __sap_ha_pacemaker_cluster_nwas_ers_sapinstance_instance_attrs }}" operations: - action: start attrs: @@ -255,15 +255,15 @@ __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ascs_group] }}" vars: __ascs_group: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}_group" resource_ids: - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_filesystem_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name }}" meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_group_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_group_stickiness }}" when: - __ascs_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) @@ -279,11 +279,11 @@ __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ers_group] }}" vars: __ers_group: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ERS{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}_group" resource_ids: - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - - "{{ sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_filesystem_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name }}" when: - __ers_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) @@ -307,10 +307,10 @@ vars: __constraint_colo_ers: resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}_group" role: started resource_follower: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ERS{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}_group" options: - name: score value: -5000 @@ -324,10 +324,10 @@ vars: __constraint_order_ascs_ers: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}_group" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ERS{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}_group" options: - name: symmetrical value: "false" @@ -343,13 +343,13 @@ vars: __constraint_location_ascs_ers: resource: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - rule: "runs_ers_{{ sap_ha_pacemaker_cluster_netweaver_sid }} eq 1" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_resource_name }}" + rule: "runs_ers_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }} eq 1" options: - name: score value: 2000 when: - - sap_ha_pacemaker_cluster_netweaver_ascs_ers_ensa1 + - sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_ensa1 # When /sapmnt is managed by the cluster, @@ -360,12 +360,12 @@ vars: __constraint_order_sapmnt: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}-clone" + id: "{{ sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name }}-clone" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}_group" when: - - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed - name: "SAP HA Prepare Pacemaker - Add order constraint: first start /sapmnt, then start ERS group" ansible.builtin.set_fact: @@ -373,9 +373,9 @@ vars: __constraint_order_sapmnt: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}-clone" + id: "{{ sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name }}-clone" role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}_group" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}_ERS{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}_group" when: - - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_pas_aas.yml similarity index 66% rename from roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml rename to roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_pas_aas.yml index 54b2d7834..17be8c306 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_abap_pas_aas.yml @@ -15,20 +15,20 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_resource_name }}" agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_host_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_host_mount_path }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_local_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_local_mount_path }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_fstype }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_options_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_options_string }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_filesystem_force_unmount }}" operations: - action: start attrs: @@ -56,20 +56,20 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_resource_name }}" agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_host_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_host_mount_path }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_local_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_local_mount_path }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_fstype }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_options_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_options_string }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_filesystem_force_unmount }}" operations: - action: start attrs: @@ -97,24 +97,24 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" vars: __resource_sapinstance: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_automatic_recover_bool | string }}" meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_resource_stickiness }}" - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_migration_threshold }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_migration_threshold }}" - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_failure_timeout }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_pas_sapinstance_failure_timeout }}" operations: - action: start attrs: @@ -144,24 +144,24 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" vars: __resource_sapinstance_ers: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_automatic_recover_bool | string }}" meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_resource_stickiness }}" - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_migration_threshold }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_migration_threshold }}" - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_failure_timeout }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_abap_aas_sapinstance_failure_timeout }}" operations: - action: start attrs: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_common.yml similarity index 83% rename from roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml rename to roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_common.yml index 06a4b806a..ccaae9c04 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_common.yml @@ -24,11 +24,11 @@ __resource_filesystem: id: |- {%- if '/sapmnt' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name %} {% elif '/usr/sap/trans' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name %} - {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_netweaver_sid + '/SYS' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_transports_filesystem_resource_name %} + {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_nwas_abap_sid + '/SYS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_nwas_sys_filesystem_resource_name %} {% endif %} {{ idname }} @@ -71,13 +71,13 @@ __nfs_server: "{{ commonfs_item.nfs_server | default(sap_ha_pacemaker_cluster_storage_nfs_server) | regex_replace('/$', '') }}" __nfs_path: |- {%- if '/usr/sap' in commonfs_item.nfs_path and '/usr/sap/trans' not in commonfs_item.nfs_path -%} - {{ commonfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {{ commonfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}/SYS {%- else -%} {{ commonfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }} {%- endif %} __mountpoint: |- {%- if commonfs_item.mountpoint | regex_replace('/$', '') == '/usr/sap' -%} - {{ commonfs_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {{ commonfs_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}/SYS {%- else -%} {{ commonfs_item.mountpoint | regex_replace('/$', '') }} {%- endif %} @@ -87,7 +87,7 @@ loop_var: commonfs_item label: "{{ commonfs_item.name }}" when: - - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed - commonfs_item.mountpoint is defined - commonfs_item.nfs_path is defined - "'/usr/sap' in commonfs_item.mountpoint @@ -105,11 +105,11 @@ __clone_common_filesystem: resource_id: |- {%- if '/sapmnt' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_sapmnt_filesystem_resource_name %} {% elif '/usr/sap/trans' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name %} - {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_netweaver_sid + '/SYS' in __mountpoint -%} - {% set idname = sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name %} + {% set idname = sap_ha_pacemaker_cluster_nwas_transports_filesystem_resource_name %} + {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_nwas_abap_sid + '/SYS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_nwas_sys_filesystem_resource_name %} {% endif %} {{ idname }} meta_attrs: @@ -119,7 +119,7 @@ __mountpoint: |- {%- if commonfsclone_item.mountpoint | regex_replace('/$', '') == '/usr/sap' -%} - {{ commonfsclone_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {{ commonfsclone_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}/SYS {%- else -%} {{ commonfsclone_item.mountpoint | regex_replace('/$', '') }} {%- endif %} @@ -129,7 +129,7 @@ loop_var: commonfsclone_item label: "{{ commonfsclone_item.name }}" when: - - sap_ha_pacemaker_cluster_netweaver_shared_filesystems_cluster_managed + - sap_ha_pacemaker_cluster_nwas_shared_filesystems_cluster_managed - commonfsclone_item.mountpoint is defined - commonfsclone_item.nfs_path is defined - "'/usr/sap' in commonfsclone_item.mountpoint diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_java_scs_ers.yml similarity index 72% rename from roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml rename to roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_java_scs_ers.yml index 67e66aabb..42867c02c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_nwas_java_scs_ers.yml @@ -15,20 +15,20 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_resource_name }}" agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_host_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_host_mount_path }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_local_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_local_mount_path }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_fstype }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_options_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_options_string }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_force_unmount }}" operations: - action: start attrs: @@ -56,20 +56,20 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_resource_name }}" agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_host_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_host_mount_path }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_local_mount_path }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_local_mount_path }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_fstype }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_options_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_options_string }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_force_unmount }}" operations: - action: start attrs: @@ -98,24 +98,24 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" vars: __resource_sapinstance: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_automatic_recover_bool | string }}" meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_stickiness }}" - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_migration_threshold }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_migration_threshold }}" - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_failure_timeout }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_failure_timeout }}" operations: - action: start attrs: @@ -145,24 +145,24 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" vars: __resource_sapinstance_ers: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: - name: InstanceName - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_instance_name }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_instance_name }}" - name: START_PROFILE - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_start_profile_string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_automatic_recover_bool | string }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_automatic_recover_bool | string }}" meta_attrs: - attrs: - name: resource-stickiness - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_stickiness }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_stickiness }}" - name: migration-threshold - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_migration_threshold }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_migration_threshold }}" - name: failure-timeout - value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_failure_timeout }}" + value: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_failure_timeout }}" operations: - action: start attrs: @@ -193,7 +193,7 @@ __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" vars: __clone_filesystem: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name }}" + resource_id: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_filesystem_resource_name }}" promotable: "no" meta_attrs: - attrs: @@ -211,7 +211,7 @@ __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" vars: __clone_filesystem: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name }}" + resource_id: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_filesystem_resource_name }}" promotable: "no" meta_attrs: - attrs: @@ -230,7 +230,7 @@ __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance] }}" vars: __clone_sapinstance: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name }}" + resource_id: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_name }}" promotable: "yes" meta_attrs: - attrs: @@ -248,7 +248,7 @@ __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance_ers] }}" vars: __clone_sapinstance_ers: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name }}" + resource_id: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_name }}" promotable: "yes" meta_attrs: - attrs: @@ -268,10 +268,10 @@ vars: __constraint_order_sapinstance: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_clone_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_scs_sapinstance_resource_clone_name }}" action: start resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name }}" + id: "{{ sap_ha_pacemaker_cluster_nwas_java_ers_sapinstance_resource_clone_name }}" action: start options: - name: symmetrical diff --git a/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml index 6598e8ff3..a2ca8de87 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/import_hacluster_vars_from_inventory.yml @@ -65,7 +65,7 @@ - name: "SAP HA Prepare Pacemaker - (ha_cluster) Register parameter 'ha_cluster_repos'" when: ha_cluster_hacluster_password is defined ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_hacluster_password: "{{ ha_cluster_hacluster_password }}" + __sap_ha_pacemaker_cluster_hacluster_user_password: "{{ ha_cluster_hacluster_password }}" no_log: true # handle credentials with care # ha_cluster_repos diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 7d2d2ad03..2ef69df6e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -12,13 +12,13 @@ } }}" nwas_abap_ascs_ers: "{{ { - sap_ha_pacemaker_cluster_vip_netweaver_ascs_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | regex_replace('/.*', ''), - sap_ha_pacemaker_cluster_vip_netweaver_ers_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | regex_replace('/.*', '') + sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_nwas_abap_ers_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | regex_replace('/.*', '') } }}" nwas_abap_pas_aas: "{{ { - sap_ha_pacemaker_cluster_vip_netweaver_pas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | regex_replace('/.*', ''), - sap_ha_pacemaker_cluster_vip_netweaver_aas_resource_name: sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | regex_replace('/.*', '') + sap_ha_pacemaker_cluster_vip_nwas_abap_pas_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address | regex_replace('/.*', ''), + sap_ha_pacemaker_cluster_vip_nwas_abap_aas_resource_name: sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address | regex_replace('/.*', '') } }}" - name: "SAP HA Prepare Pacemaker - Combine VIP parameters" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml similarity index 100% rename from roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml rename to roles/sap_ha_pacemaker_cluster/tasks/include_vars_nwas.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index efcb6aed0..5aba3f387 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -63,13 +63,13 @@ - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver common" ansible.builtin.include_tasks: - file: construct_vars_netweaver_common.yml + file: construct_vars_nwas_common.yml when: - "'nwas_abap' in sap_ha_pacemaker_cluster_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP ASCS/ERS" ansible.builtin.include_tasks: - file: construct_vars_netweaver_abap_ascs_ers.yml + file: construct_vars_nwas_abap_ascs_ers.yml loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: nwas_build_item @@ -78,7 +78,7 @@ - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" ansible.builtin.include_tasks: - file: construct_vars_netweaver_abap_pas_aas.yml + file: construct_vars_nwas_abap_pas_aas.yml loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: nwas_build_item @@ -87,7 +87,7 @@ - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver Java SCS/ERS" ansible.builtin.include_tasks: - file: construct_vars_netweaver_java_scs_ers.yml + file: construct_vars_nwas_java_scs_ers.yml loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: nwas_build_item @@ -202,7 +202,7 @@ - name: "SAP HA Install Pacemaker - Include NetWeaver ASCS/ERS post installation" ansible.builtin.include_tasks: - file: configure_netweaver_ascs_ers_postinstallation.yml + file: configure_nwas_ascs_ers_postinstallation.yml apply: tags: nwas_postinst tags: nwas_postinst diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index 244532aeb..e5f7716e6 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -65,7 +65,7 @@ value: "{{ lb_port_for_hc | default(0) }}" # Add default to ensure skip without errors - name: nc value: "{{ __sap_ha_pacemaker_cluster_register_socat_path.stdout }}" - loop: ["626{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}", "626{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}"] + loop: ["626{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}", "626{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}"] loop_control: loop_var: lb_port_for_hc index_var: lb_port_for_hc_index diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 00bfc6eec..07cce5772 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -36,11 +36,11 @@ - name: "SAP HA Prepare Pacemaker - (SAP NetWeaver) Validate SAP System ID" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_netweaver_sid | length == 3 - - sap_ha_pacemaker_cluster_netweaver_sid not in __sap_sid_prohibited + - sap_ha_pacemaker_cluster_nwas_abap_sid | length == 3 + - sap_ha_pacemaker_cluster_nwas_abap_sid not in __sap_sid_prohibited fail_msg: | Host type = {{ sap_ha_pacemaker_cluster_host_type }} - Requires 'sap_ha_pacemaker_cluster_netweaver_sid' to be defined! + Requires 'sap_ha_pacemaker_cluster_nwas_abap_sid' to be defined! when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 @@ -62,15 +62,15 @@ Host type = {{ sap_ha_pacemaker_cluster_host_type }} Requires the ASCS/ERS instance numbers to be defined: - - sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number - - sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number + - sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr + - sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr The instance number must be exactly 2 digits. Add quotes if the number starts with a 0! loop: - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" - - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}" loop_control: loop_var: ascs_ers_nr_item @@ -111,35 +111,35 @@ - name: "SAP HA Prepare Pacemaker - (NetWeaver ASCS) Verify that the VIP is defined" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address is defined - - sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address | length > 0 - fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_ascs_ip_address' is not defined." + - sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address is defined + - sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_nwas_abap_ascs_ip_address' is not defined." when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_ascs') | length > 0 - name: "SAP HA Prepare Pacemaker - (NetWeaver ERS) Verify that the VIP is defined" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address is defined - - sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address | length > 0 - fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_ers_ip_address' is not defined." + - sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address is defined + - sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_nwas_abap_ers_ip_address' is not defined." when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_ascs_ers') | length > 0 - name: "SAP HA Prepare Pacemaker - (NetWeaver PAS) Verify that the VIP is defined" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address is defined - - sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address | length > 0 - fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_pas_ip_address' is not defined." + - sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address is defined + - sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_nwas_abap_pas_ip_address' is not defined." when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_pas') | length > 0 - name: "SAP HA Prepare Pacemaker - (NetWeaver AAS) Verify that the ERS VIP is defined" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address is defined - - sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address | length > 0 - fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_netweaver_aas_ip_address' is not defined." + - sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address is defined + - sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address | length > 0 + fail_msg: "Host type = '{{ sap_ha_pacemaker_cluster_host_type }}', but 'sap_ha_pacemaker_cluster_vip_nwas_abap_aas_ip_address' is not defined." when: - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap_pas_aas') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 22384d3de..e0dbd3eb6 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -53,7 +53,7 @@ __sap_ha_pacemaker_cluster_platform: '' # # Never set defaults for these: #__sap_ha_pacemaker_cluster_cluster_name: -#__sap_ha_pacemaker_cluster_hacluster_password: +#__sap_ha_pacemaker_cluster_hacluster_user_password: # Pre-define internal optional parameters to avoid defaults in the code: diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml index 46e12821a..2daf0d2b5 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml @@ -1,8 +1,15 @@ --- -#sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +#sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}" + +# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage +# definition. +# Therefore, the /usr/sap prefix must be left out of the listed path items. +__sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_filesystems: + - "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}/ASCS{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_sid }}/ERS{{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }}" # 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 }}" +# Used in tasks/configure_nwas_postinstallation.yml for sap_cluster_connector setup. +__sap_ha_pacemaker_cluster_nwas_abap_ascs_ers_profile_paths: + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ascs_sapinstance_start_profile_string }}" + - "{{ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_start_profile_string }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml index e8bcccc3c..dcf8452bc 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/redhat.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/redhat.yml @@ -8,7 +8,7 @@ __sap_ha_pacemaker_cluster_repos: __sap_ha_pacemaker_cluster_halib_package: sap-cluster-connector # List of configuration lines that must be added to the instance profiles. -# Used in tasks/configure_netweaver_ascs_ers_postinstallation.yml for SAP HAlib setup. +# Used in tasks/configure_nwas_ascs_ers_postinstallation.yml for SAP HA Interface setup. __sap_ha_pacemaker_cluster_connector_config_lines: - "service/halib = $(DIR_EXECUTABLE)/saphascriptco.so" - "service/halib_cluster_connector = /usr/bin/sap_cluster_connector" diff --git a/roles/sap_ha_pacemaker_cluster/vars/suse.yml b/roles/sap_ha_pacemaker_cluster/vars/suse.yml index 33314e950..c821de804 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/suse.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/suse.yml @@ -2,7 +2,7 @@ __sap_ha_pacemaker_cluster_halib_package: sap-suse-cluster-connector # List of configuration lines that must be added to the instance profiles. -# Used in tasks/configure_netweaver_ascs_ers_postinstallation.yml for SAP HAlib setup. +# Used in tasks/configure_nwas_ascs_ers_postinstallation.yml for SAP HA Interface setup. __sap_ha_pacemaker_cluster_connector_config_lines: - "service/halib = $(DIR_EXECUTABLE)/saphascriptco.so" - "service/halib_cluster_connector = /usr/bin/sap_suse_cluster_connector" From c8c71f4869e040878036aabecc0b58e710d955b2 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Thu, 28 Sep 2023 16:02:07 +0100 Subject: [PATCH 170/179] sap_swpm: ensure string does not contain double characters --- roles/sap_swpm/tasks/pre_install.yml | 2 +- .../install_type/ha_maint_plan_stack_install.yml | 8 ++++---- .../pre_install/install_type/maint_plan_stack_install.yml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 598348af2..3e9c3ed7c 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -62,7 +62,7 @@ - " WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} " - " SAPCAR - {{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }} " - " SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} " - - " MP Stack - {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + - " MP Stack - {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" - " Backup - {{ sap_swpm_backup_location }} " - name: SAP SWPM - Installation Process diff --git a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml index 5de0723db..b870fe719 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml @@ -43,20 +43,20 @@ - name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' diff --git a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml index 3ef0701a8..bd48c68a7 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml @@ -28,20 +28,20 @@ - name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ sap_swpm_mp_stack_path + sap_swpm_mp_stack_file_name if (sap_swpm_mp_stack_path | regex_search('/$')) == '/' else sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name }}" + path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' From ba7d360c30abac3c1b1ea77c79a6580012d47e1f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 29 Sep 2023 00:59:15 +0200 Subject: [PATCH 171/179] sap_hana_install: Solve issue #484 --- roles/sap_hana_install/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_hana_install/tasks/main.yml b/roles/sap_hana_install/tasks/main.yml index 2ac3810eb..1a8f2eb7a 100644 --- a/roles/sap_hana_install/tasks/main.yml +++ b/roles/sap_hana_install/tasks/main.yml @@ -3,7 +3,7 @@ - name: Rename some variables used by hdblcm configfile ansible.builtin.set_fact: sap_hana_install_sid: "{{ sap_hana_sid | d(sap_hana_install_sid) | d('') }}" - sap_hana_install_number: "{{ sap_hana_instance_number | d(sap_hana_install_instance_number | d(sap_hana_install_number) | d('')) }}" + sap_hana_install_number: "{{ sap_hana_instance_number | d(sap_hana_install_instance_nr) | d(sap_hana_install_instance_number) | d(sap_hana_install_number) | d('') }}" sap_hana_install_master_password: "{{ sap_hana_install_common_master_password | d(sap_hana_install_master_password) }}" sap_hana_install_system_usage: "{{ sap_hana_install_env_type | d(sap_hana_install_system_usage) }}" sap_hana_install_restrict_max_mem: "{{ sap_hana_install_mem_restrict | d(sap_hana_install_restrict_max_mem) }}" From 015116aea63e814dc62cc0812e6850cb57bf8ec7 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 29 Sep 2023 09:48:05 +0200 Subject: [PATCH 172/179] sap_hana_install: Adapt README.md --- roles/sap_hana_install/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/sap_hana_install/README.md b/roles/sap_hana_install/README.md index 3373a7dda..42ad2ca06 100644 --- a/roles/sap_hana_install/README.md +++ b/roles/sap_hana_install/README.md @@ -160,6 +160,12 @@ The firewall ports for SAP HANA are defined in member `port` of the first field member `state` is set to `enabled`, the ports will be enabled. If the member `state` is set to `disabled`, the ports will be disabled, which might be useful for testing. +Certain parameters have identical meanings, for supporting different naming schemes in playbooks and inventories. +You can find those in the task `Rename some variables used by hdblcm configfile` of the file `tasks/main.yml`. +Example: The parameter `sap_hana_install_number`, which is used by the role to define the hdblm parameter `number` +(= SAP HANA instance number) can be defined by setting `sap_hana_instance_number`, `sap_hana_install_instance_nr`, +`sap_hana_install_instance_number`, or `sap_hana_install_number`. The order of precedence is from left to right. + ### Default Parameters Please check the default parameters file for more information on other parameters that can be used as an input @@ -189,7 +195,7 @@ Sample Ansible Playbook Execution sap_hana_install_software_directory: /software/hana sap_hana_install_common_master_password: 'NewPass$321' sap_hana_install_sid: 'H01' - sap_hana_install_instance_number: '00' + sap_hana_install_instance_nr: '00' roles: - sap_hana_install ``` @@ -208,7 +214,7 @@ Sample Ansible Playbook Execution sap_hana_install_root_password: 'NewPass$321' sap_hana_install_addhosts: 'host2:role=worker,host3:role=worker:group=g02,host4:role=standby:group=g02' sap_hana_install_sid: 'H01' - sap_hana_install_instance_number: '00' + sap_hana_install_instance_nr: '00' roles: - sap_hana_install ``` @@ -228,7 +234,7 @@ Sample Ansible Playbook Execution sap_hana_install_common_master_password: 'NewPass$321' sap_hana_install_root_password: 'NewPass$321' sap_hana_install_sid: 'H01' - sap_hana_install_instance_number: '00' + sap_hana_install_instance_nr: '00' roles: - sap_hana_install ``` @@ -242,7 +248,7 @@ You can find more complex playbooks in directory `playbooks` of the collection ` #### Perform Initial Checks These checks are only performed if `sap_hana_install_force` is set to `true`. Its default value is `false` -- If variable `sap_hana_install_check_sidadm_user` is undefined or set to `y`: Check if user sidadm exists. If yes, +- If variable `sap_hana_install_check_sidadm_user` is undefined or set to `yes`: Check if user sidadm exists. If yes, abort the role. - Check if `/usr/sap/hostctrl/exe/saphostctrl` exists and get info on running HANA instances. @@ -303,7 +309,7 @@ in a temporary directory for use by the hdblcm command in the next step. - Set Log Mode key to overwrite value and apply to system. -- Apply SAP HANA license to the new deployed instance if set to `y`. +- Apply SAP HANA license to the new deployed instance if set to `yes`. - Set expiry of Unix created users to `never`. From 0c6d02191c9dcb0c4ff5546efdb8a1990b94b390 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 29 Sep 2023 11:21:43 +0200 Subject: [PATCH 173/179] playbooks: Adapt sap-hana-install sample variable --- playbooks/vars/sample-variables-sap-hana-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/vars/sample-variables-sap-hana-install.yml b/playbooks/vars/sample-variables-sap-hana-install.yml index 0b12e4752..7a0e73a72 100644 --- a/playbooks/vars/sample-variables-sap-hana-install.yml +++ b/playbooks/vars/sample-variables-sap-hana-install.yml @@ -13,7 +13,7 @@ sap_hana_install_master_password: 'NewPass$321' # Instance details sap_hana_install_sid: 'HDB' -sap_hana_install_instance_number: "00" +sap_hana_install_instance_nr: "00" # ----------------------------- Optional parameters ------------------------------ # From cba7a0026017a2eeb74da287bfe87abf17aa1cfb Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 29 Sep 2023 13:23:21 +0200 Subject: [PATCH 174/179] sap_ha_pacemaker_cluster: improved ASCS/ERS check logic - using `WaitforStarted` to allow instances to finish starting up - type change: `sap_ha_pacemaker_cluster_aws_vip_update_rt` must be a string, not a list - improved and aligned search conditionals --- .../meta/argument_specs.yml | 2 +- ...nfigure_nwas_ascs_ers_postinstallation.yml | 20 +++++++++---------- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 6 +++--- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index cbc437a9d..06d0abc70 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -598,9 +598,9 @@ argument_specs: ########################################################################## sap_ha_pacemaker_cluster_aws_vip_update_rt: - type: list description: - List one more routing table IDs for managing Virtual IP failover through routing table changes. + - Multiple routing tables must be defined as a comma-separated string (no spaces). - Mandatory for the VIP resource configuration in AWS EC2 environments. sap_ha_pacemaker_cluster_aws_region: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml index 0bc12838e..935248870 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml @@ -128,25 +128,25 @@ loop_var: nwas_profile_item label: "{{ nwas_profile_item.0 }} -> {{ nwas_profile_item.1 }}" - - name: "SAP HA Pacemaker - (SAP HA Interface) Check where ASCS is running" + - name: "SAP HA Pacemaker - (SAP HA Interface) Wait for ASCS to be up and running" become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_where_ascs ansible.builtin.shell: | - /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }} -function GetProcessList + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ascs_instance_nr }} -function WaitforStarted 600 15 changed_when: false failed_when: false - - name: "SAP HA Pacemaker - (SAP HA Interface) Check where ERS is running" + - name: "SAP HA Pacemaker - (SAP HA Interface) Wait for ERS to be up and running" become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_where_ers ansible.builtin.shell: | - /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function GetProcessList + /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function WaitforStarted 600 15 changed_when: false failed_when: false - name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ASCS service" when: - - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0 become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_restart_ascs ansible.builtin.shell: | @@ -155,7 +155,7 @@ - name: "SAP HA Pacemaker - (SAP HA Interface) Restart the ERS service" when: - - __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ers.rc == 0 become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_restart_ers ansible.builtin.shell: | @@ -164,7 +164,7 @@ - name: "SAP HA Pacemaker - (SAP HA Interface) Run HA check for ASCS" when: - - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0 become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_ascs_ha ansible.builtin.shell: | @@ -173,7 +173,7 @@ - name: "SAP HA Pacemaker - (SAP HA Interface) Run HA check for ERS" when: - - __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ers.rc == 0 become_user: "{{ sap_ha_pacemaker_cluster_nwas_abap_sid | lower }}adm" register: __sap_ha_pacemaker_cluster_register_ers_ha ansible.builtin.shell: | @@ -182,14 +182,14 @@ - name: "SAP HA Pacemaker - (SAP HA Interface) Display HA check results for ASCS" when: - - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0 ansible.builtin.debug: msg: | {{ __sap_ha_pacemaker_cluster_register_ascs_ha.stdout }} - name: "SAP HA Pacemaker - (SAP HA Interface) Display HA check results for ERS" when: - - __sap_ha_pacemaker_cluster_register_where_ers.rc == 3 + - __sap_ha_pacemaker_cluster_register_where_ers.rc == 0 ansible.builtin.debug: msg: | {{ __sap_ha_pacemaker_cluster_register_ers_ha.stdout }} diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 5aba3f387..a235bd0ec 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -53,19 +53,19 @@ ansible.builtin.include_tasks: file: construct_vars_hana_common.yml when: - - "'hana' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-up" ansible.builtin.include_tasks: file: construct_vars_hana_scaleup.yml when: - - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana_scaleup') | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver common" ansible.builtin.include_tasks: file: construct_vars_nwas_common.yml when: - - "'nwas_abap' in sap_ha_pacemaker_cluster_host_type[0]" + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas_abap') | length > 0 - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP ASCS/ERS" ansible.builtin.include_tasks: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index c34cfac8f..0a178b04e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -62,7 +62,7 @@ - name: interface value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" - name: routing_table - value: "{{ sap_ha_pacemaker_cluster_aws_vip_update_rt | join(',') }}" + value: "{{ sap_ha_pacemaker_cluster_aws_vip_update_rt }}" when: - vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' From 8b15247845bc644e1fac57eaf794a373d33cf48e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 29 Sep 2023 13:41:30 +0200 Subject: [PATCH 175/179] sap_ha_pacemaker_cluster: change sap_ha_pacemaker_cluster_hana_instance_number to sap_ha_pacemaker_cluster_hana_instance_nr --- roles/sap_ha_pacemaker_cluster/README.md | 5 +++-- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 13 +++++++------ .../meta/argument_specs.yml | 2 +- .../tasks/construct_vars_hana_common.yml | 4 ++-- ...onstruct_vars_vip_resources_cloud_msazure_vm.yml | 2 +- .../tasks/validate_input_parameters.yml | 10 +++++----- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index ca8e6e500..9a65edec6 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -160,9 +160,10 @@ Mandatory for the cluster setup on AWS EC2 instances.
### sap_ha_pacemaker_cluster_aws_vip_update_rt -- _Type:_ `list` +- _Type:_ `string` List one more routing table IDs for managing Virtual IP failover through routing table changes.
+Multiple routing tables must be defined as a comma-separated string (no spaces).
Mandatory for the VIP resource configuration in AWS EC2 environments.
### sap_ha_pacemaker_cluster_cluster_name @@ -346,7 +347,7 @@ Time difference needed between to primary time stamps, if a dual-primary situati If the time difference is less than the time gap, then the cluster holds one or both instances in a "WAITING" status.
This is to give an admin a chance to react on a failover. A failed former primary will be registered after the time difference is passed.
-### sap_ha_pacemaker_cluster_hana_instance_number +### sap_ha_pacemaker_cluster_hana_instance_nr - _Type:_ `string` diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index e5a04aa08..b4652cb72 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -113,7 +113,8 @@ sap_ha_pacemaker_cluster_hacluster_user_password: "{{ ha_cluster_hacluster_passw ################################################################################ sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" -sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('') }}" +# Keeping 'sap_ha_pacemaker_cluster_hana_instance_number' for the time being for backwards compatibility. +sap_ha_pacemaker_cluster_hana_instance_nr: "{{ sap_ha_pacemaker_cluster_hana_instance_number | default(sap_hana_instance_number) | default('') }}" # Optional parameters to customize SAPHana resources # AUTOMATED_REGISTER @@ -125,9 +126,9 @@ sap_ha_pacemaker_cluster_hana_prefer_site_takeover: true # SAP HANA - Resource IDs (names) as convenience parameters. -sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_nr }}" sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" -sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" +sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_nr }}" sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" @@ -136,9 +137,9 @@ sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker # # Mandatory: primary VIP address definition in HANA scale-up clusters sap_ha_pacemaker_cluster_vip_hana_primary_ip_address: '' -sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_primary" +sap_ha_pacemaker_cluster_vip_hana_primary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_nr }}_primary" sap_ha_pacemaker_cluster_vip_hana_secondary_ip_address: '' -sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}_readonly" +sap_ha_pacemaker_cluster_vip_hana_secondary_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_nr }}_readonly" ################################################################################ @@ -273,7 +274,7 @@ sap_ha_pacemaker_cluster_nwas_abap_ers_sapinstance_automatic_recover_bool: false ## 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_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 diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 06d0abc70..1bd4d0050 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -265,7 +265,7 @@ argument_specs: - Inherits the value of `sap_hana_sid`, when defined. - Mandatory for SAP HANA cluster setups. - sap_ha_pacemaker_cluster_hana_instance_number: + sap_ha_pacemaker_cluster_hana_instance_nr: description: - The instance number of the SAP HANA database which this role will configure in the cluster. - Inherits the value of `sap_hana_instance_number`, when defined. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index b884af055..cfc6f757c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -30,7 +30,7 @@ - name: SID value: "{{ sap_ha_pacemaker_cluster_hana_sid }}" - name: InstanceNumber - value: "{{ sap_ha_pacemaker_cluster_hana_instance_number }}" + value: "{{ sap_ha_pacemaker_cluster_hana_instance_nr }}" operations: - action: start attrs: @@ -61,7 +61,7 @@ - name: SID value: "{{ sap_ha_pacemaker_cluster_hana_sid }}" - name: InstanceNumber - value: "{{ sap_ha_pacemaker_cluster_hana_instance_number }}" + value: "{{ sap_ha_pacemaker_cluster_hana_instance_nr }}" - name: AUTOMATED_REGISTER value: "{{ sap_ha_pacemaker_cluster_hana_automated_register | string }}" - name: DUPLICATE_PRIMARY_TIMEOUT diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index e5f7716e6..117a8439f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -29,7 +29,7 @@ - name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Define load balancer port for health check when SAP HANA scale-up HA" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_lb_port: "626{{ sap_ha_pacemaker_cluster_hana_instance_number }}" + __sap_ha_pacemaker_cluster_resource_lb_port: "626{{ sap_ha_pacemaker_cluster_hana_instance_nr }}" when: "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list - name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Add resource: Azure Load Balancer (NLB L-4) for VIP routing when SAP HANA scale-up HA" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 07cce5772..ad8831114 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -15,18 +15,18 @@ ansible.builtin.assert: that: - ( - sap_ha_pacemaker_cluster_hana_instance_number | type_debug != 'int' - and sap_ha_pacemaker_cluster_hana_instance_number | length == 2 + sap_ha_pacemaker_cluster_hana_instance_nr | type_debug != 'int' + and sap_ha_pacemaker_cluster_hana_instance_nr | length == 2 ) or ( - sap_ha_pacemaker_cluster_hana_instance_number | type_debug == 'int' - and sap_ha_pacemaker_cluster_hana_instance_number is regex("^[0-9][0-9]$") + sap_ha_pacemaker_cluster_hana_instance_nr | type_debug == 'int' + and sap_ha_pacemaker_cluster_hana_instance_nr is regex("^[0-9][0-9]$") ) fail_msg: | Host type = {{ sap_ha_pacemaker_cluster_host_type }} - Requires 'sap_ha_pacemaker_cluster_hana_instance_number' to be defined. + Requires 'sap_ha_pacemaker_cluster_hana_instance_nr' to be defined. The instance number must be exactly 2 digits. Add quotes if the number starts with a 0! From 929c958c6be5510ba5acf8dc4a170eb90a540427 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:53:43 +0100 Subject: [PATCH 176/179] collection: prepare for v1.3.2 --- CHANGELOG.rst | 27 +++++++++++++++++++++++++++ galaxy.yml | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8cae9cc30..f4cddae5d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,33 @@ community.sap_install Release Notes .. contents:: Topics +v1.3.2 +====== + +Release Summary +--------------- + +| Release Date: 2023-09-29 +sap_general_preconfigure: Update to latest SAP documentation for RHEL 9 package libxcrypt-compat +sap_general_preconfigure: Bug fix for directory creation and SELinux Labels +sap_ha_pacemaker_cluster: Bug fix for AWS EC2 Virtual Servers +sap_ha_pacemaker_cluster: Bug fix for Google Cloud Compute Engine VM netmask lock on Virtual IP +sap_ha_pacemaker_cluster: Feature add for improved SAP NetWeaver HA compatibility +sap_ha_pacemaker_cluster: Feature add for ENSA1 compatibility +sap_ha_pacemaker_cluster: Feature add for SAP HA Interface Cluster Connector after cluster init +sap_ha_pacemaker_cluster: Feature add for IBM PowerVM hypervisor +sap_ha_pacemaker_cluster: Feature add for multiple network interfaces with Virtual IP +sap_hana_install: Bug fix for SELinux disable when SLES4SAP +sap_install_media_detect: Feature add for idempotency +sap_install_media_detect: Feature add for new file detection after code restructure +sap_install_media_detect: Bug fix for setting SAP Maintenance Planner Stack XML path +sap_storage_setup: Feature add for Multipathing detection +sap_storage_setup: Bug fix for NFS throttle from customer test on MS Azure +sap_storage_setup: Bug fix for packages on SLES and Google Cloud +sap_swpm: Bug fix for RDBMS var name +sap_swpm: Bug fix for SAP HANA Client hdbuserstore connection +sap_swpm: Bug fix for SAP Maintenance Planner Stack XML path + v1.3.1 ====== diff --git a/galaxy.yml b/galaxy.yml index 9f4417e77..5238b650d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: community name: sap_install # The version of the collection. Must be compatible with semantic versioning -version: 1.3.1 +version: 1.3.2 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From fd706f7018ac80784638d668420b7f373046a1ab Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 29 Sep 2023 15:28:14 +0200 Subject: [PATCH 177/179] fix remaining issues of #484 --- roles/sap_swpm/tasks/pre_install.yml | 2 +- .../install_type/ha_maint_plan_stack_install.yml | 8 ++++---- .../pre_install/install_type/maint_plan_stack_install.yml | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 3e9c3ed7c..7e0cb7a6f 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -62,7 +62,7 @@ - " WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} " - " SAPCAR - {{ sap_swpm_sapcar_path }}/{{ sap_swpm_sapcar_file_name }} " - " SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} " - - " MP Stack - {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + - " MP Stack - {{ (sap_swpm_mp_stack_path | d('', true) + '/' + sap_swpm_mp_stack_file_name | d('', true)) | regex_replace('//*', '/') }}" - " Backup - {{ sap_swpm_backup_location }} " - name: SAP SWPM - Installation Process diff --git a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml index b870fe719..9995effc0 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml @@ -43,20 +43,20 @@ - name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' diff --git a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml index bd48c68a7..3c33b3265 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/maint_plan_stack_install.yml @@ -28,20 +28,20 @@ - name: SAP SWPM Pre Install - MP Stack XML - Show File and Path ansible.builtin.debug: - msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + msg: "SAP Maintenance Planner Stack XML is {{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection ansible.builtin.set_fact: - sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" - name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML ansible.builtin.replace: - path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace ('//*', '/') }}" + path: "{{ (sap_swpm_mp_stack_path + '/' + sap_swpm_mp_stack_file_name) | regex_replace('//*', '/') }}" regexp: '([A-Z][0-9])\w' replace: '{{ sap_swpm_sid | upper }}' From d15fb384995d03697085b2bdcc95f4efc56fd76e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 29 Sep 2023 18:57:03 +0200 Subject: [PATCH 178/179] sap_ha_pacemaker_cluster: fix: pause before HACheckConfig is run --- .../tasks/configure_nwas_ascs_ers_postinstallation.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml index 935248870..08681b6f0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/configure_nwas_ascs_ers_postinstallation.yml @@ -162,6 +162,13 @@ /usr/sap/hostctrl/exe/sapcontrol -nr {{ sap_ha_pacemaker_cluster_nwas_abap_ers_instance_nr }} -function RestartService changed_when: __sap_ha_pacemaker_cluster_register_restart_ers.rc == 0 + - name: "SAP HA Pacemaker - (SAP HA Interface) Pause after service restart" + when: + - __sap_ha_pacemaker_cluster_register_restart_ascs.changed + or __sap_ha_pacemaker_cluster_register_restart_ers.changed + ansible.builtin.pause: + seconds: 10 + - name: "SAP HA Pacemaker - (SAP HA Interface) Run HA check for ASCS" when: - __sap_ha_pacemaker_cluster_register_where_ascs.rc == 0 From 4f788c293522564563e3469240d524b05c08f760 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 29 Sep 2023 20:57:10 +0100 Subject: [PATCH 179/179] collection: append changelog note --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f4cddae5d..a49d20c77 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -22,6 +22,7 @@ sap_ha_pacemaker_cluster: Feature add for SAP HA Interface Cluster Connector aft sap_ha_pacemaker_cluster: Feature add for IBM PowerVM hypervisor sap_ha_pacemaker_cluster: Feature add for multiple network interfaces with Virtual IP sap_hana_install: Bug fix for SELinux disable when SLES4SAP +sap_install_media_detect: Feature add for NFS compatibility sap_install_media_detect: Feature add for idempotency sap_install_media_detect: Feature add for new file detection after code restructure sap_install_media_detect: Bug fix for setting SAP Maintenance Planner Stack XML path @@ -74,7 +75,7 @@ Release Summary | Release Date: 2023-04-25 | sap_hana_preconfigure: Some modifications for HANA on RHEL 9 -| sap_ha_pacemaker_cluster: Support for custom stonith resource definitions containing more than one element +| sap_ha_pacemaker_cluster: Compatibility for custom stonith resource definitions containing more than one element | sap_hana_preconfigure: Be more flexible with IBM service and productivity tools