From 43865994b74ac1e23c5b6e6c6f9432a9192bcbc3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 2 Aug 2024 22:16:49 +0200 Subject: [PATCH 01/33] sap_swpm: No longer use different execution modes Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 72 +++----- roles/sap_swpm/defaults/main.yml | 22 ++- roles/sap_swpm/tasks/main.yml | 2 + roles/sap_swpm/tasks/pre_install.yml | 60 +++++-- .../tasks/pre_install/install_type.yml | 5 +- .../tasks/pre_install/password_facts.yml | 22 --- roles/sap_swpm/tasks/swpm.yml | 24 +-- .../sap_swpm/tasks/swpm/detect_variables.yml | 12 +- .../tasks/swpm/swpm_inifile_generate.yml | 163 ++++++++++++++++++ .../swpm/swpm_inifile_generate_advanced.yml | 35 ---- ...pm_inifile_generate_advanced_templates.yml | 64 ------- .../swpm/swpm_inifile_generate_default.yml | 31 ---- ...wpm_inifile_generate_default_templates.yml | 51 ------ .../sap_swpm/tasks/swpm/swpm_pre_install.yml | 46 +++-- .../{configfile.j2 => inifile_params.j2} | 126 +++++++------- 15 files changed, 366 insertions(+), 369 deletions(-) delete mode 100644 roles/sap_swpm/tasks/pre_install/password_facts.yml create mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml delete mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced.yml delete mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced_templates.yml delete mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default.yml delete mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default_templates.yml rename roles/sap_swpm/templates/{configfile.j2 => inifile_params.j2} (90%) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index f8a16e789..f9e03a94b 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -157,66 +157,42 @@ Sample Ansible Playbook Execution - Apply firewall rules for SAP HANA (optional - no by default) -- Process SAP SWPM `inifile.params` based on inputs +- At this stage, a sapinst inifile is created by the role on the control node if not already present. -### SAP SWPM + - If a file `inifile.params` is located on the managed node in the directory specified in `sap_swpm_inifile_directory`, + the role will not create a new one but rather download this file to the control node. -- Execute SWPM + - If such a file does not exist, the role will create an SAP SWPM `inifile.params` file by one of the following methods: -### Post-Install + Method 1: Predefined sections of the file inifile_params.j2 will be used to create the file `inifile.params`. + The variable `sap_swpm_inifile_sections_list` determines which sections will be used. All other sections will be ignored. + The inifile parameters themselves will be set according to other role parameters. + Example: The inifile parameter `archives.downloadBasket` will be set to the content of the role parameter + `sap_swpm_software_path` -- Set expiry of Unix created users to 'never' + Method 2: The file `inifile.params` will be configured from the content of the dictionary `sap_swpm_inifile_parameters_dict`. + This dictionary is defined like in the following example: -- Apply firewall rules for SAP NW (optional - no by default) +``` +sap_swpm_inifile_parameters_dict: + archives.downloadBasket: /software/download_basket + NW_getFQDN.FQDN: poc.cloud +``` + It is also possible to use method 1 for creating the inifile and then replace or set additional variables using method 2: + Just define both of the related parameters, `sap_swpm_inifile_sections_list` and `sap_swpm_inifile_parameters_dict`. -## Execution Modes +- The file inifile.params is then transferred to a temporary directory on the control node, to be used by the sapinst process. -Every SAP Software installation via SAP Software Provisioning Manager (SWPM) is possible, there are different Ansible Role execution modes available: +### SAP SWPM -- Default (`sap_swpm_templates_product_input: default`), run software install tasks using easy Ansible Variable to generate SWPM Unattended installations - - Default Templates (`sap_swpm_templates_product_input: default_templates`), optional use of templating definitions for repeated installations -- Advanced (`sap_swpm_templates_product_input: advanced`), run software install tasks with Ansible Variables one-to-one matched to SWPM Unattended Inifile parameters to generate bespoke SWPM Unattended installations - - Advanced Templates (`sap_swpm_templates_product_input: advanced_templates`), optional use of templating definitions for repeated installations -- Inifile Reuse (`sap_swpm_templates_product_input: inifile_reuse`), run previously-defined installations with an existing SWPM Unattended inifile.params +- Execute SWPM. This and the remaining steps can be skipped by setting the default of the parameter `sap_swpm_run_sapinst` to `false`. -### Default Templates mode variables +### Post-Install -Example using all inifile list parameters with the Default Templates mode to install SAP ECC EhP8 on IBM Db2: +- Set expiry of Unix created users to 'never' -``` -sap_swpm_ansible_role_mode: default_templates -sap_swpm_templates_product_input: default_templates - -sap_swpm_templates_install_dictionary: - - template_name_ecc_ehp8_ibmdb2: - - sap_swpm_product_catalog_id: NW_ABAP_OneHost:BS2016.ERP608.DB6.PD - sap_swpm_inifile_dictionary: - sap_swpm_sid: - ... - sap_swpm_inifile_list: - - swpm_installation_media - - swpm_installation_media_swpm1 - - swpm_installation_media_swpm1_exportfiles - - swpm_installation_media_swpm1_ibmdb2 - - sum_config - - credentials - - credentials_anydb_ibmdb2 - - db_config_anydb_all - - db_config_anydb_ibmdb2 - - db_connection_nw_anydb_ibmdb2 - - nw_config_anydb - - nw_config_other - - nw_config_central_services_abap - # - nw_config_central_services_java - - nw_config_primary_application_server_instance - - nw_config_ports - - nw_config_host_agent - # - nw_config_post_abap_reports - - sap_os_linux_user -``` +- Apply firewall rules for SAP NW (optional - no by default) ## Tags diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 5ab134ff8..9977972ec 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -5,7 +5,8 @@ # SWPM Ansible Role variables ######################################## -sap_swpm_ansible_role_mode: "default" +# We do not use role modes any more: +# sap_swpm_ansible_role_mode: "default" # default # default_templates # advanced @@ -45,22 +46,21 @@ sap_swpm_files_non_sapcar_group: root ######################################## # SWPM Ansible Role variables -# for Inifile Reuse, Advanced, and Defaults/Advanced Templates Mode +# for creating the sapinst inifile ######################################## +# Have the role run the sapinst command with an existing inifile or after creating the inifile: +sap_swpm_run_sapinst: true + # Inifile Reuse Mode sap_swpm_inifile_reuse_source: sap_swpm_inifile_reuse_destination: -# Advanced Mode -#sap_swpm_inifile_custom_values_dictionary: +#sap_swpm_inifile_parameters_dict: # archives.downloadBasket: /software/download_basket # NW_getFQDN.FQDN: poc.cloud ## add.additional.parameters: '' -# Default/Advanced Templates Mode -#sap_swpm_templates_product_input: "" - ######################################## # SWPM Ansible Role variables @@ -68,7 +68,7 @@ sap_swpm_inifile_reuse_destination: # - List of inifile parameters to generate ######################################## -sap_swpm_inifile_list: +sap_swpm_inifile_sections_list: - swpm_installation_media - swpm_installation_media_swpm2_hana # - swpm_installation_media_swpm1 @@ -156,7 +156,7 @@ sap_swpm_software_extract_directory: # e.g. /software/sap_swpm_extracted sap_swpm_software_use_media: 'false' # Main path that this role will look for .SAR files -sap_swpm_software_path: +sap_swpm_software_path: /software/sapfiles ## This directory path should include these files: ## - igs*sar ## - igshelper*sar @@ -165,6 +165,10 @@ sap_swpm_software_path: ## - IMDB_CLIENT*SAR ## - SAPHOSTAGENT*SAR +# Directory in which a sapinst inifile which is to be used by the role can be stored: +sap_swpm_inifile_directory: "{{ sap_swpm_software_path }}/inifiles" +#sap_swpm_local_inifile_directory: '/tmp/inifiles' + # SWPM1 - paths that this role will look for CD Media software sap_swpm_cd_export_pt1_path: sap_swpm_cd_export_pt2_path: diff --git a/roles/sap_swpm/tasks/main.yml b/roles/sap_swpm/tasks/main.yml index aa784ef91..a35c3967d 100644 --- a/roles/sap_swpm/tasks/main.yml +++ b/roles/sap_swpm/tasks/main.yml @@ -9,8 +9,10 @@ - name: SAP SWPM - run swpm ansible.builtin.import_tasks: swpm.yml + when: sap_swpm_run_sapinst tags: - sap_swpm_install - name: SAP SWPM - run postinstall task ansible.builtin.import_tasks: post_install.yml + when: sap_swpm_run_sapinst diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index cdafb3b0f..1f330fb3e 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -1,6 +1,12 @@ # SPDX-License-Identifier: Apache-2.0 --- +- name: SAP SWPM Pre Install - Rename variables + ansible.builtin.set_fact: + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list) }}" + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary | d(sap_swpm_inifile_parameters_dict) }}" + tags: always + ################ # Run Preinstallation Steps Based on Run Mode ################ @@ -11,23 +17,6 @@ - sap_swpm_generate_inifile - sap_swpm_sapinst_commandline -################ -# Set sapinst command -################ - -- name: SAP SWPM Pre Install - Set sapinst command - vars: - sap_swpm_swpm_command_guiserver: "{{ 'SAPINST_START_GUISERVER=false' if not sap_swpm_swpm_observer_mode else '' }}" - sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user is defined and sap_swpm_swpm_remote_access_user | length > 0 else '' }}" - ansible.builtin.set_fact: - sap_swpm_swpm_command_inifile: "SAPINST_INPUT_PARAMETERS_URL={{ sap_swpm_tmpdir.path }}/inifile.params" - 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 }} + '/' (if needed) + {{ sap_swpm_mp_stack_file_name }}" - sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true {{ sap_swpm_swpm_command_guiserver }} {{ sap_swpm_swpm_command_observer }} {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}" - tags: sap_swpm_sapinst_commandline - ################ # Pre Install Optional Tasks ################ @@ -39,7 +28,9 @@ file: pre_install/firewall.yml apply: tags: sap_swpm_setup_firewall - when: "sap_swpm_setup_firewall | bool" + when: + - sap_swpm_run_sapinst + - "sap_swpm_setup_firewall | bool" tags: sap_swpm_setup_firewall # /etc/hosts @@ -49,7 +40,9 @@ file: pre_install/update_etchosts.yml apply: tags: sap_swpm_update_etchosts - when: "sap_swpm_update_etchosts | bool" + when: + - sap_swpm_run_sapinst + - "sap_swpm_update_etchosts | bool" tags: sap_swpm_update_etchosts ################ @@ -81,3 +74,32 @@ - ' The installation can take up to 3 hours. Run the following command as root' - ' on {{ ansible_hostname }} to display the installation logs:' - ' # tail -f $(cat /tmp/sapinst_instdir/.lastInstallationLocation)/sapinst.log' + +################ +# Set sapinst command +################ + +- name: SAP SWPM Pre Install - Set the sapinst command parameters + vars: + sap_swpm_swpm_command_guiserver: "{{ 'SAPINST_START_GUISERVER=false' if not sap_swpm_swpm_observer_mode else '' }}" + sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user is defined and sap_swpm_swpm_remote_access_user | length > 0 else '' }}" + ansible.builtin.set_fact: + sap_swpm_swpm_command_inifile: "SAPINST_INPUT_PARAMETERS_URL={{ sap_swpm_tmpdir.path }}/inifile.params" + 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 }} + '/' (if needed) + {{ sap_swpm_mp_stack_file_name }}" + sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true {{ sap_swpm_swpm_command_guiserver }} {{ sap_swpm_swpm_command_observer }} {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}" + tags: sap_swpm_sapinst_commandline + +- name: Set fact for the sapinst command line + ansible.builtin.set_fact: + __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | d('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} + {{ sap_swpm_swpm_command_product_id }} + {{ sap_swpm_swpm_command_extra_args }}" + tags: sap_swpm_sapinst_commandline + +- name: Display the sapinst command line + ansible.builtin.debug: + msg: "SAP SWPM install command: '{{ __sap_swpm_sapinst_command }}'" + tags: sap_swpm_sapinst_commandline diff --git a/roles/sap_swpm/tasks/pre_install/install_type.yml b/roles/sap_swpm/tasks/pre_install/install_type.yml index ced5bbc98..10936a31c 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type.yml @@ -4,7 +4,7 @@ - name: SAP SWPM Pre Install - Determine Installation Type ansible.builtin.set_fact: sap_swpm_swpm_installation_type: "" - sap_swpm_swpm_installation_header: "" + sap_swpm_swpm_installation_header: "Standard installation of SAP Software" sap_swpm_swpm_command_virtual_hostname: "" sap_swpm_swpm_command_mp_stack: "" @@ -60,7 +60,8 @@ - name: SAP SWPM Pre Install - Display the Installation Type ansible.builtin.debug: - var: sap_swpm_swpm_installation_type + msg: "The Installation Type is: '{{ sap_swpm_swpm_installation_type }}'" + when: "sap_swpm_swpm_installation_type | length > 0" - name: SAP SWPM Pre Install - Run Installation Type Steps ansible.builtin.include_tasks: "install_type/{{ sap_swpm_swpm_installation_type }}_install.yml" diff --git a/roles/sap_swpm/tasks/pre_install/password_facts.yml b/roles/sap_swpm/tasks/pre_install/password_facts.yml deleted file mode 100644 index 850283d88..000000000 --- a/roles/sap_swpm/tasks/pre_install/password_facts.yml +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -- name: SAP SWPM Pre Install - Set password facts when ABAP - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" - when: - - "'ABAP' in sap_swpm_product_catalog_id" - -- name: SAP SWPM Pre Install - Set password facts when Java - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" - when: - - "'Java' in sap_swpm_product_catalog_id" - -- name: SAP SWPM Pre Install - Set other user passwords using master password - ansible.builtin.set_fact: - sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 462587505..d9d0bd4eb 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -23,17 +23,19 @@ ### Async method -- name: Set fact for the sapinst command line - ansible.builtin.set_fact: - __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | d('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} - {{ sap_swpm_swpm_command_product_id }} - {{ sap_swpm_swpm_command_extra_args }}" - tags: sap_swpm_sapinst_commandline - -- name: Display the sapinst command line - ansible.builtin.debug: - msg: "SAP SWPM install command: '{{ __sap_swpm_sapinst_command }}'" - tags: sap_swpm_sapinst_commandline +# now in file pre_install.yml: +#- name: Set fact for the sapinst command line +# ansible.builtin.set_fact: +# __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | d('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} +# {{ sap_swpm_swpm_command_product_id }} +# {{ sap_swpm_swpm_command_extra_args }}" +# tags: sap_swpm_sapinst_commandline + +# now in file pre_install.yml: +#- name: Display the sapinst command line +# ansible.builtin.debug: +# msg: "SAP SWPM install command: '{{ __sap_swpm_sapinst_command }}'" +# tags: sap_swpm_sapinst_commandline # Call sapinst synchronously # Reason for noqa: This command installs software, so it will change things diff --git a/roles/sap_swpm/tasks/swpm/detect_variables.yml b/roles/sap_swpm/tasks/swpm/detect_variables.yml index 557c988ad..ce9dc4794 100644 --- a/roles/sap_swpm/tasks/swpm/detect_variables.yml +++ b/roles/sap_swpm/tasks/swpm/detect_variables.yml @@ -6,7 +6,8 @@ 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 + END{print product_id}' {{ sap_swpm_tmpdir_local.path }}/inifile.params + delegate_to: localhost register: sap_swpm_inifile_product_id_detect changed_when: false when: not sap_swpm_product_catalog_id is defined @@ -25,7 +26,8 @@ # Detect Software Path - name: SAP SWPM - Detect Software Path ansible.builtin.command: | - awk '!/^#/&&/archives.downloadBasket/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params + awk '!/^#/&&/archives.downloadBasket/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params + delegate_to: localhost register: sap_swpm_inifile_software_path changed_when: false when: not sap_swpm_software_path is defined @@ -44,7 +46,8 @@ # Detect SID - name: SAP SWPM - Detect SID ansible.builtin.command: | - awk '!/^#/&&/NW_GetSidNoProfiles.sid/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params + awk '!/^#/&&/NW_GetSidNoProfiles.sid/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params + delegate_to: localhost register: sap_swpm_inifile_sid changed_when: false when: not sap_swpm_sid is defined @@ -63,7 +66,8 @@ # Detect FQDN - name: SAP SWPM - Detect FQDN ansible.builtin.command: | - awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir.path }}/inifile.params + awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params + delegate_to: localhost register: sap_swpm_inifile_fqdn changed_when: false when: not sap_swpm_fqdn is defined diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml new file mode 100644 index 000000000..81414b65e --- /dev/null +++ b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml @@ -0,0 +1,163 @@ +# SPDX-License-Identifier: Apache-2.0 +--- + +# Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... +- name: SAP SWPM default mode - Determine Installation Type + ansible.builtin.include_tasks: + file: ../pre_install/install_type.yml + apply: + tags: sap_swpm_generate_inifile + tags: sap_swpm_generate_inifile + +# Password Facts +- name: SAP SWPM Pre Install - Set password facts when ABAP + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" + when: "'ABAP' in sap_swpm_product_catalog_id" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Set password facts when Java + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" + when: "'Java' in sap_swpm_product_catalog_id" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Set other user passwords using master password + ansible.builtin.set_fact: + sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists + ansible.builtin.file: + path: "{{ sap_swpm_inifile_directory }}" + state: directory + owner: 'root' + group: 'root' + mode: '0755' + +- name: SAP SWPM Pre Install - Check if file '{{ sap_swpm_inifile_directory }}/inifile.params' exists + ansible.builtin.stat: + path: "{{ sap_swpm_inifile_directory }}/inifile.params" + check_mode: no + register: __sap_swpm_register_stat_sapinst_inifile + +- name: SAP SWPM Pre Install - Notify about existing sapinst inifile + ansible.builtin.debug: + msg: "INFO: Using existing sapinst inifile '{{ sap_swpm_inifile_directory }}/inifile.params'." + when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + +- name: SAP SWPM Pre Install - Slurp the remote 'inifile.params' for copying to managed node + ansible.builtin.slurp: + src: "{{ sap_swpm_inifile_directory }}/inifile.params" + register: sap_swpm_slurped_remote_inifile + when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + +- name: SAP SWPM Pre Install - Copy 'inifile.params' to the control node + ansible.builtin.copy: + content: "{{ sap_swpm_slurped_remote_inifile['content'] | b64decode }}" + dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + owner: 'root' + group: 'root' + mode: '0640' + delegate_to: localhost + when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + +# Note: Attempting to fetch and store into sap_swpm_tmpdir_local.path results in a 'Permission denied' error. +#- name: SAP SWPM Pre Install - Download existing sapinst inifile to '{{ sap_swpm_local_inifile_directory }}' +# ansible.builtin.fetch: +# src: "{{ sap_swpm_inifile_directory }}/inifile.params" +# dest: "{{ sap_swpm_tmpdir_local.path }}/" +## dest: "{{ sap_swpm_local_inifile_directory }}/" +# flat: true +# become: true +# when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + +#- name: SAP SWPM Pre Install - Copy sapinst inifile to '{{ sap_swpm_tmpdir_local.path }}' +# ansible.builtin.copy: +# src: "{{ sap_swpm_local_inifile_directory }}/inifile.params" +# dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" +# delegate_to: localhost +# when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + +- name: SAP SWPM Pre Install - Create the SWPM inifile 'inifile.params' dynamically + when: + - not __sap_swpm_register_stat_sapinst_inifile.stat.exists + block: + +# Generate inifile.params, step 1: Process SWPM Configfile template locally for creating inifile.params + - name: SAP SWPM Pre Install - Process SWPM inifile template for for creating 'inifile.params' + ansible.builtin.template: + src: "{{ role_path }}/templates/inifile_params.j2" + dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + owner: 'root' + group: 'root' + mode: '0640' + delegate_to: localhost + when: + - sap_swpm_inifile_sections_list is defined + - sap_swpm_inifile_sections_list | length > 0 + tags: sap_swpm_generate_inifile + +# Generate inifile.params, step 2: Use any entries from sap_swpm_inifile_parameters_dict + - name: SAP SWPM Pre Install - Replace existing, or add missing, any inifile.params entries from sap_swpm_inifile_parameters_dict + ansible.builtin.lineinfile: + path: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + create: true + state: present + line: "{{ sap_swpm_line_item.key }} = {{ sap_swpm_line_item.value }}" + regexp: "^{{ sap_swpm_line_item.key }}[\\s]*=[\\s]*.*" + owner: 'root' + group: 'root' + mode: '0640' + loop: "{{ sap_swpm_inifile_parameters_dict | dict2items }}" + loop_control: + loop_var: sap_swpm_line_item + register: replace_result + delegate_to: localhost + when: + - sap_swpm_inifile_parameters_dict is defined + - sap_swpm_inifile_parameters_dict | length > 0 + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Display the path of the local 'inifile.params' + ansible.builtin.debug: + msg: "The local inifile.params is: '{{ sap_swpm_tmpdir_local.path }}/inifile.params'" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Detect Variables + ansible.builtin.include_tasks: + file: detect_variables.yml + apply: + tags: sap_swpm_generate_inifile + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Slurp the local 'inifile.params' for copying to managed node + ansible.builtin.slurp: + src: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + register: sap_swpm_slurped_local_inifile + delegate_to: localhost + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Copy 'inifile.params' to the managed node + ansible.builtin.copy: + content: "{{ sap_swpm_slurped_local_inifile['content'] | b64decode }}" + dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" + owner: 'root' + group: 'root' + mode: '0640' + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Display the path of the remote 'inifile.params' + ansible.builtin.debug: + msg: "The local inifile.params has been copied to: '{{ sap_swpm_tmpdir.path }}/inifile.params'" + tags: sap_swpm_generate_inifile + +# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) +# Prepare Software +- name: SAP SWPM advanced mode - Prepare Software + ansible.builtin.include_tasks: prepare_software.yml + when: sap_swpm_run_sapinst diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced.yml deleted file mode 100644 index 234dfb5db..000000000 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced.yml +++ /dev/null @@ -1,35 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Remove Existing inifile.params -- name: SAP SWPM advanced mode - Ensure 'inifile.params' exists - ansible.builtin.copy: - dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" - mode: '0640' - content: | - ### inifile.params generated for SWPM Catalog Product ID is {{ sap_swpm_product_catalog_id }} - tags: sap_swpm_generate_inifile - -- name: SAP SWPM advanced mode - Loop over the dictionary and output to file - ansible.builtin.lineinfile: - path: "{{ sap_swpm_tmpdir.path }}/inifile.params" - state: present - insertafter: EOF - line: "{{ item.key }} = {{ item.value }}" - with_dict: "{{ sap_swpm_inifile_custom_values_dictionary }}" - tags: sap_swpm_generate_inifile - -# NOTE: Values in Dictionary Keys for instance numbers must be string using '01' single quote, otherwise SAP SWPM will crash - -# Detect variables from generated inifile -- name: SAP SWPM advanced mode - Detect Variables - ansible.builtin.include_tasks: - file: detect_variables.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) -# Prepare Software -- name: SAP SWPM advanced mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced_templates.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced_templates.yml deleted file mode 100644 index b6685e343..000000000 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_advanced_templates.yml +++ /dev/null @@ -1,64 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Set facts based on the install dictionary -- name: SAP SWPM advanced_templates mode - Set product_catalog_id - ansible.builtin.set_fact: - sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM advanced_templates mode - Create temporary directory - ansible.builtin.tempfile: - state: directory - suffix: swpmconfig - register: sap_swpm_tmpdir - tags: sap_swpm_generate_inifile - -# Remove Existing inifile.params -- name: SAP SWPM advanced_templates mode - Ensure 'inifile.params' exists - ansible.builtin.copy: - dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" - mode: '0640' - content: | - ### inifile.params generated for SWPM Catalog Product ID is {{ sap_swpm_product_catalog_id }} - tags: sap_swpm_generate_inifile - -- name: SAP SWPM advanced_templates mode - Loop over the dictionary and output to file - ansible.builtin.lineinfile: - path: "{{ sap_swpm_tmpdir.path }}/inifile.params" - state: present - insertafter: EOF - line: "{{ item.key }} = {{ item.value }}" - with_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] }}" - tags: sap_swpm_generate_inifile - -# NOTE: Values in Dictionary Keys for instance numbers must be string using '01' single quote, otherwise SAP SWPM will crash - - -# Detect variables from generated inifile -- name: SAP SWPM advanced_templates mode - Detect Variables - ansible.builtin.include_tasks: - file: detect_variables.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) -# Prepare Software -- name: SAP SWPM advanced_templates mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml - -# ALT: Generate complete inifile.params with all parameters from control.xml, for every SAP software product -#- name: ALT: SAP SWPM advanced_templates mode - Generate complete inifile.params -# script: ./plugins/module_utils/swpm2_parameters_inifile_generate.py '/path/to/controlxml/' -# args: -# executable: /bin/python3 - -# ALT: Replace values of generated inifile with custom values -#- name: ALT: SAP SWPM advanced_templates mode - Replace values of generated inifile with custom values -# replace: -# path: "{{ sap_swpm_tmpdir.path }}/inifile.params" -# regexp: '^{{ item.key }}.*$' -# replace: '{{ item.key }}={{ item.value }}' -# backup: yes -# with_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] }}" diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default.yml deleted file mode 100644 index b04362cb6..000000000 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default.yml +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Determine Installation Type -- name: SAP SWPM default mode - Determine Installation Type - ansible.builtin.include_tasks: - file: ../pre_install/install_type.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Password Facts -- name: SAP SWPM default mode - Password Facts - ansible.builtin.include_tasks: - file: ../pre_install/password_facts.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Prepare Software -- name: SAP SWPM default mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml - -# Process SWPM Configfile Template -- name: SAP SWPM default mode - Process SWPM Configfile Template - ansible.builtin.template: - src: "{{ role_path }}/templates/configfile.j2" - dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" - mode: '0640' - register: sap_swpm_cftemplate - tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default_templates.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default_templates.yml deleted file mode 100644 index b51706218..000000000 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_default_templates.yml +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Set facts based on the install dictionary -- name: SAP SWPM default_templates mode - Set product_catalog_id and inifile_list - ansible.builtin.set_fact: - sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" - sap_swpm_inifile_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] }}" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM default_templates mode - Set product_catalog_id and inifile_list - ansible.builtin.set_fact: - sap_swpm_java_template_id_selected_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_java_template_id_selected_list'] }}" - when: "'java' in sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] | lower" - tags: sap_swpm_generate_inifile - -# Reason for noqa: We want to define variable names based on what is in the dictionary. -- name: SAP SWPM default_templates mode - If not already defined, use the default variable for the template # noqa var-naming[no-jinja] - ansible.builtin.set_fact: - "{{ item.key }}": "{{ item.value }}" - with_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] }}" - tags: sap_swpm_generate_inifile - -# Determine Installation Type -- name: SAP SWPM default_templates mode - Determine Installation Type - ansible.builtin.include_tasks: - file: ../pre_install/install_type.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Password Facts -- name: SAP SWPM default_templates mode - Password Facts - ansible.builtin.include_tasks: - file: ../pre_install/password_facts.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Prepare Software -- name: SAP SWPM default_templates mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml - -# Process SWPM Configfile Template -- name: SAP SWPM default_templates mode - Process SWPM Configfile Template - ansible.builtin.template: - src: "{{ role_path }}/templates/configfile.j2" - dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" - mode: '0640' - register: sap_swpm_cftemplate - tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml b/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml index 360df233f..8664f9dbd 100644 --- a/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml +++ b/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml @@ -1,11 +1,30 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Create temporary directory -- name: SAP SWPM Pre Install - Create temporary directory +- name: SAP SWPM Pre Install - Create temporary directory on control node ansible.builtin.tempfile: state: directory - suffix: swpmconfig + suffix: _swpm_tmp + delegate_to: localhost + register: sap_swpm_tmpdir_local + tags: + - sap_swpm_generate_inifile + - sap_swpm_sapinst_commandline + +- name: SAP SWPM Pre Install - Make the temporary directory on control node world readable + ansible.builtin.file: + path: "{{ sap_swpm_tmpdir_local.path }}" + state: directory + mode: '0777' + delegate_to: localhost + tags: + - sap_swpm_generate_inifile + - sap_swpm_sapinst_commandline + +- name: SAP SWPM Pre Install - Create temporary directory on managed node + ansible.builtin.tempfile: + state: directory + suffix: _swpm_config register: sap_swpm_tmpdir tags: - sap_swpm_generate_inifile @@ -21,21 +40,25 @@ when: sap_swpm_use_password_file == "y" tags: sap_swpm_generate_inifile -# Run SWPM inifile generation based on ansible role mode -- name: SAP SWPM Pre Install - generate swpm inifile - ansible.builtin.include_tasks: "swpm_inifile_generate_{{ sap_swpm_ansible_role_mode }}.yml" +# Create the SWPM inifile +## Run SWPM inifile generation based on ansible role mode +- name: SAP SWPM Pre Install - Generate the SWPM inifile + ansible.builtin.include_tasks: "swpm_inifile_generate.yml" +# ansible.builtin.include_tasks: "swpm_inifile_generate_{{ sap_swpm_ansible_role_mode }}.yml" tags: sap_swpm_generate_inifile -- name: SAP SWPM Pre Install - Display the location of file 'inifile.params' - ansible.builtin.debug: - msg: "{{ sap_swpm_tmpdir.path }}/inifile.params" - tags: sap_swpm_generate_inifile +#- name: SAP SWPM Pre Install - Display the location of file 'inifile.params' +# ansible.builtin.debug: +# msg: "/tmp/inifile.params" +# msg: "{{ sap_swpm_tmpdir.path }}/inifile.params" +# tags: sap_swpm_generate_inifile # Set fact for SWPM path - name: SAP SWPM Pre Install - Set fact for SWPM path when extract directory defined ansible.builtin.set_fact: sap_swpm_sapinst_path: "{{ sap_swpm_software_extract_directory }}" when: + - sap_swpm_run_sapinst - sap_swpm_software_extract_directory is defined - not (sap_swpm_software_extract_directory is none or (sap_swpm_software_extract_directory | length == 0)) @@ -44,6 +67,7 @@ ansible.builtin.set_fact: sap_swpm_sapinst_path: "{{ (sap_swpm_swpm_path | regex_replace('\\/$', '')) + '/extracted' }}" when: + - sap_swpm_run_sapinst - sap_swpm_software_extract_directory is undefined or (sap_swpm_software_extract_directory is none or (sap_swpm_software_extract_directory | length) == 0) - name: SAP SWPM Pre Install - Ensure directory '{{ sap_swpm_sapinst_path }}' exists @@ -51,6 +75,7 @@ path: "{{ sap_swpm_sapinst_path }}" state: directory mode: '0755' + when: sap_swpm_run_sapinst # Extract SWPM - name: SAP SWPM Pre Install - Extract SWPM @@ -62,3 +87,4 @@ args: chdir: "{{ sap_swpm_sapinst_path }}" changed_when: "'SAPCAR: processing archive' in sap_swpm_extractswpm.stdout" + when: sap_swpm_run_sapinst diff --git a/roles/sap_swpm/templates/configfile.j2 b/roles/sap_swpm/templates/inifile_params.j2 similarity index 90% rename from roles/sap_swpm/templates/configfile.j2 rename to roles/sap_swpm/templates/inifile_params.j2 index e71291e11..a5797e4c0 100644 --- a/roles/sap_swpm/templates/configfile.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -1,6 +1,6 @@ ### inifile.params generated for SWPM Catalog Product ID is {{ sap_swpm_product_catalog_id }} -{% if 'swpm_installation_media' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media ###### @@ -11,14 +11,14 @@ archives.downloadBasket = {{ sap_swpm_software_path }} # NOTE: Specific media requirements will use format # SAPINST.CD.PACKAGE. = {% endif %} -{% if 'swpm_installation_media_swpm2_hana' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm2_hana' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm2_hana ###### HDB_Software_Dialogs.useMediaCD = {{ sap_swpm_software_use_media }} {% endif %} -{% if 'swpm_installation_media_swpm1' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1 @@ -36,7 +36,7 @@ SAPINST.CD.PACKAGE.RDBMS = {{ sap_swpm_cd_rdbms_path }} # SAPINST.CD.PACKAGE.J2EE-INST = /path/JAVA_J2EE_OSINDEP_J2EE_INST # SAPINST.CD.PACKAGE.SCA = /path/JAVA_J2EE_OSINDEP_UT {% endif %} -{% if 'swpm_installation_media_swpm1_exportfiles' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_exportfiles' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_exportfiles @@ -47,7 +47,7 @@ SAPINST.CD.PACKAGE.LOAD1 = {{ sap_swpm_cd_export_pt1_path }} SAPINST.CD.PACKAGE.LOAD2 = {{ sap_swpm_cd_export_pt2_path }} # SAPINST.CD.PACKAGE.JMIG = {% endif %} -{% if 'swpm_installation_media_swpm1_ibmdb2' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_ibmdb2' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_ibmdb2 @@ -61,7 +61,7 @@ SAPINST.CD.PACKAGE.DB2CLIENT = {{ sap_swpm_cd_ibmdb2_client_path }} # IBM DB2 software unpack path e.g. /db2/db2x01/db2_software db6.DB2SoftwarePath = {{ sap_swpm_ibmdb2_unpack_path }} {% endif %} -{% if 'swpm_installation_media_swpm1_oracledb_121' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_oracledb_121' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_oracledb_121 @@ -72,7 +72,7 @@ SAPINST.CD.PACKAGE.RDBMS-ORA121 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI121 = {{ sap_swpm_cd_oracle_client_path }} {% endif %} -{% if 'swpm_installation_media_swpm1_oracledb_122' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_oracledb_122' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_oracledb_122 @@ -83,7 +83,7 @@ SAPINST.CD.PACKAGE.RDBMS-ORA122 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI122 = {{ sap_swpm_cd_oracle_client_path }} {% endif %} -{% if 'swpm_installation_media_swpm1_oracledb_19' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_oracledb_19' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_oracledb_19 @@ -94,7 +94,7 @@ SAPINST.CD.PACKAGE.RDBMS-ORA19 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI19 = {{ sap_swpm_cd_oracle_client_path }} {% endif %} -{% if 'swpm_installation_media_swpm1_sapase' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_sapase' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_sapase @@ -104,7 +104,7 @@ SAPINST.CD.PACKAGE.RDBMS-SYB = {{ sap_swpm_cd_sapase_path }} SAPINST.CD.PACKAGE.RDBMS-SYB-CLIENT = {{ sap_swpm_cd_sapase_client_path }} {% endif %} -{% if 'swpm_installation_media_swpm1_sapmaxdb' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_swpm1_sapmaxdb' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_swpm1_sapmaxdb @@ -112,7 +112,7 @@ SAPINST.CD.PACKAGE.RDBMS-SYB-CLIENT = {{ sap_swpm_cd_sapase_client_path }} # Requested package : RDBMS-ADA SAPINST.CD.PACKAGE.RDBMS-ADA = {{ sap_swpm_cd_sapmaxdb_path }} {% endif %} -{% if 'maintenance_plan_stack_tms_config' in sap_swpm_inifile_list %} +{% if 'maintenance_plan_stack_tms_config' in sap_swpm_inifile_sections_list %} ###### # maintenance_plan_stack_tms_config @@ -120,7 +120,7 @@ SAPINST.CD.PACKAGE.RDBMS-ADA = {{ sap_swpm_cd_sapmaxdb_path }} NW_ABAP_TMSConfig.configureTMS = {{ sap_swpm_configure_tms | lower }} NW_ABAP_TMSConfig.transportPassword = {{ sap_swpm_tmsadm_password }} {% endif %} -{% if 'maintenance_plan_stack_tms_transports' in sap_swpm_inifile_list %} +{% if 'maintenance_plan_stack_tms_transports' in sap_swpm_inifile_sections_list %} ###### # maintenance_plan_stack_tms_transports @@ -128,7 +128,7 @@ NW_ABAP_TMSConfig.transportPassword = {{ sap_swpm_tmsadm_password }} NW_ABAP_Include_Corrections.includeTransports = true NW_ABAP_Include_Corrections.transportFilesLocations = {{ sap_swpm_tms_tr_files_path }} {% endif %} -{% if 'maintenance_plan_stack_spam_config' in sap_swpm_inifile_list %} +{% if 'maintenance_plan_stack_spam_config' in sap_swpm_inifile_sections_list %} ###### # maintenance_plan_stack_spam_config @@ -140,7 +140,7 @@ NW_ABAP_SPAM_Update.SPAMUpdateArchive = {{ sap_swpm_spam_update_sar }} #NW_ABAP_SPAM_Update.SPAMUpdateArchive = {% endif %} {% endif %} -{% if 'maintenance_plan_stack_sum_config' in sap_swpm_inifile_list %} +{% if 'maintenance_plan_stack_sum_config' in sap_swpm_inifile_sections_list %} ###### # maintenance_plan_stack_sum_config @@ -151,7 +151,7 @@ NW_ABAP_Prepare_SUM.startSUM = {{ sap_swpm_sum_start | lower }} # Password for SUM must be for 'adm' user NW_ABAP_Prepare_SUM.Password = {{ sap_swpm_sap_sidadm_password }} {% endif %} -{% if 'maintenance_plan_stack_sum_10_batch_mode' in sap_swpm_inifile_list %} +{% if 'maintenance_plan_stack_sum_10_batch_mode' in sap_swpm_inifile_sections_list %} ###### # maintenance_plan_stack_sum_10_batch_mode @@ -159,7 +159,7 @@ NW_ABAP_Prepare_SUM.Password = {{ sap_swpm_sap_sidadm_password }} # Re-run of existing BatchModeInputFile.xml for NWAS JAVA (generated by SUM 1.0 on previous host into the /sdt/param/ subdirectory) NW_ABAP_Prepare_SUM.SUMBatchFile = {{ sap_swpm_sum_batch_file }} {% endif %} -{% if 'credentials' in sap_swpm_inifile_list %} +{% if 'credentials' in sap_swpm_inifile_sections_list %} ###### # credentials @@ -175,7 +175,7 @@ DiagnosticsAgent.dasidAdmPassword = {{ sap_swpm_diagnostics_agent_password }} # 'sapadm' user of the SAP Host Agent hostAgent.sapAdmPassword = {{ sap_swpm_sapadm_password }} {% endif %} -{% if 'credentials_hana' in sap_swpm_inifile_list %} +{% if 'credentials_hana' in sap_swpm_inifile_sections_list %} ###### # credentials_hana @@ -183,7 +183,7 @@ hostAgent.sapAdmPassword = {{ sap_swpm_sapadm_password }} HDB_Schema_Check_Dialogs.schemaPassword = {{ sap_swpm_db_schema_password }} storageBasedCopy.hdb.systemPassword = {{ sap_swpm_db_system_password }} {% endif %} -{% if 'credentials_anydb_ibmdb2' in sap_swpm_inifile_list %} +{% if 'credentials_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} ###### # credentials_anydb_ibmdb2 @@ -191,7 +191,7 @@ storageBasedCopy.hdb.systemPassword = {{ sap_swpm_db_system_password }} nwUsers.db6.db2sidPassword = {{ sap_swpm_sap_sidadm_password }} # nwUsers.db6.db2sidUid = {% endif %} -{% if 'credentials_anydb_oracledb' in sap_swpm_inifile_list %} +{% if 'credentials_anydb_oracledb' in sap_swpm_inifile_sections_list %} ###### # credentials_anydb_oracledb @@ -208,7 +208,7 @@ ora.SysPassword = {{ sap_swpm_db_system_password }} # Oracle 'SYSTEM' password ora.SystemPassword = {{ sap_swpm_db_system_password }} {% endif %} -{% if 'credentials_anydb_sapase' in sap_swpm_inifile_list %} +{% if 'credentials_anydb_sapase' in sap_swpm_inifile_sections_list %} ###### # credentials_anydb_sapase @@ -222,7 +222,7 @@ SYB.NW_DB.sapsr3db_pass = {{ sap_swpm_db_system_password }} # SYB.NW_DB.sapsso_pass = # SYB.NW_DB.sslPassword = {% endif %} -{% if 'credentials_anydb_sapmaxdb' in sap_swpm_inifile_list %} +{% if 'credentials_anydb_sapmaxdb' in sap_swpm_inifile_sections_list %} ###### # credentials_anydb_sapmaxdb @@ -234,7 +234,7 @@ Sdb_DBUser.dbaPassword = {{ sap_swpm_db_system_password }} Sdb_DBUser.dbmPassword = {{ sap_swpm_db_system_password }} Sdb_Schema_Dialogs.dbSchemaPassword = {{ sap_swpm_db_schema_password }} {% endif %} -{% if 'credentials_nwas_ssfs' in sap_swpm_inifile_list %} +{% if 'credentials_nwas_ssfs' in sap_swpm_inifile_sections_list %} ###### # credentials_nwas_ssfs @@ -242,7 +242,7 @@ Sdb_Schema_Dialogs.dbSchemaPassword = {{ sap_swpm_db_schema_password }} HDB_Userstore.useABAPSSFS = true # NW_ABAP_SSFS_CustomKey.ssfsKeyInputFile = {% endif %} -{% if 'credentials_hdbuserstore' in sap_swpm_inifile_list %} +{% if 'credentials_hdbuserstore' in sap_swpm_inifile_sections_list %} ###### # credentials_hdbuserstore @@ -254,7 +254,7 @@ HDB_Userstore.useABAPSSFS = false # NW_HDB_DBClient.checkCreateUserstore = true # NW_HDB_DBClient.clientPathStrategy = LOCAL {% endif %} -{% if 'credentials_syscopy' in sap_swpm_inifile_list %} +{% if 'credentials_syscopy' in sap_swpm_inifile_sections_list %} ###### # credentials_syscopy @@ -264,14 +264,14 @@ NW_DDIC_Password.needDDICPasswords = true NW_DDIC_Password.ddic000Password = {{ sap_swpm_ddic_000_password }} #NW_DDIC_Password.ddic001Password = {% endif %} -{% if 'db_config_hana' in sap_swpm_inifile_list %} +{% if 'db_config_hana' in sap_swpm_inifile_sections_list %} ###### # db_config_hana ###### storageBasedCopy.hdb.instanceNumber = {{ sap_swpm_db_instance_nr }} HDB_Schema_Check_Dialogs.schemaName = {{ sap_swpm_db_schema }} -{% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_list %} +{% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_sections_list %} HDB_Schema_Check_Dialogs.validateSchemaName = true {% else %} @@ -281,14 +281,14 @@ HDB_Schema_Check_Dialogs.validateSchemaName = false # HDB_Schema_Check_Dialogs.dropSchema = false # hdb.create.dbacockpit.user = false {% endif %} -{% if 'db_config_anydb_all' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_all' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_all ###### NW_ABAP_Import_Dialog.dbCodepage = 4103 {% endif %} -{% if 'db_config_anydb_ibmdb2' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_ibmdb2 @@ -317,7 +317,7 @@ storageBasedCopy.db6.CommunicationPortNumber = 5912 storageBasedCopy.db6.PortRangeEnd = 5917 storageBasedCopy.db6.PortRangeStart = 5914 {% endif %} -{% if 'db_config_anydb_oracledb' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_oracledb' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_oracledb @@ -345,7 +345,7 @@ ora.whatInstallation = isSingle ## CDB_ONLY: install CDB only. ora.multitenant.installMT = FALSE {% endif %} -{% if 'db_config_anydb_oracledb_121' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_oracledb_121' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_oracledb_121 @@ -355,7 +355,7 @@ ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/121 storageBasedCopy.ora.clientVersion = 121 storageBasedCopy.ora.serverVersion = 121 {% endif %} -{% if 'db_config_anydb_oracledb_122' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_oracledb_122' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_oracledb_122 @@ -365,7 +365,7 @@ ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/122 storageBasedCopy.ora.clientVersion = 122 storageBasedCopy.ora.serverVersion = 122 {% endif %} -{% if 'db_config_anydb_oracledb_19' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_oracledb_19' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_oracledb_19 @@ -375,7 +375,7 @@ ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/19 storageBasedCopy.ora.clientVersion = 19 storageBasedCopy.ora.serverVersion = 19 {% endif %} -{% if 'db_config_anydb_sapase' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_sapase' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_sapase @@ -412,7 +412,7 @@ SYB.NW_DB.portBackupServer = SYB.NW_DB.portJobScheduler = SYB.NW_DB.portXPServer = {% endif %} -{% if 'db_config_anydb_sapmaxdb' in sap_swpm_inifile_list %} +{% if 'db_config_anydb_sapmaxdb' in sap_swpm_inifile_sections_list %} ###### # db_config_anydb_sapmaxdb @@ -425,7 +425,7 @@ SdbInstanceDialogs.minlogsize = 4000 SdbInstanceDialogs.sapdataFolder = sapdata SdbInstanceDialogs.saplogFolder = saplog {% endif %} -{% if 'db_connection_nw_hana' in sap_swpm_inifile_list %} +{% if 'db_connection_nw_hana' in sap_swpm_inifile_sections_list %} ###### # db_connection_nw_hana @@ -450,7 +450,7 @@ NW_Recovery_Install_HDB.sidAdmPassword = {{ sap_swpm_db_sidadm_password }} # NW_HDB_getDBInfo.tenantOsUser = {{ sap_swpm_db_sid | lower }}usr # NW_HDB_getDBInfo.tenantPort = {% endif %} -{% if 'db_connection_nw_anydb_ibmdb2' in sap_swpm_inifile_list %} +{% if 'db_connection_nw_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} ###### # db_connection_nw_anydb_ibmdb2 @@ -468,7 +468,7 @@ NW_DB6_DB.db6.abap.schema = sap{{ sap_swpm_sid | lower }} # NW_DB6_DB.db6.java.connect.user = # NW_DB6_DB.db6.java.schema = {% endif %} -{% if 'db_connection_nw_anydb_oracledb' in sap_swpm_inifile_list %} +{% if 'db_connection_nw_anydb_oracledb' in sap_swpm_inifile_sections_list %} ###### # db_connection_nw_anydb_oracledb @@ -476,14 +476,14 @@ NW_DB6_DB.db6.abap.schema = sap{{ sap_swpm_sid | lower }} storageBasedCopy.abapSchemaPassword = {{ sap_swpm_db_schema_abap_password }} storageBasedCopy.javaSchemaPassword = {{ sap_swpm_db_schema_java_password }} {% endif %} -{% if 'db_connection_nw_anydb_sapase' in sap_swpm_inifile_list %} +{% if 'db_connection_nw_anydb_sapase' in sap_swpm_inifile_sections_list %} ###### # db_connection_nw_anydb_sapase ###### # NW_SYB_CIABAP.sapsaPassword = {% endif %} -{% if 'db_restore_hana' in sap_swpm_inifile_list %} +{% if 'db_restore_hana' in sap_swpm_inifile_sections_list %} ###### # db_restore_hana @@ -506,7 +506,7 @@ HDB_Recovery_Dialogs.sidAdmPassword = {{ sap_swpm_db_sidadm_password }} # HDB_System_Check_Dialogs.initTopology = false # NW_CreateDBandLoad.movePVCforUsagePiAndDi = {% endif %} -{% if 'nw_config_anydb' in sap_swpm_inifile_list %} +{% if 'nw_config_anydb' in sap_swpm_inifile_sections_list %} ###### # nw_config_anydb @@ -515,7 +515,7 @@ HDB_Recovery_Dialogs.sidAdmPassword = {{ sap_swpm_db_sidadm_password }} # Execute ABAP program 'RUTPOADAPT' for depooling. Set it to 'true' if declustering / depooling is selected for the distributed database instance installation option NW_CI_Instance_ABAP_Reports.executeReportsForDepooling = false {% endif %} -{% if 'nw_config_other' in sap_swpm_inifile_list %} +{% if 'nw_config_other' in sap_swpm_inifile_sections_list %} ###### # nw_config_other @@ -537,7 +537,7 @@ NW_getLoadType.loadType = {{ sap_swpm_load_type }} # NW_adaptProfile.skipSecurityProfileSettings = false # OS4.DestinationASP = {% endif %} -{% if 'nw_config_central_services_abap' in sap_swpm_inifile_list %} +{% if 'nw_config_central_services_abap' in sap_swpm_inifile_sections_list %} ###### # nw_config_central_services_abap @@ -549,7 +549,7 @@ NW_CI_Instance.ascsInstanceNumber = {{ sap_swpm_ascs_instance_nr }} # NW_SCS_Instance.ascsVirtualHostname = {{ sap_swpm_ascs_instance_hostname }} NW_SCS_Instance.ascsInstanceNumber = {{ sap_swpm_ascs_instance_nr }} {% endif %} -{% if 'nw_config_central_services_java' in sap_swpm_inifile_list %} +{% if 'nw_config_central_services_java' in sap_swpm_inifile_sections_list %} ###### # nw_config_central_services_java @@ -562,7 +562,7 @@ NW_SCS_Instance.scsVirtualHostname = {{ sap_swpm_java_scs_instance_hostname }} NW_SCS_Instance.instanceNumber = {{ sap_swpm_java_scs_instance_nr }} NW_JAVA_Export.keyPhrase = {{ sap_swpm_master_password }} {% endif %} -{% if 'nw_config_primary_application_server_instance' in sap_swpm_inifile_list %} +{% if 'nw_config_primary_application_server_instance' in sap_swpm_inifile_sections_list %} ###### # nw_config_primary_application_server_instance @@ -576,7 +576,7 @@ NW_CI_Instance.ciInstanceNumber = {{ sap_swpm_pas_instance_nr }} # NW_WPConfiguration.ciBtcWPNumber = 6 # NW_WPConfiguration.ciDialogWPNumber = 10 {% endif %} -{% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_list %} +{% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_sections_list %} ###### # nw_config_additional_application_server_instance @@ -595,7 +595,7 @@ NW_AS.instanceNumber = {{ sap_swpm_aas_instance_nr }} # Virtual host name of the SAP NetWeaver Application Server instance. Leave empty to use the existing host name NW_DI_Instance.virtualHostname = {{ sap_swpm_aas_instance_hostname }} {% endif %} -{% if 'nw_config_ers' in sap_swpm_inifile_list %} +{% if 'nw_config_ers' in sap_swpm_inifile_sections_list %} ###### # nw_config_ers @@ -608,7 +608,7 @@ nw_instance_ers.ersInstanceNumber = {{ sap_swpm_ers_instance_nr }} # "User? Password? Stop. FAIL: Invalid Credentials" nw_instance_ers.restartSCS = false {% endif %} -{% if 'nw_config_ports' in sap_swpm_inifile_list %} +{% if 'nw_config_ports' in sap_swpm_inifile_sections_list %} ###### # nw_config_ports @@ -623,7 +623,7 @@ NW_checkMsgServer.abapMSPort = 36{{ sap_swpm_ascs_instance_nr }} # NW_SCS_Instance.createGlobalProxyInfoFile = false # NW_SCS_Instance.createGlobalRegInfoFile = false {% endif %} -{% if 'nw_config_java_ume' in sap_swpm_inifile_list %} +{% if 'nw_config_java_ume' in sap_swpm_inifile_sections_list %} ###### # nw_config_java_ume @@ -638,7 +638,7 @@ UmeConfiguration.umeInstance = {{ sap_swpm_ume_instance_nr }} UmeConfiguration.umeType = {{ sap_swpm_ume_type }} # UmeConfiguration.sapjsfName = SAPJSF {% endif %} -{% if 'nw_config_java_feature_template_ids' in sap_swpm_inifile_list %} +{% if 'nw_config_java_feature_template_ids' in sap_swpm_inifile_sections_list %} ###### # nw_config_java_feature_template_ids @@ -658,7 +658,7 @@ Select_PPMS_Instances.ListOfSelectedInstances = {% set selected_ids = [] %}{%- f ## Comma-separated value list containing which product instances (formerly known as usage types) are installed. Used for handling product instances in unattended mode. ## SAP_Software_Features_Select.selectedInstancesForInstallation = AS,AAS,BASIC,NW-MODEL,ESR,PI,PI-AF {%- endif %} -{% if 'nw_config_webdisp_generic' in sap_swpm_inifile_list %} +{% if 'nw_config_webdisp_generic' in sap_swpm_inifile_sections_list %} ###### # nw_config_webdisp_generic @@ -683,7 +683,7 @@ NW_webdispatcher_Instance.rfcClient = {{ sap_swpm_wd_backend_rfc_client_nr }} NW_webdispatcher_Instance.rfcUser = {{ sap_swpm_wd_backend_rfc_user }} NW_webdispatcher_Instance.rfcPassword = {{ sap_swpm_wd_backend_rfc_user_password }} {% endif %} -{% if 'nw_config_webdisp_gateway' in sap_swpm_inifile_list %} +{% if 'nw_config_webdisp_gateway' in sap_swpm_inifile_sections_list %} ###### # nw_config_webdisp_gateway @@ -698,14 +698,14 @@ NW_CI_Instance.ascsInstallGateway = {{ sap_swpm_ascs_install_gateway | lower }} # NW_CI_Instance.ascsInstallWebDispatcher = false # NW_SCS_Instance.ascsInstallWebDispatcher = false {% endif %} -{% if 'nw_config_host_agent' in sap_swpm_inifile_list %} +{% if 'nw_config_host_agent' in sap_swpm_inifile_sections_list %} ###### # nw_config_host_agent ###### NW_System.installSAPHostAgent = {{ sap_swpm_install_saphostagent | lower }} {% endif %} -{% if 'nw_config_post_load_abap_reports' in sap_swpm_inifile_list %} +{% if 'nw_config_post_load_abap_reports' in sap_swpm_inifile_sections_list %} ###### # nw_config_post_load_abap_reports @@ -746,7 +746,7 @@ NW_CI_Instance_ABAP_Reports.enableActivateICFService = true # Specify new password of the SAP* user in client 001, different from Master Password # NW_CI_Instance_ABAP_Reports.sapStar001Password = {% endif %} -{% if 'nw_config_livecache' in sap_swpm_inifile_list %} +{% if 'nw_config_livecache' in sap_swpm_inifile_sections_list %} ###### # nw_config_livecache @@ -758,7 +758,7 @@ NW_liveCache.liveCacheUser = NW_liveCache.liveCacheUserPwd = NW_liveCache.useLiveCache = {% endif %} -{% if 'nw_config_sld' in sap_swpm_inifile_list %} +{% if 'nw_config_sld' in sap_swpm_inifile_sections_list %} ###### # nw_config_sld @@ -770,7 +770,7 @@ NW_SLD_Configuration.sldUseHttps = NW_SLD_Configuration.sldUser = NW_SLD_Configuration.sldUserPassword = {% endif %} -{% if 'nw_config_abap_language_packages' in sap_swpm_inifile_list %} +{% if 'nw_config_abap_language_packages' in sap_swpm_inifile_sections_list %} ###### # nw_config_abap_language_packages @@ -781,7 +781,7 @@ NW_Language_Inst_Dialogs.folders = /software # Selected languages comma-separated list (by default DE,EN are installed) NW_Language_Inst_Dialogs.languages = AR,BG,CA,CS,DA,EL,ES,ET,FI,FR,HE,HI,HR,HU,IT,JA,KK,KO,LT,LV,MS,NL,NO,PL,PT,RO,RU,SH,SK,SL,SV,TH,TR,UK,VI,ZF,ZH {% endif %} -{% if 'sap_os_linux_user' in sap_swpm_inifile_list %} +{% if 'sap_os_linux_user' in sap_swpm_inifile_sections_list %} ###### # sap_os_linux_user @@ -790,7 +790,7 @@ nwUsers.sapadmUID = {{ sap_swpm_sapadm_uid }} nwUsers.sapsysGID = {{ sap_swpm_sapsys_gid }} nwUsers.sidAdmUID = {{ sap_swpm_sidadm_uid }} {% endif %} -{% if 'swpm_installation_media_download_service' in sap_swpm_inifile_list %} +{% if 'swpm_installation_media_download_service' in sap_swpm_inifile_sections_list %} ###### # swpm_installation_media_download_service @@ -806,14 +806,14 @@ nwUsers.sidAdmUID = {{ sap_swpm_sidadm_uid }} # DownloadService.Username = # DownloadService.planNumber = {% endif %} -{% if 'nw_config_java_icm_credentials' in sap_swpm_inifile_list %} +{% if 'nw_config_java_icm_credentials' in sap_swpm_inifile_sections_list %} ###### # nw_config_java_icm_credentials ###### NW_IcmAuth.webadmPassword = {{ sap_swpm_ume_j2ee_admin_password }} {% endif %} -{% if 'solman_abap_swpm1' in sap_swpm_inifile_list %} +{% if 'solman_abap_swpm1' in sap_swpm_inifile_sections_list %} ###### # solman_abap_swpm1 @@ -821,7 +821,7 @@ NW_IcmAuth.webadmPassword = {{ sap_swpm_ume_j2ee_admin_password }} ###### InitDeclusteringForImport.decluster = false {% endif %} -{% if 'solman_daa_swpm1' in sap_swpm_inifile_list %} +{% if 'solman_daa_swpm1' in sap_swpm_inifile_sections_list %} ###### # solman_daa_swpm1 @@ -848,7 +848,7 @@ InitDeclusteringForImport.decluster = false # DiagnosticsAgent.SolMan.UserName # DiagnosticsAgent.SolMan.UseSSL {% endif %} -{% if 'syscopy_export_anydb' in sap_swpm_inifile_list %} +{% if 'syscopy_export_anydb' in sap_swpm_inifile_sections_list %} ###### # syscopy_export_anydb @@ -920,7 +920,7 @@ NW_readProfileDir.profileDir = /sapmnt/{{ sap_swpm_sid | upper }}/profile NW_getLoadType.loadType = {{ sap_swpm_load_type }} NW_getLoadType.importManuallyExecuted = false {% endif %} -{% if 'syscopy_import_anydb_ibmdb2' in sap_swpm_inifile_list %} +{% if 'syscopy_import_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} ###### # syscopy_import_anydb_ibmdb2 From ba5fe7c51dcdd281ba076d8bf77b8c1a39826f84 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Aug 2024 16:52:53 +0200 Subject: [PATCH 02/33] sap_swpm: Improved section markers for inifile Signed-off-by: Bernd Finger --- .../tasks/swpm/swpm_inifile_generate.yml | 2 + roles/sap_swpm/templates/inifile_params.j2 | 613 ++++++++++++------ 2 files changed, 408 insertions(+), 207 deletions(-) diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml index 81414b65e..bb7b2ca0c 100644 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml +++ b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml @@ -38,12 +38,14 @@ owner: 'root' group: 'root' mode: '0755' + tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Check if file '{{ sap_swpm_inifile_directory }}/inifile.params' exists ansible.builtin.stat: path: "{{ sap_swpm_inifile_directory }}/inifile.params" check_mode: no register: __sap_swpm_register_stat_sapinst_inifile + tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Notify about existing sapinst inifile ansible.builtin.debug: diff --git a/roles/sap_swpm/templates/inifile_params.j2 b/roles/sap_swpm/templates/inifile_params.j2 index a5797e4c0..576259d92 100644 --- a/roles/sap_swpm/templates/inifile_params.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -1,28 +1,34 @@ -### inifile.params generated for SWPM Catalog Product ID is {{ sap_swpm_product_catalog_id }} +### inifile.params generated for SWPM. Product Catalog ID is {{ sap_swpm_product_catalog_id }} . {% if 'swpm_installation_media' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media -###### +################################################################### +# BEGIN section swpm_installation_media # +# # archives.downloadBasket = {{ sap_swpm_software_path }} # installation_export.archivesFolder = {{ sap_swpm_cd_export_path }} # NOTE: Specific media requirements will use format # SAPINST.CD.PACKAGE. = +# # +# END section swpm_installation_media # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm2_hana' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm2_hana -###### +################################################################### +# BEGIN section swpm_installation_media_swpm2_hana # +# # HDB_Software_Dialogs.useMediaCD = {{ sap_swpm_software_use_media }} +# # +# END section swpm_installation_media_swpm2_hana # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1 -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1 # +# # 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_rdbms_path }} @@ -35,23 +41,29 @@ SAPINST.CD.PACKAGE.RDBMS = {{ sap_swpm_cd_rdbms_path }} # SAPINST.CD.PACKAGE.J2EE = /path/JAVA_J2EE_OSINDEP # SAPINST.CD.PACKAGE.J2EE-INST = /path/JAVA_J2EE_OSINDEP_J2EE_INST # SAPINST.CD.PACKAGE.SCA = /path/JAVA_J2EE_OSINDEP_UT +# # +# END section swpm_installation_media_swpm1 # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_exportfiles' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_exportfiles -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_exportfiles # +# # SAPINST.CD.PACKAGE.EXPORT = {{ sap_swpm_cd_export_path }} # SAPINST.CD.PACKAGE.LOAD = SAPINST.CD.PACKAGE.LOAD1 = {{ sap_swpm_cd_export_pt1_path }} SAPINST.CD.PACKAGE.LOAD2 = {{ sap_swpm_cd_export_pt2_path }} # SAPINST.CD.PACKAGE.JMIG = +# # +# END section swpm_installation_media_swpm1_exportfiles # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_ibmdb2' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_ibmdb2 -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_ibmdb2 # +# # # Requested package : RDBMS-DB6 SAPINST.CD.PACKAGE.DB2 = {{ sap_swpm_cd_ibmdb2_path }} @@ -60,159 +72,210 @@ SAPINST.CD.PACKAGE.DB2CLIENT = {{ sap_swpm_cd_ibmdb2_client_path }} # IBM DB2 software unpack path e.g. /db2/db2x01/db2_software db6.DB2SoftwarePath = {{ sap_swpm_ibmdb2_unpack_path }} +# # +# END section swpm_installation_media_swpm1_ibmdb2 # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_oracledb_121' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_oracledb_121 -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_oracledb_121 # +# # # Requested package : RDBMS-ORA SAPINST.CD.PACKAGE.RDBMS-ORA121 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI121 = {{ sap_swpm_cd_oracle_client_path }} +# # +# END section swpm_installation_media_swpm1_oracledb_121 # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_oracledb_122' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_oracledb_122 -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_oracledb_122 # +# # # Requested package : RDBMS-ORA SAPINST.CD.PACKAGE.RDBMS-ORA122 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI122 = {{ sap_swpm_cd_oracle_client_path }} +# # +# END section swpm_installation_media_swpm1_oracledb_122 # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_oracledb_19' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_oracledb_19 -###### # Requested package : RDBMS-ORA +################################################################### +# BEGIN section swpm_installation_media_swpm1_oracledb_19 # +# # SAPINST.CD.PACKAGE.RDBMS-ORA19 = {{ sap_swpm_cd_oracle_path }} # Requested package : RDBMS-ORA CLIENT SAPINST.CD.PACKAGE.ORACLI19 = {{ sap_swpm_cd_oracle_client_path }} +# # +# END section swpm_installation_media_swpm1_oracledb_19 # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_sapase' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_sapase -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_sapase # +# # # Requested package : RDBMS-SYB SAPINST.CD.PACKAGE.RDBMS-SYB = {{ sap_swpm_cd_sapase_path }} SAPINST.CD.PACKAGE.RDBMS-SYB-CLIENT = {{ sap_swpm_cd_sapase_client_path }} - +# # +# END section swpm_installation_media_swpm1_sapase # +################################################################### {% endif %} {% if 'swpm_installation_media_swpm1_sapmaxdb' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_swpm1_sapmaxdb -###### +################################################################### +# BEGIN section swpm_installation_media_swpm1_sapmaxdb # +# # # Requested package : RDBMS-ADA SAPINST.CD.PACKAGE.RDBMS-ADA = {{ sap_swpm_cd_sapmaxdb_path }} +# # +# END section swpm_installation_media_swpm1_sapmaxdb # +################################################################### {% endif %} {% if 'maintenance_plan_stack_tms_config' in sap_swpm_inifile_sections_list %} -###### -# maintenance_plan_stack_tms_config -###### +################################################################### +# BEGIN section maintenance_plan_stack_tms_config # +# # NW_ABAP_TMSConfig.configureTMS = {{ sap_swpm_configure_tms | lower }} NW_ABAP_TMSConfig.transportPassword = {{ sap_swpm_tmsadm_password }} +# # +# END section maintenance_plan_stack_tms_config # +################################################################### {% endif %} {% if 'maintenance_plan_stack_tms_transports' in sap_swpm_inifile_sections_list %} -###### -# maintenance_plan_stack_tms_transports -###### +################################################################### +# BEGIN section maintenance_plan_stack_tms_transports # +# # NW_ABAP_Include_Corrections.includeTransports = true NW_ABAP_Include_Corrections.transportFilesLocations = {{ sap_swpm_tms_tr_files_path }} +# # +# END section maintenance_plan_stack_tms_transports # +################################################################### {% endif %} {% if 'maintenance_plan_stack_spam_config' in sap_swpm_inifile_sections_list %} -###### -# maintenance_plan_stack_spam_config -###### +################################################################### +# BEGIN section maintenance_plan_stack_spam_config # +# # NW_ABAP_SPAM_Update.SPAMUpdateDecision = {{ sap_swpm_spam_update | lower }} {% if sap_swpm_spam_update %} NW_ABAP_SPAM_Update.SPAMUpdateArchive = {{ sap_swpm_spam_update_sar }} {% else %} #NW_ABAP_SPAM_Update.SPAMUpdateArchive = {% endif %} +# # +# END section maintenance_plan_stack_spam_config # +################################################################### {% endif %} {% if 'maintenance_plan_stack_sum_config' in sap_swpm_inifile_sections_list %} -###### -# maintenance_plan_stack_sum_config -###### +################################################################### +# BEGIN section maintenance_plan_stack_sum_config +# # NW_ABAP_Prepare_SUM.prepareSUM = {{ sap_swpm_sum_prepare | lower }} NW_ABAP_Prepare_SUM.startSUM = {{ sap_swpm_sum_start | lower }} # Password for SUM must be for 'adm' user NW_ABAP_Prepare_SUM.Password = {{ sap_swpm_sap_sidadm_password }} +# # +# END section maintenance_plan_stack_sum_config +################################################################### {% endif %} {% if 'maintenance_plan_stack_sum_10_batch_mode' in sap_swpm_inifile_sections_list %} -###### -# maintenance_plan_stack_sum_10_batch_mode -###### +################################################################### +# BEGIN section maintenance_plan_stack_sum_10_batch_mode # +# # # Re-run of existing BatchModeInputFile.xml for NWAS JAVA (generated by SUM 1.0 on previous host into the /sdt/param/ subdirectory) NW_ABAP_Prepare_SUM.SUMBatchFile = {{ sap_swpm_sum_batch_file }} +# # +# END section maintenance_plan_stack_sum_10_batch_mode # +################################################################### {% endif %} {% if 'credentials' in sap_swpm_inifile_sections_list %} -###### -# credentials -###### -# Master password +################################################################### +# BEGIN section credentials # +# # +# Master password: NW_GetMasterPassword.masterPwd = {{ sap_swpm_master_password }} - -# 'adm' user +# 'adm' user: nwUsers.sidadmPassword = {{ sap_swpm_sap_sidadm_password }} - DiagnosticsAgent.dasidAdmPassword = {{ sap_swpm_diagnostics_agent_password }} - -# 'sapadm' user of the SAP Host Agent +# 'sapadm' user of the SAP Host Agent: hostAgent.sapAdmPassword = {{ sap_swpm_sapadm_password }} +# # +# END section credentials # +################################################################### {% endif %} {% if 'credentials_hana' in sap_swpm_inifile_sections_list %} -###### -# credentials_hana -###### +################################################################### +# BEGIN section credentials_hana # +# # +HDB_Schema_Check_Dialogs.schemaPassword = {{ sap_swpm_db_schema_password }} +storageBasedCopy.hdb.systemPassword = {{ sap_swpm_db_system_password }} +# # +# END section credentials_hana # +################################################################### HDB_Schema_Check_Dialogs.schemaPassword = {{ sap_swpm_db_schema_password }} storageBasedCopy.hdb.systemPassword = {{ sap_swpm_db_system_password }} {% endif %} {% if 'credentials_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} -###### -# credentials_anydb_ibmdb2 -###### +################################################################### +# BEGIN section credentials_anydb_ibmdb2 # +# # nwUsers.db6.db2sidPassword = {{ sap_swpm_sap_sidadm_password }} # nwUsers.db6.db2sidUid = +# # +# END section credentials_anydb_ibmdb2 # +################################################################### {% endif %} {% if 'credentials_anydb_oracledb' in sap_swpm_inifile_sections_list %} -###### -# credentials_anydb_oracledb -###### +################################################################### +# BEGIN section credentials_anydb_oracledb # +# # # Oracle database software owner ora.oraclePassword = {{ sap_swpm_sap_sidadm_password }} - # 'ora' user ora.orasidPassword = {{ sap_swpm_sap_sidadm_password }} - # Oracle 'SYS' password ora.SysPassword = {{ sap_swpm_db_system_password }} - # Oracle 'SYSTEM' password ora.SystemPassword = {{ sap_swpm_db_system_password }} +# # +# END section credentials_anydb_oracledb # +################################################################### +{% endif %} +{% if 'credentials_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} + +################################################################### +# BEGIN section credentials_anydb_ibmdb2 # +# # +nwUsers.db6.db2sidPassword = {{ sap_swpm_sap_sidadm_password }} +# nwUsers.db6.db2sidUid = +# # +# END section credentials_anydb_ibmdb2 # +################################################################### {% endif %} {% if 'credentials_anydb_sapase' in sap_swpm_inifile_sections_list %} -###### -# credentials_anydb_sapase -###### +################################################################### +# BEGIN section credentials_anydb_sapase # +# # nwUsers.syb.sybsidPassword = {{ sap_swpm_sap_sidadm_password }} SYB.NW_DB.sa_pass = {{ sap_swpm_master_password }} SYB.NW_DB.sapsa_pass = {{ sap_swpm_master_password }} @@ -221,78 +284,102 @@ SYB.NW_DB.sapsr3db_pass = {{ sap_swpm_db_system_password }} # SYB.NW_DB.encryptionMasterKeyPassword = # SYB.NW_DB.sapsso_pass = # SYB.NW_DB.sslPassword = +# # +# END section credentials_anydb_sapase # +################################################################### {% endif %} {% if 'credentials_anydb_sapmaxdb' in sap_swpm_inifile_sections_list %} -###### -# credentials_anydb_sapmaxdb -# -# The password of user DBUser may only consist of alphanumeric characters and the special characters #, $, @ and _ -###### +################################################################### +# BEGIN section credentials_anydb_sapmaxdb # +# # +# Note: The password of user DBUser may only consist of alphanumeric characters and the special characters #, $, @ and _ nwUsers.ada.sqdsidPassword = {{ sap_swpm_sap_sidadm_password }} Sdb_DBUser.dbaPassword = {{ sap_swpm_db_system_password }} Sdb_DBUser.dbmPassword = {{ sap_swpm_db_system_password }} Sdb_Schema_Dialogs.dbSchemaPassword = {{ sap_swpm_db_schema_password }} +# # +# END section credentials_anydb_sapmaxdb # +################################################################### {% endif %} {% if 'credentials_nwas_ssfs' in sap_swpm_inifile_sections_list %} -###### -# credentials_nwas_ssfs -###### +################################################################### +# BEGIN section credentials_nwas_ssfs # +# # HDB_Userstore.useABAPSSFS = true # NW_ABAP_SSFS_CustomKey.ssfsKeyInputFile = +# # +# END section credentials_nwas_ssfs # +################################################################### {% endif %} {% if 'credentials_hdbuserstore' in sap_swpm_inifile_sections_list %} -###### -# credentials_hdbuserstore -###### +################################################################### +# BEGIN section credentials_hdbuserstore # +# # HDB_Userstore.useABAPSSFS = false # HDB_Userstore.doNotResolveHostnames = # HDB_Userstore.HDB_USE_IDENT = # HDB_Userstore.systemDBPort = # NW_HDB_DBClient.checkCreateUserstore = true # NW_HDB_DBClient.clientPathStrategy = LOCAL +# # +# END section credentials_hdbuserstore # +################################################################### {% endif %} {% if 'credentials_syscopy' in sap_swpm_inifile_sections_list %} -###### -# credentials_syscopy -###### +################################################################### +# BEGIN section credentials_syscopy # +# # # Are the passwords for the DDIC users different from the default value? NW_DDIC_Password.needDDICPasswords = true NW_DDIC_Password.ddic000Password = {{ sap_swpm_ddic_000_password }} #NW_DDIC_Password.ddic001Password = +# # +# END section credentials_syscopy # +################################################################### {% endif %} {% if 'db_config_hana' in sap_swpm_inifile_sections_list %} -###### -# db_config_hana -###### +################################################################### +# BEGIN section db_config_hana # +# # storageBasedCopy.hdb.instanceNumber = {{ sap_swpm_db_instance_nr }} HDB_Schema_Check_Dialogs.schemaName = {{ sap_swpm_db_schema }} +###################################################################### +# BEGIN subsection nw_config_additional_application_server_instance # +# # {% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_sections_list %} - HDB_Schema_Check_Dialogs.validateSchemaName = true {% else %} HDB_Schema_Check_Dialogs.validateSchemaName = false +# # +# END subsection nw_config_additional_application_server_instance # +###################################################################### {% endif %} - # HDB_Schema_Check_Dialogs.dropSchema = false # hdb.create.dbacockpit.user = false +# # +# END section db_config_hana # +################################################################### {% endif %} {% if 'db_config_anydb_all' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_all -###### +################################################################### +# BEGIN section db_config_anydb_all # +# # NW_ABAP_Import_Dialog.dbCodepage = 4103 +# # +# END section db_config_anydb_all # +################################################################### {% endif %} {% if 'db_config_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_ibmdb2 -###### +################################################################### +# BEGIN section db_config_anydb_ibmdb2 # +# # NW_ABAP_Import_Dialog.migmonJobNum = 3 NW_ABAP_Import_Dialog.migmonLoadArgs = -stop_on_error -loadprocedure fast LOAD:COMPRESS_ALL:DEF_CRT NW_getDBInfoGeneric.dbhost = {{ sap_swpm_db_host }} @@ -316,12 +403,15 @@ db6.usesLDAP = false storageBasedCopy.db6.CommunicationPortNumber = 5912 storageBasedCopy.db6.PortRangeEnd = 5917 storageBasedCopy.db6.PortRangeStart = 5914 +# # +# END section db_config_anydb_ibmdb2 # +################################################################### {% endif %} {% if 'db_config_anydb_oracledb' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_oracledb -###### +################################################################### +# BEGIN section db_config_anydb_oracledb # +# # NW_ABAP_Import_Dialog.migmonJobNum = 3 NW_ABAP_Import_Dialog.migmonLoadArgs = -stop_on_error -loadprocedure fast NW_getDBInfoGeneric.dbsid = {{ sap_swpm_db_sid }} @@ -344,42 +434,54 @@ ora.whatInstallation = isSingle ## PDB_ONLY: install PDB only in an existing CDB. ## CDB_ONLY: install CDB only. ora.multitenant.installMT = FALSE +# # +# END section db_config_anydb_oracledb # +################################################################### {% endif %} {% if 'db_config_anydb_oracledb_121' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_oracledb_121 +################################################################### +# BEGIN section db_config_anydb_oracledb_121 # +# # # Use path to Oracle Home - Runtime (i.e. $OHRDBMS env var) -###### ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/121 storageBasedCopy.ora.clientVersion = 121 storageBasedCopy.ora.serverVersion = 121 +# # +# END section db_config_anydb_oracledb_121 # +################################################################### {% endif %} {% if 'db_config_anydb_oracledb_122' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_oracledb_122 +################################################################### +# BEGIN section db_config_anydb_oracledb_122 # +# # # Use path to Oracle Home - Runtime (i.e. $OHRDBMS env var) -###### ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/122 storageBasedCopy.ora.clientVersion = 122 storageBasedCopy.ora.serverVersion = 122 +# # +# END section db_config_anydb_oracledb_122 # +################################################################### {% endif %} {% if 'db_config_anydb_oracledb_19' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_oracledb_19 +################################################################### +# BEGIN section db_config_anydb_oracledb_19 # +# # # Use path to Oracle Home - Runtime (i.e. $OHRDBMS env var) -###### ora.dbhome = /oracle/{{ sap_swpm_db_sid }}/19 storageBasedCopy.ora.clientVersion = 19 storageBasedCopy.ora.serverVersion = 19 +# # +# END section db_config_anydb_oracledb_19 # +################################################################### {% endif %} {% if 'db_config_anydb_sapase' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_sapase -###### +################################################################### +# BEGIN section db_config_anydb_sapase # +# # NW_ABAP_Import_Dialog.migmonJobNum = 3 NW_ABAP_Import_Dialog.migmonLoadArgs = -c 100000 -loadprocedure fast NW_SYB_DBPostload.numberParallelStatisticJobs = 0 @@ -411,12 +513,15 @@ SYB.NW_DB.portDatabaseServer = SYB.NW_DB.portBackupServer = SYB.NW_DB.portJobScheduler = SYB.NW_DB.portXPServer = +# # +# END section db_config_anydb_sapase # +################################################################### {% endif %} {% if 'db_config_anydb_sapmaxdb' in sap_swpm_inifile_sections_list %} -###### -# db_config_anydb_sapmaxdb -###### +################################################################### +# BEGIN section db_config_anydb_sapmaxdb # +# # NW_ABAP_Import_Dialog.migmonJobNum = 90 NW_ABAP_Import_Dialog.migmonLoadArgs = -para_cnt 90 NW_ADA_getDBInfo.dbsid = {{ sap_swpm_db_sid }} @@ -424,12 +529,15 @@ SdbInstanceDialogs.DB_sessions = 100 SdbInstanceDialogs.minlogsize = 4000 SdbInstanceDialogs.sapdataFolder = sapdata SdbInstanceDialogs.saplogFolder = saplog +# # +# END section db_config_anydb_sapmaxdb # +################################################################### {% endif %} {% if 'db_connection_nw_hana' in sap_swpm_inifile_sections_list %} -###### -# db_connection_nw_hana -###### +################################################################### +# BEGIN section db_connection_nw_hana # +# # NW_HDB_getDBInfo.dbhost = {{ sap_swpm_db_host }} NW_HDB_getDBInfo.dbsid = {{ sap_swpm_db_sid }} NW_HDB_getDBInfo.instanceNumber = {{ sap_swpm_db_instance_nr }} @@ -449,12 +557,15 @@ NW_Recovery_Install_HDB.sidAdmPassword = {{ sap_swpm_db_sidadm_password }} # NW_HDB_getDBInfo.tenantOsGroup = {{ sap_swpm_db_sid | lower }}grp # NW_HDB_getDBInfo.tenantOsUser = {{ sap_swpm_db_sid | lower }}usr # NW_HDB_getDBInfo.tenantPort = +# # +# END section db_connection_nw_hana # +################################################################### {% endif %} {% if 'db_connection_nw_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} -###### -# db_connection_nw_anydb_ibmdb2 -###### +################################################################### +# BEGIN section db_connection_nw_anydb_ibmdb2 # +# # # db6.UseDb2SSLClientServerComm = false nwUsers.db6.sapsidPassword = {{ sap_swpm_sapadm_password }} # nwUsers.db6.sapsidUid = @@ -467,27 +578,33 @@ NW_DB6_DB.db6.abap.connect.user = sap{{ sap_swpm_sid | lower }} NW_DB6_DB.db6.abap.schema = sap{{ sap_swpm_sid | lower }} # NW_DB6_DB.db6.java.connect.user = # NW_DB6_DB.db6.java.schema = +# # +# END section db_connection_nw_anydb_ibmdb2 # +################################################################### {% endif %} {% if 'db_connection_nw_anydb_oracledb' in sap_swpm_inifile_sections_list %} -###### -# db_connection_nw_anydb_oracledb -###### +################################################################### +# BEGIN secion db_connection_nw_anydb_oracledb # +# # storageBasedCopy.abapSchemaPassword = {{ sap_swpm_db_schema_abap_password }} storageBasedCopy.javaSchemaPassword = {{ sap_swpm_db_schema_java_password }} +# # +# END secion db_connection_nw_anydb_oracledb # +################################################################### {% endif %} {% if 'db_connection_nw_anydb_sapase' in sap_swpm_inifile_sections_list %} -###### +################################################################### # db_connection_nw_anydb_sapase -###### +################################################################### # NW_SYB_CIABAP.sapsaPassword = {% endif %} {% if 'db_restore_hana' in sap_swpm_inifile_sections_list %} -###### -# db_restore_hana -###### +################################################################### +# BEGIN section db_restore_hana # +# # NW_HDB_getDBInfo.systemPasswordBackup = {{ sap_swpm_backup_system_password }} HDB_Recovery_Dialogs.backupLocation = {{ sap_swpm_backup_location }} HDB_Recovery_Dialogs.backupName = {{ sap_swpm_backup_prefix }} @@ -505,21 +622,27 @@ HDB_Recovery_Dialogs.sidAdmPassword = {{ sap_swpm_db_sidadm_password }} # NW_Recovery_Install_HDB.loadOrMount = load # HDB_System_Check_Dialogs.initTopology = false # NW_CreateDBandLoad.movePVCforUsagePiAndDi = +# # +# END section db_restore_hana # +################################################################### {% endif %} {% if 'nw_config_anydb' in sap_swpm_inifile_sections_list %} -###### -# nw_config_anydb -###### +################################################################### +# BEGIN section nw_config_anydb # +# # # Distributed installation or system copy with any database and SAP Basis release 740 or higher: # Execute ABAP program 'RUTPOADAPT' for depooling. Set it to 'true' if declustering / depooling is selected for the distributed database instance installation option NW_CI_Instance_ABAP_Reports.executeReportsForDepooling = false +# # +# END section nw_config_anydb # +################################################################### {% endif %} {% if 'nw_config_other' in sap_swpm_inifile_sections_list %} -###### -# nw_config_other -###### +################################################################### +# BEGIN section nw_config_other # +# # # NW_Delete_Sapinst_Users.removeUsers = false NW_getFQDN.FQDN = {{ sap_swpm_fqdn }} NW_getFQDN.setFQDN = {{ sap_swpm_set_fqdn | lower }} @@ -536,53 +659,75 @@ NW_getLoadType.loadType = {{ sap_swpm_load_type }} # NW_Exit_Before_Systemstart.exit = false # NW_adaptProfile.skipSecurityProfileSettings = false # OS4.DestinationASP = +# # +# END section nw_config_other # +################################################################### {% endif %} {% if 'nw_config_central_services_abap' in sap_swpm_inifile_sections_list %} -###### -# nw_config_central_services_abap +################################################################### +# BEGIN section nw_config_central_services_abap # +# # # Central Services (ASCS) contains the Message server (MS) and Enqueue work processes (EN) for the ABAP Dispatcher. # Formerly the processes were contained in the Central Instance (CI). -###### +################################################################### NW_CI_Instance.ascsVirtualHostname = {{ sap_swpm_ascs_instance_hostname }} NW_CI_Instance.ascsInstanceNumber = {{ sap_swpm_ascs_instance_nr }} # NW_SCS_Instance.ascsVirtualHostname = {{ sap_swpm_ascs_instance_hostname }} NW_SCS_Instance.ascsInstanceNumber = {{ sap_swpm_ascs_instance_nr }} +# # +# END section nw_config_central_services_abap # +################################################################### {% endif %} {% if 'nw_config_central_services_java' in sap_swpm_inifile_sections_list %} -###### -# nw_config_central_services_java -# SAP Java Central Services Instance (SCS) contains the Java Message server (MS), Java Enqueue server (EN), Java Gateway (GW) and Java Internal Web Dispatcher (WD). -###### +################################################################### +# BEGIN section nw_config_central_services_java # +# # +# SAP Java Central Services Instance (SCS) contains: +# - Java Message server (MS), +# - Java Enqueue server (EN), +# - Java Gateway (GW) and +# - Java Internal Web Dispatcher (WD). +################################################################### NW_CI_Instance.scsVirtualHostname = {{ sap_swpm_java_scs_instance_hostname }} NW_CI_Instance.scsInstanceNumber = {{ sap_swpm_java_scs_instance_nr }} NW_SCS_Instance.scsVirtualHostname = {{ sap_swpm_java_scs_instance_hostname }} # NW_SCS_Instance.scsInstanceNumber = NW_SCS_Instance.instanceNumber = {{ sap_swpm_java_scs_instance_nr }} NW_JAVA_Export.keyPhrase = {{ sap_swpm_master_password }} +# # +# END section nw_config_central_services_java # +################################################################### {% endif %} {% if 'nw_config_primary_application_server_instance' in sap_swpm_inifile_sections_list %} -###### -# nw_config_primary_application_server_instance -# Primary Application Server (PAS) contains the Internet Communication Manager (ICM), Gateway (GW), and ABAP Dispatcher (DI/WP) work processes. +################################################################### +# BEGIN section nw_config_primary_application_server_instance # +# # +# Primary Application Server (PAS) contains: +# - Internet Communication Manager (ICM), +# - Gateway (GW) and +# - ABAP Dispatcher (DI/WP) work processes. # Formerly called the Central Instance (CI). -###### NW_CI_Instance.ciVirtualHostname = {{ sap_swpm_pas_instance_hostname }} NW_CI_Instance.ciInstanceNumber = {{ sap_swpm_pas_instance_nr }} # NW_CI_Instance.nodesNum = # NW_CI_Instance.nodesNumber = defNodes # NW_WPConfiguration.ciBtcWPNumber = 6 # NW_WPConfiguration.ciDialogWPNumber = 10 +# # +# END section nw_config_primary_application_server_instance # +################################################################### {% endif %} {% if 'nw_config_additional_application_server_instance' in sap_swpm_inifile_sections_list %} -###### -# nw_config_additional_application_server_instance -# Additional Application Server (AAS) contains ABAP Dispatcher (DI/WP) work processes. +################################################################### +# BEGIN section nw_config_additional_application_server_instance # +# # +# Additional Application Server (AAS) contains: +# - ABAP Dispatcher (DI/WP) work processes. # Formerly called the Dialog Instance (DI). -###### # Instance number of SAP NetWeaver Application Server. Leave empty for default. NW_AS.instanceNumber = {{ sap_swpm_aas_instance_nr }} @@ -594,12 +739,15 @@ NW_AS.instanceNumber = {{ sap_swpm_aas_instance_nr }} # Virtual host name of the SAP NetWeaver Application Server instance. Leave empty to use the existing host name NW_DI_Instance.virtualHostname = {{ sap_swpm_aas_instance_hostname }} +# # +# END section nw_config_additional_application_server_instance # +################################################################### {% endif %} {% if 'nw_config_ers' in sap_swpm_inifile_sections_list %} -###### -# nw_config_ers -###### +################################################################### +# BEGIN section nw_config_ers # +# # nw_instance_ers.ersVirtualHostname = {{ sap_swpm_ers_instance_hostname }} nw_instance_ers.ersInstanceNumber = {{ sap_swpm_ers_instance_nr }} @@ -607,12 +755,15 @@ nw_instance_ers.ersInstanceNumber = {{ sap_swpm_ers_instance_nr }} # otherwise by default SAP SWPM will use sapcontrol -queryuser -function Stop and will cause error # "User? Password? Stop. FAIL: Invalid Credentials" nw_instance_ers.restartSCS = false +# # +# END section nw_config_ers # +################################################################### {% endif %} {% if 'nw_config_ports' in sap_swpm_inifile_sections_list %} -###### -# nw_config_ports -###### +################################################################### +# BEGIN section nw_config_ports # +# # NW_CI_Instance.ciMSPort = 36{{ sap_swpm_ascs_instance_nr }} NW_checkMsgServer.abapMSPort = 36{{ sap_swpm_ascs_instance_nr }} # NW_CI_Instance.ciMSPortInternal = @@ -622,12 +773,15 @@ NW_checkMsgServer.abapMSPort = 36{{ sap_swpm_ascs_instance_nr }} # NW_SCS_Instance.scsMSPort = # NW_SCS_Instance.createGlobalProxyInfoFile = false # NW_SCS_Instance.createGlobalRegInfoFile = false +# # +# END section nw_config_ports # +################################################################### {% endif %} {% if 'nw_config_java_ume' in sap_swpm_inifile_sections_list %} -###### -# nw_config_java_ume -###### +################################################################### +# BEGIN section nw_config_java_ume # +# # UmeConfiguration.adminName = J2EE_ADM_{{ sap_swpm_sid }} UmeConfiguration.adminPassword = {{ sap_swpm_ume_j2ee_admin_password }} UmeConfiguration.guestName = J2EE_GST_{{ sap_swpm_sid }} @@ -637,12 +791,15 @@ UmeConfiguration.umeHost = {{ sap_swpm_pas_instance_hostname }} UmeConfiguration.umeInstance = {{ sap_swpm_ume_instance_nr }} UmeConfiguration.umeType = {{ sap_swpm_ume_type }} # UmeConfiguration.sapjsfName = SAPJSF +# # +# END section nw_config_java_ume # +################################################################### {% endif %} {% if 'nw_config_java_feature_template_ids' in sap_swpm_inifile_sections_list %} -###### -# nw_config_java_feature_template_ids -###### +################################################################### +# BEGIN section nw_config_java_feature_template_ids # +# # NW_internal.useProductVersionDescriptor = true nw_java_import.buildJEEusingExtraMileTool = {{ true if sap_swpm_java_import_method == 'extramile' else false }} @@ -657,12 +814,15 @@ Select_PPMS_Instances.ListOfSelectedInstances = {% set selected_ids = [] %}{%- f ## If use PV = false [LEGACY for before NWAS JAVA 7.40] ## Comma-separated value list containing which product instances (formerly known as usage types) are installed. Used for handling product instances in unattended mode. ## SAP_Software_Features_Select.selectedInstancesForInstallation = AS,AAS,BASIC,NW-MODEL,ESR,PI,PI-AF +# # +# END section nw_config_java_feature_template_ids # +################################################################### {%- endif %} {% if 'nw_config_webdisp_generic' in sap_swpm_inifile_sections_list %} -###### -# nw_config_webdisp_generic -###### +################################################################### +# BEGIN section nw_config_webdisp_generic # +# # NW_Webdispatcher_Instance.wdInstanceNumber = {{ sap_swpm_wd_instance_nr }} # NW_webdispatcher_Instance.encryptionMode = Always # NW_webdispatcher_Instance.useWdHTTPPort = false @@ -682,15 +842,18 @@ NW_webdispatcher_Instance.rfcInstance = {{ sap_swpm_wd_backend_rfc_instance_nr } NW_webdispatcher_Instance.rfcClient = {{ sap_swpm_wd_backend_rfc_client_nr }} NW_webdispatcher_Instance.rfcUser = {{ sap_swpm_wd_backend_rfc_user }} NW_webdispatcher_Instance.rfcPassword = {{ sap_swpm_wd_backend_rfc_user_password }} +# # +# END section nw_config_webdisp_generic # +################################################################### {% endif %} {% if 'nw_config_webdisp_gateway' in sap_swpm_inifile_sections_list %} -###### +################################################################### # nw_config_webdisp_gateway # # It is recommended to install gateway as part of ASCS # It is NOT recommended to install webdispatcher as part of ASCS. A separate Web Dispatcher instance should be installed (SAP Note 908097) -###### +################################################################### NW_CI_Instance.ascsInstallGateway = {{ sap_swpm_ascs_install_gateway | lower }} # NW_SCS_Instance.ascsInstallGateway = {{ sap_swpm_ascs_install_gateway | lower }} @@ -700,16 +863,19 @@ NW_CI_Instance.ascsInstallGateway = {{ sap_swpm_ascs_install_gateway | lower }} {% endif %} {% if 'nw_config_host_agent' in sap_swpm_inifile_sections_list %} -###### -# nw_config_host_agent -###### +################################################################### +# BEGIN section nw_config_host_agent # +# # NW_System.installSAPHostAgent = {{ sap_swpm_install_saphostagent | lower }} +# # +# END section nw_config_host_agent # +################################################################### {% endif %} {% if 'nw_config_post_load_abap_reports' in sap_swpm_inifile_sections_list %} -###### -# nw_config_post_load_abap_reports -###### +################################################################### +# BEGIN section nw_config_post_load_abap_reports # +# # # Activate ICF node '/SAP/BC/REST/SLPROTOCOL' NW_CI_Instance_ABAP_Reports.enableActivateICFService = true @@ -745,57 +911,72 @@ NW_CI_Instance_ABAP_Reports.enableActivateICFService = true # Specify new password of the SAP* user in client 001, different from Master Password # NW_CI_Instance_ABAP_Reports.sapStar001Password = +# # +# END section nw_config_post_load_abap_reports # +################################################################### {% endif %} {% if 'nw_config_livecache' in sap_swpm_inifile_sections_list %} -###### -# nw_config_livecache -###### +################################################################### +# BEGIN section nw_config_livecache # +# # NW_liveCache.controlUserPwd = NW_liveCache.liveCacheHost = NW_liveCache.liveCacheID = NW_liveCache.liveCacheUser = NW_liveCache.liveCacheUserPwd = NW_liveCache.useLiveCache = +# # +# END section nw_config_livecache # +################################################################### {% endif %} {% if 'nw_config_sld' in sap_swpm_inifile_sections_list %} -###### -# nw_config_sld -###### +################################################################### +# BEGIN section nw_config_sld # +# # NW_SLD_Configuration.configureSld = NW_SLD_Configuration.sldHost = NW_SLD_Configuration.sldPort = NW_SLD_Configuration.sldUseHttps = NW_SLD_Configuration.sldUser = NW_SLD_Configuration.sldUserPassword = +# # +# END section nw_config_sld # +################################################################### {% endif %} {% if 'nw_config_abap_language_packages' in sap_swpm_inifile_sections_list %} -###### -# nw_config_abap_language_packages -###### +################################################################### +# BEGIN section nw_config_abap_language_packages # +# # NW_Language_Inst_Dialogs.install = true # Path to language archive files (e.g. S4HANAOP***_LANG_EN.SAR) NW_Language_Inst_Dialogs.folders = /software # Selected languages comma-separated list (by default DE,EN are installed) NW_Language_Inst_Dialogs.languages = AR,BG,CA,CS,DA,EL,ES,ET,FI,FR,HE,HI,HR,HU,IT,JA,KK,KO,LT,LV,MS,NL,NO,PL,PT,RO,RU,SH,SK,SL,SV,TH,TR,UK,VI,ZF,ZH +# # +# END section nw_config_abap_language_packages # +################################################################### {% endif %} {% if 'sap_os_linux_user' in sap_swpm_inifile_sections_list %} -###### -# sap_os_linux_user -###### +################################################################### +# BEGIN section sap_os_linux_user # +# # nwUsers.sapadmUID = {{ sap_swpm_sapadm_uid }} nwUsers.sapsysGID = {{ sap_swpm_sapsys_gid }} nwUsers.sidAdmUID = {{ sap_swpm_sidadm_uid }} +# # +# END section sap_os_linux_user # +################################################################### {% endif %} {% if 'swpm_installation_media_download_service' in sap_swpm_inifile_sections_list %} -###### -# swpm_installation_media_download_service -# Not in use by sap_swpm Ansible Role -###### +################################################################### +# BEGIN section swpm_installation_media_download_service # +# Note: This section is not in use by sap_swpm Ansible Role # +# # # nwUsers.sapServiceSIDPassword = # download_service.directory = # DownloadService.EnableProxy = @@ -805,28 +986,37 @@ nwUsers.sidAdmUID = {{ sap_swpm_sidadm_uid }} # DownloadService.ProvideAuthentication = # DownloadService.Username = # DownloadService.planNumber = +# # +# END section swpm_installation_media_download_service # +################################################################### {% endif %} {% if 'nw_config_java_icm_credentials' in sap_swpm_inifile_sections_list %} -###### -# nw_config_java_icm_credentials -###### +################################################################### +# BEGIN section nw_config_java_icm_credentials # +# # NW_IcmAuth.webadmPassword = {{ sap_swpm_ume_j2ee_admin_password }} +# # +# END section nw_config_java_icm_credentials # +################################################################### {% endif %} {% if 'solman_abap_swpm1' in sap_swpm_inifile_sections_list %} -###### -# solman_abap_swpm1 -# Not in use by sap_swpm Ansible Role -###### +################################################################### +# BEGIN section solman_abap_swpm1 # +# Note: This section is not in use by sap_swpm Ansible Role # +# # InitDeclusteringForImport.decluster = false +# # +# END section solman_abap_swpm1 # +################################################################### {% endif %} {% if 'solman_daa_swpm1' in sap_swpm_inifile_sections_list %} -###### -# solman_daa_swpm1 -# Not in use by sap_swpm Ansible Role -###### +################################################################### +# BEGIN section solman_daa_swpm1 # +# Note: This section is not in use by sap_swpm Ansible Role # +# # # DiagnosticsAgent.dasidAdmPassword = {{ sap_swpm_diagnostics_agent_password }} # DiagnosticsAgent.installSAPHostAgent # DiagnosticsAgent.InstanceNumber @@ -847,13 +1037,16 @@ InitDeclusteringForImport.decluster = false # DiagnosticsAgent.SolMan.PortNumber # DiagnosticsAgent.SolMan.UserName # DiagnosticsAgent.SolMan.UseSSL +# # +# END section solman_daa_swpm1 # +################################################################### {% endif %} {% if 'syscopy_export_anydb' in sap_swpm_inifile_sections_list %} -###### -# syscopy_export_anydb -# Not in use by sap_swpm Ansible Role -###### +################################################################### +# BEGIN section syscopy_export_anydb # +# Note: This section is not in use by sap_swpm Ansible Role # +# # # InitDeclusteringForExport.decluster = # NW_ABAP_Export_Dialog.customPackageOrder = # NW_ABAP_Export_Dialog.customSortOrderFile = @@ -919,13 +1112,16 @@ NW_readProfileDir.profileDir = /sapmnt/{{ sap_swpm_sid | upper }}/profile NW_getLoadType.loadType = {{ sap_swpm_load_type }} NW_getLoadType.importManuallyExecuted = false +# # +# END section syscopy_export_anydb # +################################################################### {% endif %} {% if 'syscopy_import_anydb_ibmdb2' in sap_swpm_inifile_sections_list %} -###### -# syscopy_import_anydb_ibmdb2 -# Not in use by sap_swpm Ansible Role -###### +################################################################### +# BEGIN section syscopy_import_anydb_ibmdb2 # +# Note: This section is not in use by sap_swpm Ansible Role # +# # # db6.Additional_DbServer = # db6.cluster.HADRPort1 = # db6.cluster.HADRPort2 = @@ -956,4 +1152,7 @@ storageBasedCopy.db6.CommunicationPortNumber = 5912 storageBasedCopy.db6.PortRangeEnd = 5917 storageBasedCopy.db6.PortRangeStart = 5914 # storageBasedCopy.db6.db6updatedbpath = +# # +# END section syscopy_import_anydb_ibmdb2 # +################################################################### {% endif %} From 53fc46fe0f934a4915bc11cb3b902ff8fe5b7c93 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Aug 2024 18:20:28 +0200 Subject: [PATCH 03/33] sap_swpm: Reorganize yml files, part 1 Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 2 +- .../detect_variables_from_inifile.yml} | 0 .../generate_inifile_params.yml} | 37 ++----------------- .../prepare_software.yml | 0 .../tasks/pre_install/set_password_facts.yml | 24 ++++++++++++ .../swpm_prepare.yml} | 16 +++++++- .../swpm_inifile_generate_inifile_reuse.yml | 13 ------- 7 files changed, 43 insertions(+), 49 deletions(-) rename roles/sap_swpm/tasks/{swpm/detect_variables.yml => pre_install/detect_variables_from_inifile.yml} (100%) rename roles/sap_swpm/tasks/{swpm/swpm_inifile_generate.yml => pre_install/generate_inifile_params.yml} (77%) rename roles/sap_swpm/tasks/{swpm => pre_install}/prepare_software.yml (100%) create mode 100644 roles/sap_swpm/tasks/pre_install/set_password_facts.yml rename roles/sap_swpm/tasks/{swpm/swpm_pre_install.yml => pre_install/swpm_prepare.yml} (83%) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 1f330fb3e..cf5b9ccb7 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -12,7 +12,7 @@ ################ - name: SAP SWPM Pre Install - Run Preinstallation Steps - ansible.builtin.include_tasks: swpm/swpm_pre_install.yml + ansible.builtin.include_tasks: pre_install/swpm_prepare.yml tags: - sap_swpm_generate_inifile - sap_swpm_sapinst_commandline diff --git a/roles/sap_swpm/tasks/swpm/detect_variables.yml b/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml similarity index 100% rename from roles/sap_swpm/tasks/swpm/detect_variables.yml rename to roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml similarity index 77% rename from roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml rename to roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml index bb7b2ca0c..71a004d1b 100644 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml @@ -1,34 +1,9 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... -- name: SAP SWPM default mode - Determine Installation Type - ansible.builtin.include_tasks: - file: ../pre_install/install_type.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - # Password Facts -- name: SAP SWPM Pre Install - Set password facts when ABAP - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" - when: "'ABAP' in sap_swpm_product_catalog_id" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM Pre Install - Set password facts when Java - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" - when: "'Java' in sap_swpm_product_catalog_id" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM Pre Install - Set other user passwords using master password - ansible.builtin.set_fact: - sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" +- name: SAP SWPM Pre Install - Set password facts + ansible.builtin.include_tasks: "set_password_facts.yml" tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists @@ -132,7 +107,7 @@ - name: SAP SWPM Pre Install - Detect Variables ansible.builtin.include_tasks: - file: detect_variables.yml + file: detect_variables_from_inifile.yml apply: tags: sap_swpm_generate_inifile tags: sap_swpm_generate_inifile @@ -157,9 +132,3 @@ ansible.builtin.debug: msg: "The local inifile.params has been copied to: '{{ sap_swpm_tmpdir.path }}/inifile.params'" tags: sap_swpm_generate_inifile - -# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) -# Prepare Software -- name: SAP SWPM advanced mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml - when: sap_swpm_run_sapinst diff --git a/roles/sap_swpm/tasks/swpm/prepare_software.yml b/roles/sap_swpm/tasks/pre_install/prepare_software.yml similarity index 100% rename from roles/sap_swpm/tasks/swpm/prepare_software.yml rename to roles/sap_swpm/tasks/pre_install/prepare_software.yml diff --git a/roles/sap_swpm/tasks/pre_install/set_password_facts.yml b/roles/sap_swpm/tasks/pre_install/set_password_facts.yml new file mode 100644 index 000000000..96010efba --- /dev/null +++ b/roles/sap_swpm/tasks/pre_install/set_password_facts.yml @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 +--- + +# Password Facts +- name: SAP SWPM Pre Install - Set password facts when ABAP + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" + when: "'ABAP' in sap_swpm_product_catalog_id" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Set password facts when Java + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" + when: "'Java' in sap_swpm_product_catalog_id" + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Set other user passwords using master password + ansible.builtin.set_fact: + sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" + tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml similarity index 83% rename from roles/sap_swpm/tasks/swpm/swpm_pre_install.yml rename to roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index 8664f9dbd..a22dbbe29 100644 --- a/roles/sap_swpm/tasks/swpm/swpm_pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -40,13 +40,27 @@ when: sap_swpm_use_password_file == "y" tags: sap_swpm_generate_inifile +# Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... +- name: SAP SWPM default mode - Determine Installation Type + ansible.builtin.include_tasks: + file: install_type.yml + apply: + tags: sap_swpm_generate_inifile + tags: sap_swpm_generate_inifile + # Create the SWPM inifile ## Run SWPM inifile generation based on ansible role mode - name: SAP SWPM Pre Install - Generate the SWPM inifile - ansible.builtin.include_tasks: "swpm_inifile_generate.yml" + ansible.builtin.include_tasks: "generate_inifile_params.yml" # ansible.builtin.include_tasks: "swpm_inifile_generate_{{ sap_swpm_ansible_role_mode }}.yml" tags: sap_swpm_generate_inifile +# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) +# Prepare Software +- name: SAP SWPM advanced mode - Prepare Software + ansible.builtin.include_tasks: prepare_software.yml + when: sap_swpm_run_sapinst + #- name: SAP SWPM Pre Install - Display the location of file 'inifile.params' # ansible.builtin.debug: # msg: "/tmp/inifile.params" diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml index b22ef3481..f2257998f 100644 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml +++ b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml @@ -24,16 +24,3 @@ msg: "{{ sap_swpm_inifile_reuse_source }} is not reusable" when: sap_swpm_inifile_read_file.stdout != '0' tags: sap_swpm_generate_inifile - -# Detect variables from generated inifile -- name: SAP SWPM inifile_reuse mode - Detect Variables - ansible.builtin.include_tasks: - file: detect_variables.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - -# Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) -# Prepare Software -- name: SAP SWPM inifile_reuse mode - Prepare Software - ansible.builtin.include_tasks: prepare_software.yml From 4ef0900d28f03baa181c88340d92cda99a9d42d1 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 6 Aug 2024 11:02:39 +0200 Subject: [PATCH 04/33] sap_swpm: Fix task name Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install/swpm_prepare.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index a22dbbe29..a5d56915f 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -57,7 +57,7 @@ # Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) # Prepare Software -- name: SAP SWPM advanced mode - Prepare Software +- name: SAP SWPM Pre Install - Prepare Software ansible.builtin.include_tasks: prepare_software.yml when: sap_swpm_run_sapinst From 73df28684e0d359103524cd95b8df371be3cb84f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 6 Aug 2024 12:16:05 +0200 Subject: [PATCH 05/33] sap_swpm: Speed up inifile generation if tag is specified Signed-off-by: Bernd Finger --- ...nifile_params.yml => generate_inifile.yml} | 40 ++++++------------- .../tasks/pre_install/swpm_prepare.yml | 30 +++++++------- 2 files changed, 27 insertions(+), 43 deletions(-) rename roles/sap_swpm/tasks/pre_install/{generate_inifile_params.yml => generate_inifile.yml} (80%) diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml similarity index 80% rename from roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml rename to roles/sap_swpm/tasks/pre_install/generate_inifile.yml index 71a004d1b..a635aa234 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile_params.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -6,6 +6,7 @@ ansible.builtin.include_tasks: "set_password_facts.yml" tags: sap_swpm_generate_inifile +# The following task is used for checking if an inifile exists on the managed node - name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists ansible.builtin.file: path: "{{ sap_swpm_inifile_directory }}" @@ -13,20 +14,20 @@ owner: 'root' group: 'root' mode: '0755' - tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Check if file '{{ sap_swpm_inifile_directory }}/inifile.params' exists ansible.builtin.stat: path: "{{ sap_swpm_inifile_directory }}/inifile.params" check_mode: no register: __sap_swpm_register_stat_sapinst_inifile - tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Notify about existing sapinst inifile ansible.builtin.debug: msg: "INFO: Using existing sapinst inifile '{{ sap_swpm_inifile_directory }}/inifile.params'." when: __sap_swpm_register_stat_sapinst_inifile.stat.exists +# Note: Attempting to fetch and store into sap_swpm_tmpdir_local.path results in a 'Permission denied' error. +# So we are using 'slurp'+'copy' for this purpose. - name: SAP SWPM Pre Install - Slurp the remote 'inifile.params' for copying to managed node ansible.builtin.slurp: src: "{{ sap_swpm_inifile_directory }}/inifile.params" @@ -43,26 +44,11 @@ delegate_to: localhost when: __sap_swpm_register_stat_sapinst_inifile.stat.exists -# Note: Attempting to fetch and store into sap_swpm_tmpdir_local.path results in a 'Permission denied' error. -#- name: SAP SWPM Pre Install - Download existing sapinst inifile to '{{ sap_swpm_local_inifile_directory }}' -# ansible.builtin.fetch: -# src: "{{ sap_swpm_inifile_directory }}/inifile.params" -# dest: "{{ sap_swpm_tmpdir_local.path }}/" -## dest: "{{ sap_swpm_local_inifile_directory }}/" -# flat: true -# become: true -# when: __sap_swpm_register_stat_sapinst_inifile.stat.exists - -#- name: SAP SWPM Pre Install - Copy sapinst inifile to '{{ sap_swpm_tmpdir_local.path }}' -# ansible.builtin.copy: -# src: "{{ sap_swpm_local_inifile_directory }}/inifile.params" -# dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" -# delegate_to: localhost -# when: __sap_swpm_register_stat_sapinst_inifile.stat.exists - +# We are creating the inifile dynamically in one of the two cases: +# 1 - The tag sap_swpm_generate_inifile is specified +# 2 - There is no file 'inifile.params' available in 'sap_swpm_inifile_directory' - name: SAP SWPM Pre Install - Create the SWPM inifile 'inifile.params' dynamically - when: - - not __sap_swpm_register_stat_sapinst_inifile.stat.exists + when: "'sap_swpm_generate_inifile' in ansible_run_tags or (not __sap_swpm_register_stat_sapinst_inifile.stat.exists)" block: # Generate inifile.params, step 1: Process SWPM Configfile template locally for creating inifile.params @@ -108,16 +94,16 @@ - name: SAP SWPM Pre Install - Detect Variables ansible.builtin.include_tasks: file: detect_variables_from_inifile.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile +# apply: +# tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Slurp the local 'inifile.params' for copying to managed node ansible.builtin.slurp: src: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" register: sap_swpm_slurped_local_inifile delegate_to: localhost - tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Copy 'inifile.params' to the managed node ansible.builtin.copy: @@ -126,9 +112,9 @@ owner: 'root' group: 'root' mode: '0640' - tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Display the path of the remote 'inifile.params' ansible.builtin.debug: msg: "The local inifile.params has been copied to: '{{ sap_swpm_tmpdir.path }}/inifile.params'" - tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index a5d56915f..e34fd5029 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -11,24 +11,24 @@ - sap_swpm_generate_inifile - sap_swpm_sapinst_commandline -- name: SAP SWPM Pre Install - Make the temporary directory on control node world readable - ansible.builtin.file: - path: "{{ sap_swpm_tmpdir_local.path }}" - state: directory - mode: '0777' - delegate_to: localhost - tags: - - sap_swpm_generate_inifile - - sap_swpm_sapinst_commandline +#- name: SAP SWPM Pre Install - Make the temporary directory on control node world readable +# ansible.builtin.file: +# path: "{{ sap_swpm_tmpdir_local.path }}" +# state: directory +# mode: '0777' +# delegate_to: localhost +# tags: +# - sap_swpm_generate_inifile +# - sap_swpm_sapinst_commandline - name: SAP SWPM Pre Install - Create temporary directory on managed node ansible.builtin.tempfile: state: directory suffix: _swpm_config register: sap_swpm_tmpdir - tags: - - sap_swpm_generate_inifile - - sap_swpm_sapinst_commandline +# tags: +# - sap_swpm_generate_inifile +# - sap_swpm_sapinst_commandline # Copy password file to the same location as inifile.params - name: SAP SWPM Pre Install - Copy password file to the same location as inifile.params @@ -38,7 +38,7 @@ remote_src: yes mode: '0640' when: sap_swpm_use_password_file == "y" - tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile # Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... - name: SAP SWPM default mode - Determine Installation Type @@ -49,10 +49,8 @@ tags: sap_swpm_generate_inifile # Create the SWPM inifile -## Run SWPM inifile generation based on ansible role mode - name: SAP SWPM Pre Install - Generate the SWPM inifile - ansible.builtin.include_tasks: "generate_inifile_params.yml" -# ansible.builtin.include_tasks: "swpm_inifile_generate_{{ sap_swpm_ansible_role_mode }}.yml" + ansible.builtin.include_tasks: "generate_inifile.yml" tags: sap_swpm_generate_inifile # Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) From e065e9f99e2cc799b62449123666cd0b70616f16 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 6 Aug 2024 15:52:20 +0200 Subject: [PATCH 06/33] sap_swpm: Integrate the inifile_reuse mode Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 2 +- .../tasks/pre_install/generate_inifile.yml | 63 ++++++++++++------- .../tasks/pre_install/swpm_prepare.yml | 9 +-- .../swpm_inifile_generate_inifile_reuse.yml | 26 -------- 4 files changed, 42 insertions(+), 58 deletions(-) delete mode 100644 roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index cf5b9ccb7..bb2b63f03 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -23,7 +23,7 @@ # Firewall -- name: SAP SWPM Pre Install - Firewall Setup +- name: SAP SWPM Pre Install - Setup Firewall ansible.builtin.include_tasks: file: pre_install/firewall.yml apply: diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml index a635aa234..2f026bbe1 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -7,7 +7,7 @@ tags: sap_swpm_generate_inifile # The following task is used for checking if an inifile exists on the managed node -- name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists +- name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists on the managed node ansible.builtin.file: path: "{{ sap_swpm_inifile_directory }}" state: directory @@ -15,44 +15,60 @@ group: 'root' mode: '0755' -- name: SAP SWPM Pre Install - Check if file '{{ sap_swpm_inifile_directory }}/inifile.params' exists +- name: SAP SWPM Pre Install - Check if file '{{ sap_swpm_inifile_directory }}/inifile.params' exists on the managed node ansible.builtin.stat: path: "{{ sap_swpm_inifile_directory }}/inifile.params" check_mode: no register: __sap_swpm_register_stat_sapinst_inifile -- name: SAP SWPM Pre Install - Notify about existing sapinst inifile - ansible.builtin.debug: - msg: "INFO: Using existing sapinst inifile '{{ sap_swpm_inifile_directory }}/inifile.params'." +- name: SAP SWPM Pre Install - Try using existing SWPM inifile 'inifile.params' when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + block: + + - name: SAP SWPM Pre Install, use existing inifile - Notify about existing sapinst inifile on the managed node + ansible.builtin.debug: + msg: "INFO: Using existing sapinst inifile '{{ sap_swpm_inifile_directory }}/inifile.params'." # Note: Attempting to fetch and store into sap_swpm_tmpdir_local.path results in a 'Permission denied' error. -# So we are using 'slurp'+'copy' for this purpose. -- name: SAP SWPM Pre Install - Slurp the remote 'inifile.params' for copying to managed node - ansible.builtin.slurp: - src: "{{ sap_swpm_inifile_directory }}/inifile.params" - register: sap_swpm_slurped_remote_inifile - when: __sap_swpm_register_stat_sapinst_inifile.stat.exists +# So we are using 'slurp' and 'copy' for this purpose. + - name: SAP SWPM Pre Install, use existing inifile - Slurp the remote 'inifile.params' for copying to control node + ansible.builtin.slurp: + src: "{{ sap_swpm_inifile_directory }}/inifile.params" + register: sap_swpm_slurped_remote_inifile -- name: SAP SWPM Pre Install - Copy 'inifile.params' to the control node - ansible.builtin.copy: - content: "{{ sap_swpm_slurped_remote_inifile['content'] | b64decode }}" - dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" - owner: 'root' - group: 'root' - mode: '0640' - delegate_to: localhost - when: __sap_swpm_register_stat_sapinst_inifile.stat.exists + - name: SAP SWPM Pre Install, existing inifile - Copy 'inifile.params' to the control node + ansible.builtin.copy: + content: "{{ sap_swpm_slurped_remote_inifile['content'] | b64decode }}" + dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + owner: 'root' + group: 'root' + mode: '0640' + delegate_to: localhost + +# Now we need to confirm that des25 is not in the inifile + - name: SAP SWPM Pre Install, use existing inifile - Search inifile for for des25 + ansible.builtin.shell: | + set -o pipefail && awk 'BEGIN{a=0}!/^#/&&/des25\(/{a++}END{print a}' {{ sap_swpm_tmpdir_local.path }}/inifile.params + delegate_to: localhost + register: sap_swpm_inifile_count_des25 + changed_when: false + + - name: SAP SWPM Pre Install, use existing inifile - Ensure that des25 is not present in inifile + ansible.builtin.fail: + msg: + - "Inifile '{{ sap_swpm_inifile_directory }}/inifile.params' cannot be reused because it contains des25 encrypted data." + - "See also SAP notes 2609804." + when: sap_swpm_inifile_count_des25.stdout != '0' # We are creating the inifile dynamically in one of the two cases: # 1 - The tag sap_swpm_generate_inifile is specified # 2 - There is no file 'inifile.params' available in 'sap_swpm_inifile_directory' -- name: SAP SWPM Pre Install - Create the SWPM inifile 'inifile.params' dynamically +- name: SAP SWPM Pre Install, create inifile - Create the SWPM inifile 'inifile.params' dynamically when: "'sap_swpm_generate_inifile' in ansible_run_tags or (not __sap_swpm_register_stat_sapinst_inifile.stat.exists)" block: # Generate inifile.params, step 1: Process SWPM Configfile template locally for creating inifile.params - - name: SAP SWPM Pre Install - Process SWPM inifile template for for creating 'inifile.params' + - name: SAP SWPM Pre Install, create inifile - Process SWPM inifile template for for creating 'inifile.params' ansible.builtin.template: src: "{{ role_path }}/templates/inifile_params.j2" dest: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" @@ -66,7 +82,7 @@ tags: sap_swpm_generate_inifile # Generate inifile.params, step 2: Use any entries from sap_swpm_inifile_parameters_dict - - name: SAP SWPM Pre Install - Replace existing, or add missing, any inifile.params entries from sap_swpm_inifile_parameters_dict + - name: SAP SWPM Pre Install, create inifile - Use any 'inifile.params' entries from sap_swpm_inifile_parameters_dict ansible.builtin.lineinfile: path: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" create: true @@ -117,4 +133,3 @@ - name: SAP SWPM Pre Install - Display the path of the remote 'inifile.params' ansible.builtin.debug: msg: "The local inifile.params has been copied to: '{{ sap_swpm_tmpdir.path }}/inifile.params'" -# tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index e34fd5029..0dc5718f1 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -17,18 +17,14 @@ # state: directory # mode: '0777' # delegate_to: localhost -# tags: -# - sap_swpm_generate_inifile -# - sap_swpm_sapinst_commandline - name: SAP SWPM Pre Install - Create temporary directory on managed node ansible.builtin.tempfile: state: directory suffix: _swpm_config register: sap_swpm_tmpdir -# tags: -# - sap_swpm_generate_inifile -# - sap_swpm_sapinst_commandline + tags: + - sap_swpm_sapinst_commandline # Copy password file to the same location as inifile.params - name: SAP SWPM Pre Install - Copy password file to the same location as inifile.params @@ -38,7 +34,6 @@ remote_src: yes mode: '0640' when: sap_swpm_use_password_file == "y" -# tags: sap_swpm_generate_inifile # Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... - name: SAP SWPM default mode - Determine Installation Type diff --git a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml b/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml deleted file mode 100644 index f2257998f..000000000 --- a/roles/sap_swpm/tasks/swpm/swpm_inifile_generate_inifile_reuse.yml +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Copy reused inifile -- name: SAP SWPM inifile_reuse mode - Copy reused inifile - ansible.builtin.copy: - src: "{{ sap_swpm_inifile_reuse_source }}" - dest: "{{ sap_swpm_tmpdir.path }}/inifile.params" - mode: '0640' - tags: sap_swpm_generate_inifile - -# Check inifile for the presence of a line containing "des25(" -- name: SAP SWPM inifile_reuse mode - Check inifile for des25 - ansible.builtin.shell: | - set -o pipefail && cat "{{ sap_swpm_tmpdir.path }}/inifile.params" | - awk 'BEGIN{a=0}!/^#/&&/des25\(/{a++}END{print a}' - register: sap_swpm_inifile_read_file - changed_when: false - tags: sap_swpm_generate_inifile - -# Check if inifile is reusable - function des25 must not be present in inifile -- name: SAP SWPM inifile_reuse mode - Check if inifile is reusable, meaning function des25 is not present - ansible.builtin.fail: - msg: "{{ sap_swpm_inifile_reuse_source }} is not reusable" - when: sap_swpm_inifile_read_file.stdout != '0' - tags: sap_swpm_generate_inifile From 7eb407d8a12b340f4e98e683503eb5335f69722e Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 7 Aug 2024 23:06:46 +0200 Subject: [PATCH 07/33] sap_swpm: Reorganize yml files, part 2 Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 4 +- .../tasks/pre_install/generate_inifile.yml | 37 ++++++++++++++----- .../tasks/pre_install/set_password_facts.yml | 24 ------------ .../tasks/pre_install/swpm_prepare.yml | 22 ++++------- roles/sap_swpm/templates/inifile_params.j2 | 2 +- 5 files changed, 38 insertions(+), 51 deletions(-) delete mode 100644 roles/sap_swpm/tasks/pre_install/set_password_facts.yml diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index bb2b63f03..d008bd965 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -3,8 +3,8 @@ - name: SAP SWPM Pre Install - Rename variables ansible.builtin.set_fact: - sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list) }}" - sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary | d(sap_swpm_inifile_parameters_dict) }}" + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list | d([]) ) }}" + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary | d(sap_swpm_inifile_parameters_dict) | d({}) }}" tags: always ################ diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml index 2f026bbe1..1061e6914 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -1,11 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Password Facts -- name: SAP SWPM Pre Install - Set password facts - ansible.builtin.include_tasks: "set_password_facts.yml" - tags: sap_swpm_generate_inifile - # The following task is used for checking if an inifile exists on the managed node - name: SAP SWPM Pre Install - Ensure the sapinst inifile directory '{{ sap_swpm_inifile_directory }}' exists on the managed node ansible.builtin.file: @@ -63,10 +58,37 @@ # We are creating the inifile dynamically in one of the two cases: # 1 - The tag sap_swpm_generate_inifile is specified # 2 - There is no file 'inifile.params' available in 'sap_swpm_inifile_directory' +# Prerequisite: Role parameter 'sap_swpm_product_catalog_id' is defined - name: SAP SWPM Pre Install, create inifile - Create the SWPM inifile 'inifile.params' dynamically when: "'sap_swpm_generate_inifile' in ansible_run_tags or (not __sap_swpm_register_stat_sapinst_inifile.stat.exists)" block: + - name: SAP SWPM Pre Install - Ensure role parameter 'sap_swpm_product_catalog_id' is defined + ansible.builtin.fail: + msg: + - "Role parameter 'sap_swpm_product_catalog_id' is not defined, so certain inifile entries cannot be determined." + - "Remediation: Define the role parameter 'sap_swpm_product_catalog_id' in your playbook or inventory and re-run the playbook." + when: sap_swpm_product_catalog_id is not defined + +# 3 tasks for setting password Facts, required for the template: + - name: SAP SWPM Pre Install - Set password facts when ABAP + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" + when: "'ABAP' in sap_swpm_product_catalog_id" + + - name: SAP SWPM Pre Install - Set password facts when Java + ansible.builtin.set_fact: + sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" + sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" + when: "'Java' in sap_swpm_product_catalog_id" + + - name: SAP SWPM Pre Install - Set other user passwords using master password + ansible.builtin.set_fact: + sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" + sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" + # Generate inifile.params, step 1: Process SWPM Configfile template locally for creating inifile.params - name: SAP SWPM Pre Install, create inifile - Process SWPM inifile template for for creating 'inifile.params' ansible.builtin.template: @@ -110,16 +132,12 @@ - name: SAP SWPM Pre Install - Detect Variables ansible.builtin.include_tasks: file: detect_variables_from_inifile.yml -# apply: -# tags: sap_swpm_generate_inifile -# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Slurp the local 'inifile.params' for copying to managed node ansible.builtin.slurp: src: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" register: sap_swpm_slurped_local_inifile delegate_to: localhost -# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Copy 'inifile.params' to the managed node ansible.builtin.copy: @@ -128,7 +146,6 @@ owner: 'root' group: 'root' mode: '0640' -# tags: sap_swpm_generate_inifile - name: SAP SWPM Pre Install - Display the path of the remote 'inifile.params' ansible.builtin.debug: diff --git a/roles/sap_swpm/tasks/pre_install/set_password_facts.yml b/roles/sap_swpm/tasks/pre_install/set_password_facts.yml deleted file mode 100644 index 96010efba..000000000 --- a/roles/sap_swpm/tasks/pre_install/set_password_facts.yml +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- - -# Password Facts -- name: SAP SWPM Pre Install - Set password facts when ABAP - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_abap_password }}" - when: "'ABAP' in sap_swpm_product_catalog_id" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM Pre Install - Set password facts when Java - ansible.builtin.set_fact: - sap_swpm_db_schema: "{{ sap_swpm_db_schema_java }}" - sap_swpm_db_schema_password: "{{ sap_swpm_db_schema_java_password }}" - when: "'Java' in sap_swpm_product_catalog_id" - tags: sap_swpm_generate_inifile - -- name: SAP SWPM Pre Install - Set other user passwords using master password - ansible.builtin.set_fact: - sap_swpm_sapadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_sap_sidadm_password: "{{ sap_swpm_master_password }}" - sap_swpm_diagnostics_agent_password: "{{ sap_swpm_master_password }}" - tags: sap_swpm_generate_inifile diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index 0dc5718f1..aef72126c 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -35,31 +35,25 @@ mode: '0640' when: sap_swpm_use_password_file == "y" -# Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... -- name: SAP SWPM default mode - Determine Installation Type - ansible.builtin.include_tasks: - file: install_type.yml - apply: - tags: sap_swpm_generate_inifile - tags: sap_swpm_generate_inifile - # Create the SWPM inifile - name: SAP SWPM Pre Install - Generate the SWPM inifile ansible.builtin.include_tasks: "generate_inifile.yml" tags: sap_swpm_generate_inifile +# Determine Installation Type, e.g. System Copy, HA, Maintenance Planner, ... +- name: SAP SWPM default mode - Determine Installation Type + ansible.builtin.include_tasks: + file: install_type.yml +# apply: +# tags: sap_swpm_generate_inifile +# tags: sap_swpm_generate_inifile + # Requires variables - sap_swpm_software_path (e.g. /software/download_basket), sap_swpm_sapcar_path (e.g. /software/sapcar), sap_swpm_swpm_path (e.g. /software/swpm) # Prepare Software - name: SAP SWPM Pre Install - Prepare Software ansible.builtin.include_tasks: prepare_software.yml when: sap_swpm_run_sapinst -#- name: SAP SWPM Pre Install - Display the location of file 'inifile.params' -# ansible.builtin.debug: -# msg: "/tmp/inifile.params" -# msg: "{{ sap_swpm_tmpdir.path }}/inifile.params" -# tags: sap_swpm_generate_inifile - # Set fact for SWPM path - name: SAP SWPM Pre Install - Set fact for SWPM path when extract directory defined ansible.builtin.set_fact: diff --git a/roles/sap_swpm/templates/inifile_params.j2 b/roles/sap_swpm/templates/inifile_params.j2 index 576259d92..09dafcfa5 100644 --- a/roles/sap_swpm/templates/inifile_params.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -1,4 +1,4 @@ -### inifile.params generated for SWPM. Product Catalog ID is {{ sap_swpm_product_catalog_id }} . +### inifile.params generated for SWPM - Product Catalog ID is {{ sap_swpm_product_catalog_id }} {% if 'swpm_installation_media' in sap_swpm_inifile_sections_list %} ################################################################### From a9323cd2574d74b6b79013f5d932b60c22bc5f79 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 9 Aug 2024 11:58:42 +0200 Subject: [PATCH 08/33] sap_swpm: Improve variable detection Signed-off-by: Bernd Finger --- roles/sap_swpm/defaults/main.yml | 4 +- .../detect_variables_from_inifile.yml | 64 +++-------- .../tasks/pre_install/generate_inifile.yml | 105 ++++++++++++------ .../tasks/pre_install/swpm_prepare.yml | 7 -- roles/sap_swpm/templates/inifile_params.j2 | 2 +- 5 files changed, 92 insertions(+), 90 deletions(-) diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 9977972ec..8bb00e901 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -156,7 +156,7 @@ sap_swpm_software_extract_directory: # e.g. /software/sap_swpm_extracted sap_swpm_software_use_media: 'false' # Main path that this role will look for .SAR files -sap_swpm_software_path: /software/sapfiles +#sap_swpm_software_path: /software/sapfiles ## This directory path should include these files: ## - igs*sar ## - igshelper*sar @@ -166,7 +166,7 @@ sap_swpm_software_path: /software/sapfiles ## - SAPHOSTAGENT*SAR # Directory in which a sapinst inifile which is to be used by the role can be stored: -sap_swpm_inifile_directory: "{{ sap_swpm_software_path }}/inifiles" +sap_swpm_inifile_directory: '/software/sap_swpm/inifiles' #sap_swpm_local_inifile_directory: '/tmp/inifiles' # SWPM1 - paths that this role will look for CD Media software diff --git a/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml b/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml index ce9dc4794..7d362714e 100644 --- a/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml @@ -2,7 +2,7 @@ --- # Detect Product ID -- name: SAP SWPM - Detect Product ID +- name: SAP SWPM Pre Install - Detect Product ID from inifile ansible.builtin.command: | awk 'BEGIN{IGNORECASE=1;a=0} /Product ID/&&a==0{a=1; gsub ("#", ""); gsub ("\047", ""); product_id=$NF} @@ -10,75 +10,43 @@ delegate_to: localhost register: sap_swpm_inifile_product_id_detect changed_when: false - when: not sap_swpm_product_catalog_id is defined -# Set fact for product id -- name: SAP SWPM - Set SAP product ID +- name: SAP SWPM Pre Install - Set SAP product ID ansible.builtin.set_fact: sap_swpm_product_catalog_id: "{{ sap_swpm_inifile_product_id_detect.stdout }}" - when: not sap_swpm_product_catalog_id is defined -- 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 +# Detect and set Software Path +- name: SAP SWPM Pre Install - Detect Software Path from inifile ansible.builtin.command: | awk '!/^#/&&/archives.downloadBasket/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params delegate_to: localhost - register: sap_swpm_inifile_software_path + register: sap_swpm_inifile_software_path_detect changed_when: false - when: not sap_swpm_software_path is defined -# Set fact for software path -- name: SAP SWPM - Set Software Path +- name: SAP SWPM Pre Install - Set Software Path ansible.builtin.set_fact: - sap_swpm_software_path: "{{ sap_swpm_inifile_software_path.stdout }}" - when: not sap_swpm_software_path is defined - -- name: SAP SWPM - Display Software Path - ansible.builtin.debug: - msg: - - "Software path is {{ sap_swpm_software_path }}" + sap_swpm_software_path: "{{ sap_swpm_inifile_software_path_detect.stdout }}" -# Detect SID -- name: SAP SWPM - Detect SID +# Detect and set SID +- name: SAP SWPM Pre Install - Detect SID from inifile ansible.builtin.command: | awk '!/^#/&&/NW_GetSidNoProfiles.sid/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params delegate_to: localhost - register: sap_swpm_inifile_sid + register: sap_swpm_inifile_sid_detect changed_when: false - when: not sap_swpm_sid is defined -# Set fact for SID -- name: SAP SWPM - Set SID +- name: SAP SWPM Pre Install - Set SID from inifile ansible.builtin.set_fact: - sap_swpm_sid: "{{ sap_swpm_inifile_sid.stdout }}" - when: not sap_swpm_sid is defined - -- name: SAP SWPM - Display SAP SID - ansible.builtin.debug: - msg: - - "SAP SID {{ sap_swpm_sid }}" + sap_swpm_sid: "{{ sap_swpm_inifile_sid_detect.stdout }}" # Detect FQDN -- name: SAP SWPM - Detect FQDN +- name: SAP SWPM Pre Install - Detect FQDN from inifile ansible.builtin.command: | awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params delegate_to: localhost - register: sap_swpm_inifile_fqdn + register: sap_swpm_inifile_fqdn_detect changed_when: false - when: not sap_swpm_fqdn is defined -# Set fact for FQDN -- name: SAP SWPM - Set FQDN +- name: SAP SWPM Pre Install - Set FQDN ansible.builtin.set_fact: - sap_swpm_fqdn: "{{ sap_swpm_inifile_fqdn.stdout }}" - when: not sap_swpm_fqdn is defined - -- name: SAP SWPM - Display FQDN - ansible.builtin.debug: - msg: - - "SAP fqdn {{ sap_swpm_fqdn }}" + sap_swpm_fqdn: "{{ sap_swpm_inifile_fqdn_detect.stdout }}" diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml index 1061e6914..c8cdf1dd1 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -20,13 +20,13 @@ when: __sap_swpm_register_stat_sapinst_inifile.stat.exists block: - - name: SAP SWPM Pre Install, use existing inifile - Notify about existing sapinst inifile on the managed node + - name: SAP SWPM Pre Install, existing inifile - Notify about existing sapinst inifile on the managed node ansible.builtin.debug: msg: "INFO: Using existing sapinst inifile '{{ sap_swpm_inifile_directory }}/inifile.params'." # Note: Attempting to fetch and store into sap_swpm_tmpdir_local.path results in a 'Permission denied' error. # So we are using 'slurp' and 'copy' for this purpose. - - name: SAP SWPM Pre Install, use existing inifile - Slurp the remote 'inifile.params' for copying to control node + - name: SAP SWPM Pre Install, existing inifile - Slurp the remote 'inifile.params' for copying to control node ansible.builtin.slurp: src: "{{ sap_swpm_inifile_directory }}/inifile.params" register: sap_swpm_slurped_remote_inifile @@ -41,36 +41,66 @@ delegate_to: localhost # Now we need to confirm that des25 is not in the inifile - - name: SAP SWPM Pre Install, use existing inifile - Search inifile for for des25 + - name: SAP SWPM Pre Install, existing inifile - Search inifile for for des25 ansible.builtin.shell: | set -o pipefail && awk 'BEGIN{a=0}!/^#/&&/des25\(/{a++}END{print a}' {{ sap_swpm_tmpdir_local.path }}/inifile.params delegate_to: localhost register: sap_swpm_inifile_count_des25 changed_when: false - - name: SAP SWPM Pre Install, use existing inifile - Ensure that des25 is not present in inifile + - name: SAP SWPM Pre Install, existing inifile - Ensure that des25 is not present in inifile ansible.builtin.fail: msg: - "Inifile '{{ sap_swpm_inifile_directory }}/inifile.params' cannot be reused because it contains des25 encrypted data." - "See also SAP notes 2609804." when: sap_swpm_inifile_count_des25.stdout != '0' + - name: SAP SWPM Pre Install - Detect Variables + ansible.builtin.import_tasks: + file: detect_variables_from_inifile.yml + +# At this point, the following variables need to be set: +# sap_swpm_product_catalog_id, sap_swpm_software_path, sap_swpm_sid, sap_swpm_fqdn +- name: SAP SWPM Pre Install - Assert that certain variables are set + ansible.builtin.assert: + that: "{{ __sap_swpm_vars_line_item }} is defined and {{ __sap_swpm_vars_line_item }}" + fail_msg: "FAIL: '{{ __sap_swpm_vars_line_item }}' is either undefined or empty!" + success_msg: "PASS: '{{ __sap_swpm_vars_line_item }}' is set.<" + loop: + - sap_swpm_product_catalog_id + - sap_swpm_software_path + - sap_swpm_sid + - sap_swpm_fqdn + loop_control: + loop_var: __sap_swpm_vars_line_item + label: __sap_swpm_vars_line_item + tags: sap_swpm_generate_inifile + +- name: SAP SWPM Pre Install - Display these variables + ansible.builtin.debug: + msg: + - "sap_swpm_product_catalog_id: >{{ sap_swpm_product_catalog_id }}<" + - "sap_swpm_software_path: >{{ sap_swpm_software_path }}<" + - "sap_swpm_sid: >{{ sap_swpm_sid }}<" + - "sap_swpm_fqdn: >{{ sap_swpm_fqdn }}<" + # We are creating the inifile dynamically in one of the two cases: # 1 - The tag sap_swpm_generate_inifile is specified # 2 - There is no file 'inifile.params' available in 'sap_swpm_inifile_directory' # Prerequisite: Role parameter 'sap_swpm_product_catalog_id' is defined - name: SAP SWPM Pre Install, create inifile - Create the SWPM inifile 'inifile.params' dynamically when: "'sap_swpm_generate_inifile' in ansible_run_tags or (not __sap_swpm_register_stat_sapinst_inifile.stat.exists)" + tags: sap_swpm_generate_inifile block: - - name: SAP SWPM Pre Install - Ensure role parameter 'sap_swpm_product_catalog_id' is defined - ansible.builtin.fail: - msg: - - "Role parameter 'sap_swpm_product_catalog_id' is not defined, so certain inifile entries cannot be determined." - - "Remediation: Define the role parameter 'sap_swpm_product_catalog_id' in your playbook or inventory and re-run the playbook." - when: sap_swpm_product_catalog_id is not defined +# - name: SAP SWPM Pre Install - Ensure role parameter 'sap_swpm_product_catalog_id' is defined +# ansible.builtin.fail: +# msg: +# - "Role parameter 'sap_swpm_product_catalog_id' is empty or not defined, so certain inifile entries cannot be determined." +# - "Remediation: Define the role parameter 'sap_swpm_product_catalog_id' in your playbook or inventory and re-run the playbook." +# when: sap_swpm_product_catalog_id is not defined or not sap_swpm_product_catalog_id -# 3 tasks for setting password Facts, required for the template: +# 3 tasks for setting password Facts, required by the template: - name: SAP SWPM Pre Install - Set password facts when ABAP ansible.builtin.set_fact: sap_swpm_db_schema: "{{ sap_swpm_db_schema_abap }}" @@ -101,38 +131,49 @@ when: - sap_swpm_inifile_sections_list is defined - sap_swpm_inifile_sections_list | length > 0 - tags: sap_swpm_generate_inifile # Generate inifile.params, step 2: Use any entries from sap_swpm_inifile_parameters_dict - - name: SAP SWPM Pre Install, create inifile - Use any 'inifile.params' entries from sap_swpm_inifile_parameters_dict - ansible.builtin.lineinfile: - path: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" - create: true - state: present - line: "{{ sap_swpm_line_item.key }} = {{ sap_swpm_line_item.value }}" - regexp: "^{{ sap_swpm_line_item.key }}[\\s]*=[\\s]*.*" - owner: 'root' - group: 'root' - mode: '0640' - loop: "{{ sap_swpm_inifile_parameters_dict | dict2items }}" - loop_control: - loop_var: sap_swpm_line_item - register: replace_result - delegate_to: localhost + - name: SAP SWPM Pre Install, create inifile - Use any 'inifile.params' entries from 'sap_swpm_inifile_parameters_dict' when: - sap_swpm_inifile_parameters_dict is defined - sap_swpm_inifile_parameters_dict | length > 0 - tags: sap_swpm_generate_inifile + block: + + - name: SAP SWPM Pre Install, create inifile - Configure entries in 'inifile.params' from 'sap_swpm_inifile_parameters_dict' + ansible.builtin.lineinfile: + path: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" + create: true + state: present + line: "{{ sap_swpm_line_item.key }} = {{ sap_swpm_line_item.value }}" + regexp: "^{{ sap_swpm_line_item.key }}[\\s]*=[\\s]*.*" + owner: 'root' + group: 'root' + mode: '0640' + loop: "{{ sap_swpm_inifile_parameters_dict | dict2items }}" + loop_control: + loop_var: sap_swpm_line_item + register: replace_result + delegate_to: localhost + + - name: SAP SWPM Pre Install, create inifile - Detect variables again if 'sap_swpm_inifile_parameters_dict' had been used + ansible.builtin.import_tasks: + file: detect_variables_from_inifile.yml + delegate_to: localhost + + - name: SAP SWPM Pre Install, create inifile - Display these variables again if 'sap_swpm_inifile_parameters_dict' had been used + ansible.builtin.debug: + msg: + - "sap_swpm_product_catalog_id: >{{ sap_swpm_product_catalog_id }}<" + - "sap_swpm_software_path: >{{ sap_swpm_software_path }}<" + - "sap_swpm_sid: >{{ sap_swpm_sid }}<" + - "sap_swpm_fqdn: >{{ sap_swpm_fqdn }}<" + delegate_to: localhost - name: SAP SWPM Pre Install - Display the path of the local 'inifile.params' ansible.builtin.debug: msg: "The local inifile.params is: '{{ sap_swpm_tmpdir_local.path }}/inifile.params'" tags: sap_swpm_generate_inifile -- name: SAP SWPM Pre Install - Detect Variables - ansible.builtin.include_tasks: - file: detect_variables_from_inifile.yml - - name: SAP SWPM Pre Install - Slurp the local 'inifile.params' for copying to managed node ansible.builtin.slurp: src: "{{ sap_swpm_tmpdir_local.path }}/inifile.params" diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index aef72126c..bbb21945a 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -11,13 +11,6 @@ - sap_swpm_generate_inifile - sap_swpm_sapinst_commandline -#- name: SAP SWPM Pre Install - Make the temporary directory on control node world readable -# ansible.builtin.file: -# path: "{{ sap_swpm_tmpdir_local.path }}" -# state: directory -# mode: '0777' -# delegate_to: localhost - - name: SAP SWPM Pre Install - Create temporary directory on managed node ansible.builtin.tempfile: state: directory diff --git a/roles/sap_swpm/templates/inifile_params.j2 b/roles/sap_swpm/templates/inifile_params.j2 index 09dafcfa5..341be8d38 100644 --- a/roles/sap_swpm/templates/inifile_params.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -1,4 +1,4 @@ -### inifile.params generated for SWPM - Product Catalog ID is {{ sap_swpm_product_catalog_id }} +### inifile.params generated for SWPM - Product ID is {{ sap_swpm_product_catalog_id }} {% if 'swpm_installation_media' in sap_swpm_inifile_sections_list %} ################################################################### From f3b238183c6fb1b2a5ab8bf03c8d94568cea4717 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 12 Aug 2024 11:46:36 +0200 Subject: [PATCH 09/33] sap_swpm: Fix typo in README.md Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index f9e03a94b..ae850ff2d 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -182,7 +182,7 @@ sap_swpm_inifile_parameters_dict: It is also possible to use method 1 for creating the inifile and then replace or set additional variables using method 2: Just define both of the related parameters, `sap_swpm_inifile_sections_list` and `sap_swpm_inifile_parameters_dict`. -- The file inifile.params is then transferred to a temporary directory on the control node, to be used by the sapinst process. +- The file inifile.params is then transferred to a temporary directory on the managed node, to be used by the sapinst process. ### SAP SWPM From 18a74466b1a6bde7d908744ff4070e2f2f4e2ebd Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 15 Aug 2024 16:13:01 +0200 Subject: [PATCH 10/33] sap_swpm: Add certain parameter consistency checks Signed-off-by: Bernd Finger --- .../detect_variables_from_inifile.yml | 34 +++++++++++++++++-- .../tasks/pre_install/generate_inifile.yml | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml b/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml index 7d362714e..541378960 100644 --- a/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/detect_variables_from_inifile.yml @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Detect Product ID +# Detect and set Product ID - name: SAP SWPM Pre Install - Detect Product ID from inifile ansible.builtin.command: | awk 'BEGIN{IGNORECASE=1;a=0} @@ -11,6 +11,13 @@ register: sap_swpm_inifile_product_id_detect changed_when: false +- name: SAP SWPM Pre Install - Report if 'sap_swpm_product_catalog_id' has been defined differently + ansible.builtin.debug: + msg: "NOTE: The Product ID in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_inifile_product_id_detect'." + when: + - sap_swpm_product_catalog_id + - sap_swpm_inifile_product_id_detect.stdout != sap_swpm_product_catalog_id + - name: SAP SWPM Pre Install - Set SAP product ID ansible.builtin.set_fact: sap_swpm_product_catalog_id: "{{ sap_swpm_inifile_product_id_detect.stdout }}" @@ -23,6 +30,13 @@ register: sap_swpm_inifile_software_path_detect changed_when: false +- name: SAP SWPM Pre Install - Report if 'sap_swpm_software_path' has been defined differently + ansible.builtin.debug: + msg: "NOTE: The Software Path in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_software_path'." + when: + - sap_swpm_software_path + - sap_swpm_inifile_software_path_detect.stdout != sap_swpm_software_path + - name: SAP SWPM Pre Install - Set Software Path ansible.builtin.set_fact: sap_swpm_software_path: "{{ sap_swpm_inifile_software_path_detect.stdout }}" @@ -35,11 +49,18 @@ register: sap_swpm_inifile_sid_detect changed_when: false -- name: SAP SWPM Pre Install - Set SID from inifile +- name: SAP SWPM Pre Install - Report if 'sap_swpm_sid' has been defined differently + ansible.builtin.debug: + msg: "NOTE: The SID in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_sid'." + when: + - sap_swpm_sid + - sap_swpm_inifile_sid_detect.stdout != sap_swpm_sid + +- name: SAP SWPM Pre Install - Set SID ansible.builtin.set_fact: sap_swpm_sid: "{{ sap_swpm_inifile_sid_detect.stdout }}" -# Detect FQDN +# Detect and set FQDN - name: SAP SWPM Pre Install - Detect FQDN from inifile ansible.builtin.command: | awk '!/^#/&&/NW_getFQDN.FQDN/{print $3}' {{ sap_swpm_tmpdir_local.path }}/inifile.params @@ -47,6 +68,13 @@ register: sap_swpm_inifile_fqdn_detect changed_when: false +- name: SAP SWPM Pre Install - Report if 'sap_swpm_fqdn' has been defined differently + ansible.builtin.debug: + msg: "NOTE: The FQDN in '{{ sap_swpm_tmpdir_local.path }}/inifile.params' is different from the role parameter 'sap_swpm_fqdn'." + when: + - sap_swpm_fqdn + - sap_swpm_inifile_sid_detect.stdout != sap_swpm_fqdn + - name: SAP SWPM Pre Install - Set FQDN ansible.builtin.set_fact: sap_swpm_fqdn: "{{ sap_swpm_inifile_fqdn_detect.stdout }}" diff --git a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml index c8cdf1dd1..53f4809ff 100644 --- a/roles/sap_swpm/tasks/pre_install/generate_inifile.yml +++ b/roles/sap_swpm/tasks/pre_install/generate_inifile.yml @@ -65,7 +65,7 @@ ansible.builtin.assert: that: "{{ __sap_swpm_vars_line_item }} is defined and {{ __sap_swpm_vars_line_item }}" fail_msg: "FAIL: '{{ __sap_swpm_vars_line_item }}' is either undefined or empty!" - success_msg: "PASS: '{{ __sap_swpm_vars_line_item }}' is set.<" + success_msg: "PASS: '{{ __sap_swpm_vars_line_item }}' is set." loop: - sap_swpm_product_catalog_id - sap_swpm_software_path From 61f1b7d50b86ab0fe7d159169ac017d7cd84f673 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 22 Aug 2024 14:05:30 +0200 Subject: [PATCH 11/33] sap_swpm: Adapt README.md Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 69 ++++++++-------------------------------- 1 file changed, 14 insertions(+), 55 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index ae850ff2d..410e4f4b8 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -63,59 +63,17 @@ This role has been tested and working for the following SAP products ### Input Parameters The inputs are critical for running this role - - Determines the installation type - - Incomplete parameters will result to failure - - Wrong parameters will result to failure + - Incomplete parameters will result in failure + - Wrong parameters will result in failure Create an input file which contains all relevant installation information. Sample input files are stored in the [inputs](/playbooks/vars) folder of this Ansible collection. Use the samples as guide for your desired installation ### Default Parameters -### Default Parameters - Please check the default parameters file for more information on other parameters that can be used as an input: - [**sap_swpm** default parameters](defaults/main.yml) -Sample Playbooks and sample parameters are shown in the Ansible Collection `/playbooks` directory. - -The Ansible Collection `/playbooks` directory includes sample playbooks for using the `sap_swpm` Ansible Role in the following 'modes': -- Default -- Default Templates -- Advanced -- Advanced Templates -- Inifile Reuse - -The Ansible Collection `/playbooks/vars` directory includes sample variable files for: -- `sap_swpm` 'Default mode' to generate inifile.params of... - - SAP BW/4HANA OneHost - - SAP S/4HANA Distributed - ASCS, DBCI, ERS, PAS - - SAP S/4HANA OneHost - - SAP S/4HANA System Copy OneHost - - SAP Solution Manager (ABAP) - - SAP Solution Manager (JAVA) - - SAP Web Dispatcher - - SAP System Rename -- `sap_swpm` 'Default Templates mode' to generate inifile.params of... - - SAP S/4HANA OneHost - - SAP S/4HANA System Copy OneHost - - SAP System Rename -- `sap_swpm` 'Advanced mode' to generate inifile.params of... - - SAP S/4HANA OneHost -- `sap_swpm` 'Advanced Templates mode' to generate inifile.params of... - - SAP BW/4HANA OneHost - - SAP S/4HANA Distributed - ASCS, DBCI, ERS, PAS - - SAP S/4HANA OneHost - - SAP S/4HANA System Copy OneHost - - SAP Solution Manager (ABAP) - - SAP Solution Manager (JAVA) - - SAP Web Dispatcher - - SAP System Rename -- `sap_swpm` 'Inifile Reuse mode' inifile.params file for... - - SAP S/4HANA OneHost - -NOTE: these are only sample files, they are meant to be edited by the user before execution and do not cover all scenarios possible (the Ansible Role can execute ant SAP SWPM installation) - ## Execution Sample Ansible Playbook Execution @@ -133,7 +91,7 @@ Sample Ansible Playbook Execution - hosts: all become: true roles: - - { role: sap_swpm } + - sap_swpm ``` ## Execution Flow @@ -153,22 +111,22 @@ Sample Ansible Playbook Execution - Get all .SAR filenames from `sap_swpm_software_path` -- Update `/etc/hosts` (optional - yes by default) +- Update `/etc/hosts` (optional - `false` by default) -- Apply firewall rules for SAP HANA (optional - no by default) +- Apply firewall rules for SAP HANA (optional - `false` by default) -- At this stage, a sapinst inifile is created by the role on the control node if not already present. +- At this stage, the role is searching for a sapinst inifile on the managed node, or it will create one: - If a file `inifile.params` is located on the managed node in the directory specified in `sap_swpm_inifile_directory`, the role will not create a new one but rather download this file to the control node. - - If such a file does not exist, the role will create an SAP SWPM `inifile.params` file by one of the following methods: + - If such a file does *not* exist, the role will create an SAP SWPM `inifile.params` file by one of the following methods: Method 1: Predefined sections of the file inifile_params.j2 will be used to create the file `inifile.params`. - The variable `sap_swpm_inifile_sections_list` determines which sections will be used. All other sections will be ignored. - The inifile parameters themselves will be set according to other role parameters. + The variable `sap_swpm_inifile_sections_list` contains a list of sections which will part of the file `inifile.params`. + All other sections will be ignored. The inifile parameters themselves will be set according to other role parameters. Example: The inifile parameter `archives.downloadBasket` will be set to the content of the role parameter - `sap_swpm_software_path` + `sap_swpm_software_path`. Method 2: The file `inifile.params` will be configured from the content of the dictionary `sap_swpm_inifile_parameters_dict`. This dictionary is defined like in the following example: @@ -182,7 +140,7 @@ sap_swpm_inifile_parameters_dict: It is also possible to use method 1 for creating the inifile and then replace or set additional variables using method 2: Just define both of the related parameters, `sap_swpm_inifile_sections_list` and `sap_swpm_inifile_parameters_dict`. -- The file inifile.params is then transferred to a temporary directory on the managed node, to be used by the sapinst process. +- The file `inifile.params` is then transferred to a temporary directory on the managed node, to be used by the sapinst process. ### SAP SWPM @@ -192,12 +150,13 @@ sap_swpm_inifile_parameters_dict: - Set expiry of Unix created users to 'never' -- Apply firewall rules for SAP NW (optional - no by default) +- Apply firewall rules for SAP NW (optional - false by default) ## Tags With the following tags, the role can be called to perform certain activities only: -- tag `sap_swpm_generate_inifile`: Only create the sapinst inifile. This can be useful for checking if the inifile is created as desired. +- tag `sap_swpm_generate_inifile`: Only create the sapinst inifile, without running most of the preinstall steps. + This can be useful for checking if the inifile is created as desired. - tag `sap_swpm_sapinst_commandline`: Only show the sapinst command line. - tag `sap_swpm_pre_install`: Perform all preinstallation steps, then exit. - tag `sap_swpm_setup_firewall`: Only perform the firewall preinstallation settings (but only if variable `sap_swpm_setup_firewall` is set to `true`). From f7e5ef733fa6813ca43bd079b6d952259486dc73 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 22 Aug 2024 15:51:19 +0200 Subject: [PATCH 12/33] sap_swpm: Explain how to migrate playbooks Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 52 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 410e4f4b8..bd5b0d255 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -67,13 +67,63 @@ The inputs are critical for running this role - Wrong parameters will result in failure Create an input file which contains all relevant installation information. -Sample input files are stored in the [inputs](/playbooks/vars) folder of this Ansible collection. Use the samples as guide for your desired installation +Sample input files are stored in the [inputs](/playbooks/vars) folder of this Ansible collection. Use the samples as guide for your desired installation. ### Default Parameters Please check the default parameters file for more information on other parameters that can be used as an input: - [**sap_swpm** default parameters](defaults/main.yml) +### Migrating playbooks from previous versions of sap_swpm +The following role parameter is no longer used because there are no role `modes` any more: +#### sap_swpm_ansible_role_mode + +The following two role parameters have been renamed, without automatic conversion between old and new name: + +#### sap_swpm_inifile_list -> sap_swpm_inifile_sections_list +Previous name: sap_swpm_inifile_list +New name: sap_swpm_inifile_sections_list +Reason: This variable contains sections of the sapinst input file, `inifile.params`. +The new variable name is reflecting this purpose. + +#### sap_swpm_inifile_custom_values_dictionary -> sap_swpm_inifile_parameters_dict +Previous name: sap_swpm_inifile_custom_values_dictionary +New name: sap_swpm_inifile_parameters_dict +Reason: This variable contains parameter names and values of the sapinst input file, `inifile.params`. +The new variable name is reflecting this purpose. + +#### Migration from the `*_templates` modes of the previous version of sap_swpm +The role `sap_swpm` does no longer use the dictionary `sap_swpm_templates_install_dictionary`. +This dictionary was used in the previous role modes `default_templates` and `advanced_templates. + +Because of this, required low level members of `sap_swpm_templates_install_dictionary` have to be redefined to top level variables. +Creating top level variables from low level members of a dict can be done: + +- in a separate task using ansible.builtin.set_fact before calling sap_swpm, or + +- in the task calling sap_swpm with a vars: section of the task calling sap_swpm. + +Be aware of the following limitation: You cannot define a variable in the same task in which you use this variable to access a member +of another variable. Any variable which is used to access low level dict members has to be defined before, in a separate task. + +Example: +For defining `sap_swpm_product_catalog_id` from a low level member of `sap_swpm_templates_install_dictionary`, use the following code: + +``` +# Step 1: Define level 2 dict member for accessing level 3 dict member in the following task +- name: Define variable sap_swpm_templates_product_input + ansible.builtin.set_fact: + sap_swpm_templates_product_input: "{{ sap_swpm_templates_product_input_prefix }}_nwas_ascs_ha" + +# Step 2: Define top level variable from level 3 dict member +- name: Define variables sap_swpm_product_catalog_id and sap_swpm_inifile_sections_list + ansible.builtin.set_fact: + sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" + sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input][sap_swpm_inifile_sections_list] }}" + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] }}" + +``` + ## Execution Sample Ansible Playbook Execution From 16fd86fa3c83ee888066d9b7eb180f03b0a9ce0d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 22 Aug 2024 16:21:01 +0200 Subject: [PATCH 13/33] sap_swpm: Fix two typos in inifile_params.j2 Signed-off-by: Bernd Finger --- roles/sap_swpm/templates/inifile_params.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/templates/inifile_params.j2 b/roles/sap_swpm/templates/inifile_params.j2 index 341be8d38..56da03da8 100644 --- a/roles/sap_swpm/templates/inifile_params.j2 +++ b/roles/sap_swpm/templates/inifile_params.j2 @@ -585,12 +585,12 @@ NW_DB6_DB.db6.abap.schema = sap{{ sap_swpm_sid | lower }} {% if 'db_connection_nw_anydb_oracledb' in sap_swpm_inifile_sections_list %} ################################################################### -# BEGIN secion db_connection_nw_anydb_oracledb # +# BEGIN section db_connection_nw_anydb_oracledb # # # storageBasedCopy.abapSchemaPassword = {{ sap_swpm_db_schema_abap_password }} storageBasedCopy.javaSchemaPassword = {{ sap_swpm_db_schema_java_password }} # # -# END secion db_connection_nw_anydb_oracledb # +# END section db_connection_nw_anydb_oracledb # ################################################################### {% endif %} {% if 'db_connection_nw_anydb_sapase' in sap_swpm_inifile_sections_list %} From 03f372bc5b553ee9b3dfa6f494785d9163ee2acb Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 5 Sep 2024 10:07:33 +0200 Subject: [PATCH 14/33] sap_swpm: Add missing single reverse quote Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index bd5b0d255..6fec3a0c5 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -94,7 +94,7 @@ The new variable name is reflecting this purpose. #### Migration from the `*_templates` modes of the previous version of sap_swpm The role `sap_swpm` does no longer use the dictionary `sap_swpm_templates_install_dictionary`. -This dictionary was used in the previous role modes `default_templates` and `advanced_templates. +This dictionary was used in the previous role modes `default_templates` and `advanced_templates`. Because of this, required low level members of `sap_swpm_templates_install_dictionary` have to be redefined to top level variables. Creating top level variables from low level members of a dict can be done: From f039b145dddb0e902aa132e1f6c49bc1a4844389 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 5 Sep 2024 10:21:56 +0200 Subject: [PATCH 15/33] sap_swpm: Repeat PR #850 and solve ansible-lint error Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index d008bd965..89195d1c5 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -3,7 +3,7 @@ - name: SAP SWPM Pre Install - Rename variables ansible.builtin.set_fact: - sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list | d([]) ) }}" + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list | d([])) }}" sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary | d(sap_swpm_inifile_parameters_dict) | d({}) }}" tags: always @@ -82,7 +82,7 @@ - name: SAP SWPM Pre Install - Set the sapinst command parameters vars: sap_swpm_swpm_command_guiserver: "{{ 'SAPINST_START_GUISERVER=false' if not sap_swpm_swpm_observer_mode else '' }}" - sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user is defined and sap_swpm_swpm_remote_access_user | length > 0 else '' }}" + sap_swpm_swpm_command_observer: "{{ 'SAPINST_REMOTE_ACCESS_USER=' + sap_swpm_swpm_remote_access_user + ' SAPINST_REMOTE_ACCESS_USER_IS_TRUSTED=true' if sap_swpm_swpm_observer_mode and sap_swpm_swpm_remote_access_user | d('', true) | length > 0 else '' }}" ansible.builtin.set_fact: sap_swpm_swpm_command_inifile: "SAPINST_INPUT_PARAMETERS_URL={{ sap_swpm_tmpdir.path }}/inifile.params" sap_swpm_swpm_command_product_id: "SAPINST_EXECUTE_PRODUCT_ID={{ sap_swpm_product_catalog_id }}" From 8ce28cf523c078297a24b86ed4a7d45eff257c18 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 5 Sep 2024 10:40:16 +0200 Subject: [PATCH 16/33] sap_swpm: Further changes to README.md ... for better readability Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 41 +++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 6fec3a0c5..3cdd25d93 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -75,36 +75,43 @@ Please check the default parameters file for more information on other parameter - [**sap_swpm** default parameters](defaults/main.yml) ### Migrating playbooks from previous versions of sap_swpm + The following role parameter is no longer used because there are no role `modes` any more: + #### sap_swpm_ansible_role_mode -The following two role parameters have been renamed, without automatic conversion between old and new name: +The following two role parameters have been renamed. If the new variables are not defined, the old ones are converted to the new ones. #### sap_swpm_inifile_list -> sap_swpm_inifile_sections_list -Previous name: sap_swpm_inifile_list -New name: sap_swpm_inifile_sections_list -Reason: This variable contains sections of the sapinst input file, `inifile.params`. + +**Previous name**: sap_swpm_inifile_list\ +**New name**: sap_swpm_inifile_sections_list\ +**Reason**: This variable contains sections of the sapinst input file, `inifile.params`. The new variable name is reflecting this purpose. #### sap_swpm_inifile_custom_values_dictionary -> sap_swpm_inifile_parameters_dict -Previous name: sap_swpm_inifile_custom_values_dictionary -New name: sap_swpm_inifile_parameters_dict -Reason: This variable contains parameter names and values of the sapinst input file, `inifile.params`. -The new variable name is reflecting this purpose. -#### Migration from the `*_templates` modes of the previous version of sap_swpm +**Previous name**: sap_swpm_inifile_custom_values_dictionary\ +**New name**: sap_swpm_inifile_parameters_dict\ +**Reason**: This variable contains parameter names and values of the +sapinst input file, `inifile.params`. The new variable name is reflecting this purpose. + +#### Migration from the `*_templates` modes of the previous version of `sap_swpm` + The role `sap_swpm` does no longer use the dictionary `sap_swpm_templates_install_dictionary`. This dictionary was used in the previous role modes `default_templates` and `advanced_templates`. -Because of this, required low level members of `sap_swpm_templates_install_dictionary` have to be redefined to top level variables. -Creating top level variables from low level members of a dict can be done: +Because of this change, required low level members of `sap_swpm_templates_install_dictionary` have to be +redefined to top level variables. Creating top level variables from low level members +of a dict can be done: -- in a separate task using ansible.builtin.set_fact before calling sap_swpm, or +- in a separate task using `ansible.builtin.set_fact` before calling `sap_swpm`, or -- in the task calling sap_swpm with a vars: section of the task calling sap_swpm. +- in the task calling `sap_swpm` with a `vars`: section of the task calling `sap_swpm`. -Be aware of the following limitation: You cannot define a variable in the same task in which you use this variable to access a member -of another variable. Any variable which is used to access low level dict members has to be defined before, in a separate task. +Be aware of the following limitation: You cannot define a variable in the same task in +which you use this variable to access a member of another variable. Any variable which +is used to access low level dict members has to be defined before, in a *separate task*. Example: For defining `sap_swpm_product_catalog_id` from a low level member of `sap_swpm_templates_install_dictionary`, use the following code: @@ -172,9 +179,9 @@ Sample Ansible Playbook Execution - If such a file does *not* exist, the role will create an SAP SWPM `inifile.params` file by one of the following methods: - Method 1: Predefined sections of the file inifile_params.j2 will be used to create the file `inifile.params`. + Method 1: Predefined sections of the file `inifile_params.j2` will be used to create the file `inifile.params`. The variable `sap_swpm_inifile_sections_list` contains a list of sections which will part of the file `inifile.params`. - All other sections will be ignored. The inifile parameters themselves will be set according to other role parameters. + All other sections will be ignored. The inifile parameters themselves will be set according to other role parameters. Example: The inifile parameter `archives.downloadBasket` will be set to the content of the role parameter `sap_swpm_software_path`. From a7875d79206f743c8f28ee7056405c1e8fa126b4 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 6 Sep 2024 10:31:34 +0200 Subject: [PATCH 17/33] sap_swpm: Only mention the `vars:` section for redefining variables Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 3cdd25d93..ac6b8caac 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -109,26 +109,17 @@ of a dict can be done: - in the task calling `sap_swpm` with a `vars`: section of the task calling `sap_swpm`. -Be aware of the following limitation: You cannot define a variable in the same task in -which you use this variable to access a member of another variable. Any variable which -is used to access low level dict members has to be defined before, in a *separate task*. - Example: -For defining `sap_swpm_product_catalog_id` from a low level member of `sap_swpm_templates_install_dictionary`, use the following code: ``` -# Step 1: Define level 2 dict member for accessing level 3 dict member in the following task -- name: Define variable sap_swpm_templates_product_input - ansible.builtin.set_fact: - sap_swpm_templates_product_input: "{{ sap_swpm_templates_product_input_prefix }}_nwas_ascs_ha" - -# Step 2: Define top level variable from level 3 dict member -- name: Define variables sap_swpm_product_catalog_id and sap_swpm_inifile_sections_list - ansible.builtin.set_fact: - sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" - sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input][sap_swpm_inifile_sections_list] }}" - sap_swpm_inifile_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] }}" +- name: Execute the role sap_swpm + ansible.builtin.include_role: + name: community.sap_install.sap_swpm + vars: + sap_swpm_templates_product_input: "sap_s4hana_2023_distributed_nwas_ascs_ha" + sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" + sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] }}" ``` ## Execution From 06c17393771851856d3bdb86d364e72e0f994e27 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 9 Sep 2024 20:19:39 +0200 Subject: [PATCH 18/33] sap_swpm: Recognize sap_swpm_templates_install_dictionary Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 74 ++++++++-------- roles/sap_swpm/tasks/pre_install.yml | 125 ++++++++++++++++++++++++++- 2 files changed, 162 insertions(+), 37 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index ac6b8caac..6d033fb42 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -80,47 +80,59 @@ The following role parameter is no longer used because there are no role `modes` #### sap_swpm_ansible_role_mode -The following two role parameters have been renamed. If the new variables are not defined, the old ones are converted to the new ones. +The following two role parameters have been renamed. If the new variables are undefined and the old ones are defined, +the old ones are converted to the new ones. #### sap_swpm_inifile_list -> sap_swpm_inifile_sections_list -**Previous name**: sap_swpm_inifile_list\ -**New name**: sap_swpm_inifile_sections_list\ +**Previous name**: `sap_swpm_inifile_list`\ +**New name**: `sap_swpm_inifile_sections_list`\ **Reason**: This variable contains sections of the sapinst input file, `inifile.params`. The new variable name is reflecting this purpose. #### sap_swpm_inifile_custom_values_dictionary -> sap_swpm_inifile_parameters_dict -**Previous name**: sap_swpm_inifile_custom_values_dictionary\ -**New name**: sap_swpm_inifile_parameters_dict\ +**Previous name**: `sap_swpm_inifile_custom_values_dictionary`\ +**New name**: `sap_swpm_inifile_parameters_dict`\ **Reason**: This variable contains parameter names and values of the sapinst input file, `inifile.params`. The new variable name is reflecting this purpose. -#### Migration from the `*_templates` modes of the previous version of `sap_swpm` +#### sap_swpm_inifile_dictionary -> sap_swpm_role_parameters_dict -The role `sap_swpm` does no longer use the dictionary `sap_swpm_templates_install_dictionary`. -This dictionary was used in the previous role modes `default_templates` and `advanced_templates`. +**Previous name**: `sap_swpm_inifile_dictionary`\ +**New name**: `sap_swpm_role_parameters_dict`\ +**Reason**: This dictionary contains parameter names and values of the role `sap_swpm`. +The new variable name is reflecting this purpose.\ +**Note**: This variable was only used as a member of `sap_swpm_templates_install_dictionary`, in the +previous `default_templates` mode. -Because of this change, required low level members of `sap_swpm_templates_install_dictionary` have to be -redefined to top level variables. Creating top level variables from low level members -of a dict can be done: +#### Using sap_swpm_templates_install_dictionary -- in a separate task using `ansible.builtin.set_fact` before calling `sap_swpm`, or +The dictionary named `sap_swpm_templates_install_dictionary` can hold all necessary variables +needed by the role `sap_swpm` for different SAP products. See the `Ansible Playbooks for SAP` for examples. -- in the task calling `sap_swpm` with a `vars`: section of the task calling `sap_swpm`. +The role `sap_swpm` redefines low level members of this dictionary to top level +variables. The dictionary may contain either the definitions for the previous +version of the role (used in the previous role modes `default_templates` and `advanced_templates`), +or an updated definition of the dictionary containing the new variable names. +The role will fail if both old and new variable names are defined in the dictionary. +Variables on the top level take precedences over those members of `sap_swpm_templates_install_dictionary` with the same name. -Example: +Following is the complete list of conversions of members of the dictionary `sap_swpm_templates_install_dictionary`, where `sap_prod` is an +example entry for `sap_swpm_templates_product_input`: +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_product_catalog_id']` -> `sap_swpm_product_catalog_id` +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_sections_list']` -> `sap_swpm_inifile_sections_list` +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_parameters_dict']` -> `sap_swpm_inifile_parameters_dict` +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_role_parameters_dict']` -> `sap_swpm_role_parameters_dict` -> top level role variables\ + Example: `sap_swpm_install_saphostagent: 'true'` -``` -- name: Execute the role sap_swpm - ansible.builtin.include_role: - name: community.sap_install.sap_swpm - vars: - sap_swpm_templates_product_input: "sap_s4hana_2023_distributed_nwas_ascs_ha" - - sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" - sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] }}" -``` +Former `default_templates` mode: +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_list']` -> `sap_swpm_inifile_sections_list` +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_dictionary']` -> top level role variables\ + Example: `sap_swpm_install_saphostagent: 'true'` + +Former `advanced_templates` mode: +- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_custom_values_dictionary']` -> `sap_swpm_inifile_parameters_dict` ## Execution @@ -170,23 +182,17 @@ Sample Ansible Playbook Execution - If such a file does *not* exist, the role will create an SAP SWPM `inifile.params` file by one of the following methods: - Method 1: Predefined sections of the file `inifile_params.j2` will be used to create the file `inifile.params`. - The variable `sap_swpm_inifile_sections_list` contains a list of sections which will part of the file `inifile.params`. - All other sections will be ignored. The inifile parameters themselves will be set according to other role parameters. - Example: The inifile parameter `archives.downloadBasket` will be set to the content of the role parameter - `sap_swpm_software_path`. + Method 1: Predefined sections of the file `inifile_params.j2` will be used to create the file `inifile.params`. The variable `sap_swpm_inifile_sections_list` contains a list of sections which will part of the file `inifile.params`. All other sections will be ignored. The inifile parameters themselves will be set according to other role parameters. Example: The inifile parameter `archives.downloadBasket` will be set to the content of the role parameter `sap_swpm_software_path`. - Method 2: The file `inifile.params` will be configured from the content of the dictionary `sap_swpm_inifile_parameters_dict`. - This dictionary is defined like in the following example: + Method 2: The file `inifile.params` will be configured from the content of the dictionary `sap_swpm_inifile_parameters_dict`. This dictionary is defined like in the following example: ``` sap_swpm_inifile_parameters_dict: archives.downloadBasket: /software/download_basket - NW_getFQDN.FQDN: poc.cloud + NW_getFQDN.FQDN: example.com ``` - It is also possible to use method 1 for creating the inifile and then replace or set additional variables using method 2: - Just define both of the related parameters, `sap_swpm_inifile_sections_list` and `sap_swpm_inifile_parameters_dict`. +It is also possible to use method 1 for creating the inifile and then replace or set additional variables using method 2: Define both of the related parameters, `sap_swpm_inifile_sections_list` and `sap_swpm_inifile_parameters_dict`. - The file `inifile.params` is then transferred to a temporary directory on the managed node, to be used by the sapinst process. diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 89195d1c5..93d962a86 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -1,10 +1,129 @@ # SPDX-License-Identifier: Apache-2.0 --- -- name: SAP SWPM Pre Install - Rename variables +- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_sections_list' from 'sap_swpm_inifile_list' if necessary ansible.builtin.set_fact: - sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list | d(sap_swpm_inifile_sections_list | d([])) }}" - sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary | d(sap_swpm_inifile_parameters_dict) | d({}) }}" + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_list }}" + when: + - sap_swpm_inifile_sections_list is undefined + - sap_swpm_inifile_list is defined + tags: always + +- name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from 'sap_swpm_inifile_custom_values_dictionary' if necessary + ansible.builtin.set_fact: + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_custom_values_dictionary }}" + when: + - sap_swpm_inifile_parameters_dict is undefined + - sap_swpm_inifile_custom_values_dictionary is defined + tags: always + +- name: SAP SWPM Pre Install - Define variables from 'sap_swpm_templates_install_dictionary' if present + when: sap_swpm_templates_install_dictionary is defined + tags: always + block: + + - name: SAP SWPM Pre Install - Display 'sap_swpm_templates_product_input' + ansible.builtin.debug: + msg: + - "sap_swpm_templates_product_input: >{{ sap_swpm_templates_product_input }}<" + + - name: SAP SWPM Pre Install - Ensure that only one of 'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' is defined in the dict + ansible.builtin.fail: + msg: + - "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both" + - "'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' are defined!" + - "Only one of these variables may be defined in 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]'." + when: + - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined + - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined + + - name: SAP SWPM Pre Install - Ensure that only one of 'sap_swpm_inifile_parameters_dict' or 'sap_swpm_inifile_custom_values_dictionary' is defined in the dict + ansible.builtin.fail: + msg: + - "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both" + - "'sap_swpm_inifile_parameters_dict', and 'sap_swpm_inifile_custom_values_dictionary', are defined!" + - "Only one of these variables may be defined in 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]'." + when: + - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined + - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined + +# Define sap_swpm_product_catalog_id from low level member, or use top level variable if defined. Top level variable has precedence. + - name: SAP SWPM Pre Install - Define 'sap_swpm_product_catalog_id' from low level member with the same name + ansible.builtin.set_fact: + sap_swpm_product_catalog_id: "{{ sap_swpm_product_catalog_id | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id']) }}" + when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] is defined + + - name: SAP SWPM Pre Install - Display sap_swpm_product_catalog_id + ansible.builtin.debug: + msg: "sap_swpm_product_catalog_id: >{{ sap_swpm_product_catalog_id }}<" + +# Define sap_swpm_inifile_sections_list from low level member, or use top level variable if defined. Top level variable has precedence. + - name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_sections_list' from low level member + ansible.builtin.set_fact: + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_sections_list | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list']) | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list']) }}" + when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined or + sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined + +# Define sap_swpm_role_parameters_dict from low level member. Top level variable does not exist. + - name: SAP SWPM Pre Install - Define 'sap_swpm_role_parameters_dict' from low level member + ansible.builtin.set_fact: + sap_swpm_role_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict']) }}" + when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] is defined or + sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict'] is defined + +# Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict': +# Reason for noqa: We are setting variables from the content of a dict, and the variable names are in the dict keys. + - name: SAP SWPM Pre Install - Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict' # noqa var-naming[no-jinja] + ansible.builtin.set_fact: + "{{ line_item.key }}": "{{ lookup('vars', line_item.key, default=line_item.value) }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop_control: + loop_var: line_item + when: sap_swpm_role_parameters_dict is defined + + - name: SAP SWPM Pre Install - Display all vars of 'sap_swpm_role_parameters_dict' + ansible.builtin.debug: + msg: "{{ line_item.key }}: {{ lookup('vars', line_item.key) }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop_control: + loop_var: line_item + + - name: SAP SWPM Pre Install - Looking for any differences... + ansible.builtin.set_fact: + different_values_sap_swpm_role_parameters_dict: + "{{ different_values_sap_swpm_role_parameters_dict | d({}) | combine({line_item.key: line_item.value}) }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop_control: + loop_var: line_item + when: + - line_item.value != lookup('vars', line_item.key) + ignore_errors: true + + - name: SAP SWPM Pre Install - Display any differences + ansible.builtin.debug: + msg: + - "Note: The following values from" + - "sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict']" + - "are ignored because they have already been defined on the top level, as follows:" + - "{{ different_values_sap_swpm_role_parameters_dict }}" + +# Define sap_swpm_inifile_parameters_dict from low level member, or use top level variable if defined. Top level variable has precedence. + - name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from low level member + ansible.builtin.set_fact: + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_parameters_dict | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary']) | + d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict']) }}" + when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined or + sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined + +- name: SAP SWPM Pre Install - Define the main inifile creation parameters as empty if necessary + ansible.builtin.set_fact: + sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_sections_list | d([]) }}" + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_parameters_dict | d({}) }}" tags: always ################ From f0b8339acb974b0d5d9bef0cea08705b6f849899 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 10 Sep 2024 10:45:22 +0200 Subject: [PATCH 19/33] sap_swpm: No longer define sap_swpm_product_catalog_id... ... in defaults/main.yml Signed-off-by: Bernd Finger --- roles/sap_swpm/defaults/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 8bb00e901..fd24c156a 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -139,7 +139,8 @@ sap_swpm_inifile_sections_list: ######################################## # SAP product that will be installed and passed as argument to the sapinst installer, example 'NW_ABAP_OneHost:S4HANA2020.CORE.HDB.ABAP' -sap_swpm_product_catalog_id: +# Needs to be defined in the playbook or inventory or can be determined from an existing inifile.params file. +#sap_swpm_product_catalog_id: # SAPCAR path and file name, only path is mandatory. The script will automatically get file_name sap_swpm_sapcar_path: From 95ef236872232a20321a92c26d16c43d8b62ec2c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 10 Sep 2024 13:34:08 +0200 Subject: [PATCH 20/33] sap_swpm: Allow undefined or empty sap_swpm_role_parameters_dict Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 93d962a86..304a49874 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -80,26 +80,28 @@ - name: SAP SWPM Pre Install - Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict' # noqa var-naming[no-jinja] ansible.builtin.set_fact: "{{ line_item.key }}": "{{ lookup('vars', line_item.key, default=line_item.value) }}" - loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" loop_control: loop_var: line_item - when: sap_swpm_role_parameters_dict is defined + when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - name: SAP SWPM Pre Install - Display all vars of 'sap_swpm_role_parameters_dict' ansible.builtin.debug: msg: "{{ line_item.key }}: {{ lookup('vars', line_item.key) }}" - loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" loop_control: loop_var: line_item + when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - name: SAP SWPM Pre Install - Looking for any differences... ansible.builtin.set_fact: different_values_sap_swpm_role_parameters_dict: "{{ different_values_sap_swpm_role_parameters_dict | d({}) | combine({line_item.key: line_item.value}) }}" - loop: "{{ sap_swpm_role_parameters_dict | dict2items }}" + loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" loop_control: loop_var: line_item when: + - sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - line_item.value != lookup('vars', line_item.key) ignore_errors: true @@ -110,6 +112,7 @@ - "sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict']" - "are ignored because they have already been defined on the top level, as follows:" - "{{ different_values_sap_swpm_role_parameters_dict }}" + when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict # Define sap_swpm_inifile_parameters_dict from low level member, or use top level variable if defined. Top level variable has precedence. - name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from low level member From c0126806309d4d78d973c9a11061d55be03ea829 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 19 Sep 2024 16:02:32 +0200 Subject: [PATCH 21/33] sap_swpm: Prioritize sap_swpm_templates_install_dictionary members Due to the use of global variables in sap_swpm, there appears to be no simple way of giving priority to top level vars over the same variables defined in sap_swpm_templates_install_dictionary. We can also assume that if using sap_swpm_templates_install_dictionary, this is done on purpose and with the intention to use its members with priority over top level variables. Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 8 ++-- roles/sap_swpm/tasks/pre_install.yml | 66 ++++++++++++---------------- 2 files changed, 32 insertions(+), 42 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 6d033fb42..69acdc4da 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -111,12 +111,12 @@ previous `default_templates` mode. The dictionary named `sap_swpm_templates_install_dictionary` can hold all necessary variables needed by the role `sap_swpm` for different SAP products. See the `Ansible Playbooks for SAP` for examples. -The role `sap_swpm` redefines low level members of this dictionary to top level -variables. The dictionary may contain either the definitions for the previous -version of the role (used in the previous role modes `default_templates` and `advanced_templates`), +The role `sap_swpm` defines top level variables from low level members of this dictionary. +The dictionary may contain either the definitions for the previous version of the role +(used in the previous role modes `default_templates` and `advanced_templates`), or an updated definition of the dictionary containing the new variable names. The role will fail if both old and new variable names are defined in the dictionary. -Variables on the top level take precedences over those members of `sap_swpm_templates_install_dictionary` with the same name. +Variables on the top level will be overridden by members of `sap_swpm_templates_install_dictionary` with the same name. Following is the complete list of conversions of members of the dictionary `sap_swpm_templates_install_dictionary`, where `sap_prod` is an example entry for `sap_swpm_templates_product_input`: diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 304a49874..3e8436560 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -17,6 +17,7 @@ - sap_swpm_inifile_custom_values_dictionary is defined tags: always +# Note: Variable definitions in sap_swpm_templates_install_dictionary will overwrite existing top level definitions. - name: SAP SWPM Pre Install - Define variables from 'sap_swpm_templates_install_dictionary' if present when: sap_swpm_templates_install_dictionary is defined tags: always @@ -26,8 +27,9 @@ ansible.builtin.debug: msg: - "sap_swpm_templates_product_input: >{{ sap_swpm_templates_product_input }}<" + ignore_errors: true - - name: SAP SWPM Pre Install - Ensure that only one of 'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' is defined in the dict + - name: SAP SWPM Pre Install - Fail if 'sap_swpm_inifile_sections_list' and 'sap_swpm_inifile_list' are both defined in the dict ansible.builtin.fail: msg: - "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both" @@ -37,7 +39,7 @@ - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined - - name: SAP SWPM Pre Install - Ensure that only one of 'sap_swpm_inifile_parameters_dict' or 'sap_swpm_inifile_custom_values_dictionary' is defined in the dict + - name: SAP SWPM Pre Install - Fail if 'sap_swpm_inifile_parameters_dict' and 'sap_swpm_inifile_custom_values_dictionary' are both defined in the dict ansible.builtin.fail: msg: - "FAIL: In 'sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]', both" @@ -47,27 +49,27 @@ - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined - sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined -# Define sap_swpm_product_catalog_id from low level member, or use top level variable if defined. Top level variable has precedence. +# Unconditionally define sap_swpm_product_catalog_id from low level member. - name: SAP SWPM Pre Install - Define 'sap_swpm_product_catalog_id' from low level member with the same name ansible.builtin.set_fact: - sap_swpm_product_catalog_id: "{{ sap_swpm_product_catalog_id | - d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id']) }}" +# sap_swpm_product_catalog_id: "{{ sap_swpm_product_catalog_id | +# d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id']) }}" + sap_swpm_product_catalog_id: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] }}" when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_product_catalog_id'] is defined - - name: SAP SWPM Pre Install - Display sap_swpm_product_catalog_id + - name: SAP SWPM Pre Install - Display 'sap_swpm_product_catalog_id' ansible.builtin.debug: msg: "sap_swpm_product_catalog_id: >{{ sap_swpm_product_catalog_id }}<" -# Define sap_swpm_inifile_sections_list from low level member, or use top level variable if defined. Top level variable has precedence. +# Unconditionally define sap_swpm_inifile_sections_list from low level member. - name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_sections_list' from low level member ansible.builtin.set_fact: - sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_sections_list | - d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list']) | + sap_swpm_inifile_sections_list: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] | d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list']) }}" when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_list'] is defined or sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_sections_list'] is defined -# Define sap_swpm_role_parameters_dict from low level member. Top level variable does not exist. +# Define sap_swpm_role_parameters_dict from low level member. - name: SAP SWPM Pre Install - Define 'sap_swpm_role_parameters_dict' from low level member ansible.builtin.set_fact: sap_swpm_role_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] | @@ -75,54 +77,42 @@ when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_dictionary'] is defined or sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict'] is defined -# Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict': + - name: SAP SWPM Pre Install - Display 'sap_swpm_role_parameters_dict' + ansible.builtin.debug: + msg: "sap_swpm_role_parameters_dict: >{{ sap_swpm_role_parameters_dict }}<" + when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict + ignore_errors: true + +# Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict'. # Reason for noqa: We are setting variables from the content of a dict, and the variable names are in the dict keys. - name: SAP SWPM Pre Install - Define role variables from low level member, looping over 'sap_swpm_role_parameters_dict' # noqa var-naming[no-jinja] ansible.builtin.set_fact: - "{{ line_item.key }}": "{{ lookup('vars', line_item.key, default=line_item.value) }}" + "{{ line_item.key }}": "{{ line_item.value }}" loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" loop_control: loop_var: line_item - when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict + when: + - sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - - name: SAP SWPM Pre Install - Display all vars of 'sap_swpm_role_parameters_dict' + - name: SAP SWPM Pre Install - Display all vars and values of 'sap_swpm_role_parameters_dict' ansible.builtin.debug: - msg: "{{ line_item.key }}: {{ lookup('vars', line_item.key) }}" + msg: "{{ line_item.key }}: >{{ lookup('vars', line_item.key) }}<" loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" loop_control: loop_var: line_item when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - - - name: SAP SWPM Pre Install - Looking for any differences... - ansible.builtin.set_fact: - different_values_sap_swpm_role_parameters_dict: - "{{ different_values_sap_swpm_role_parameters_dict | d({}) | combine({line_item.key: line_item.value}) }}" - loop: "{{ sap_swpm_role_parameters_dict | dict2items if sap_swpm_role_parameters_dict is mapping else [] }}" - loop_control: - loop_var: line_item - when: - - sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - - line_item.value != lookup('vars', line_item.key) ignore_errors: true - - name: SAP SWPM Pre Install - Display any differences - ansible.builtin.debug: - msg: - - "Note: The following values from" - - "sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_role_parameters_dict']" - - "are ignored because they have already been defined on the top level, as follows:" - - "{{ different_values_sap_swpm_role_parameters_dict }}" - when: sap_swpm_role_parameters_dict is defined and sap_swpm_role_parameters_dict - -# Define sap_swpm_inifile_parameters_dict from low level member, or use top level variable if defined. Top level variable has precedence. +# Define sap_swpm_inifile_parameters_dict from low level member, or use top level variable if defined. Low level definition has precedence. - name: SAP SWPM Pre Install - Define 'sap_swpm_inifile_parameters_dict' from low level member ansible.builtin.set_fact: - sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_parameters_dict | - d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary']) | + sap_swpm_inifile_parameters_dict: "{{ sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] | d(sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict']) }}" when: sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_custom_values_dictionary'] is defined or sap_swpm_templates_install_dictionary[sap_swpm_templates_product_input]['sap_swpm_inifile_parameters_dict'] is defined +# The following task ensures that the two main inifile creation parameters are defined. +# This is necessary when creating the file 'inifile.params'. - name: SAP SWPM Pre Install - Define the main inifile creation parameters as empty if necessary ansible.builtin.set_fact: sap_swpm_inifile_sections_list: "{{ sap_swpm_inifile_sections_list | d([]) }}" From a4ba1005ea9064c165a08c7d61a50e9568368e0a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 27 Sep 2024 16:26:38 +0200 Subject: [PATCH 22/33] sap_swpm: Adapt README.md to new standard Note: This is WIP. Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 247 +++++++++++++++------------------------ 1 file changed, 97 insertions(+), 150 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 69acdc4da..6d1faf5fa 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -1,51 +1,40 @@ + # sap_swpm Ansible Role - -Ansible role for SAP software installation using SWPM - -## Requirements - -The role requires additional collections which are specified in `meta/collection-requirements.yml`. Before using this role, -make sure that the required collections are installed, for example by using the following command: - -`ansible-galaxy install -vv -r meta/collection-requirements.yml` - -## Scope - -This role has been tested and working for the following scenarios -- One Host Installation -- Dual Host Installation -- Distributed Installation -- System Restore -- High Availability Installation - -This role has been tested and working for the following SAP products -- SAP S/4HANA 1809, 1909, 2020, 2021 -- SAP BW/4HANA -- SAP Solution Manager 7.2 -- SAP Netweaver Business Suite Applications (ECC, GRC, etc) -- SAP Web Dispatcher - -> The general rule is - if the installation uses SAP SWPM then this Ansible Role can be used. - -### SAP Preconfigure - -- Ensure the required volumes and filesystems are configured in the host. You can use the role `sap_storage_setup` to configure this. More info [here](/roles/sap_storage_setup) - -- Please run the RHEL SAP System Role `sap_general_preconfigure` for initial host configuration; as necessary, also use `sap_netweaver_preconfigure` and `sap_hana_preconfigure` - -- For further guidance on using SAP SWPM for different SAP Software installations, please see System Provisioning with Software Provisioning Manager (SWPM) - [User Guides for SAP SWPM 1.0](30839dda13b2485889466316ce5b39e9/c8ed609927fa4e45988200b153ac63d1.html?locale=en-US) and [User Guides for SAP SWPM 2.0](https://help.sap.com/docs/SOFTWARE_PROVISIONING_MANAGER/30839dda13b2485889466316ce5b39e9/6865029dacbe473fadd8eff339bfa568.html?locale=en-US) - -### SAP Software Installation .SAR Files - -1. SAPCAR executable - -2. Software Provisioning Manager .SAR file - - `SWPM*.SAR` - -3. SAP Installation files - - For New Installation - - Download appropriate software from SAP Software Download Center, Maintenance Planner, etc - - For Restore or New Installation + +![Ansible Lint for sap_swpm](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_swpm.yml/badge.svg) + +## Description + +The Ansible role `sap_swpm` installs the SAP ABAP Application Platform (formerly known as SAP NetWeaver) using the SAP Software Provisioning Manager (SWPM). + + + +## Dependencies +- `fedora.linux_system_roles` + - Roles: + - `selinux` + +Install required collections by `ansible-galaxy install -vv -r meta/collection-requirements.yml`. + + +## Prerequisites + +Managed nodes: +- Directory with SAP Installation media is present and `sap_install_media_detect_source_directory` updated. Download can be completed using [community.sap_launchpad](https://github.com/sap-linuxlab/community). +- Ensure that servers are configured for SAP ABAP Application Platform. See [Recommended](#recommended) section. +- Ensure that volumes and filesystems are configured correctly. See [Recommended](#recommended) section. + +### Prepare SAP ABAP Application Platform installation media +Place a valid SAPCAR executable file in a directory specified by variable `sap_swpm_sapcar_path`, e.g. /software/sapcar. Example: + - SAPCAR_1300-70007716.EXE + +Place the following files in a directory specified by variable `sap_swpm_swpm_path`, e.g. /software/sap_swpm: + - SWPM20SP18_3-80003424.SAR + +Place the following files in a directory specified by variable `sap_swpm_software_path`, e.g. /software/abap_application_platform: + - For a new installation + - Download the appropriate software from SAP Software Download Center, Maintenance Planner, etc + - For a restore or new installation - SAP IGS - `igs*.sar` - SAP IGS HELPER - `igshelper*sar` - SAP Host Agent - `SAPHOSTAGENT*SAR` @@ -53,108 +42,27 @@ This role has been tested and working for the following SAP products - SAP Kernel DB Independent - `SAPEXE_*SAR` - SAP HANA Client - `IMDB_CLIENT*SAR` -4. SAP HANA Database MDC DB Tenant Backup (for restore) - - stored on the local disk of the machine where the SAP HANA database server will reside - - NOTE: Specific media requirements will use format `SAPINST.CD.PACKAGE. = `, and the media names can be discovered by using this command on the SWPM directory `grep -rwh " sap_swpm_inifile_sections_list - -**Previous name**: `sap_swpm_inifile_list`\ -**New name**: `sap_swpm_inifile_sections_list`\ -**Reason**: This variable contains sections of the sapinst input file, `inifile.params`. -The new variable name is reflecting this purpose. - -#### sap_swpm_inifile_custom_values_dictionary -> sap_swpm_inifile_parameters_dict - -**Previous name**: `sap_swpm_inifile_custom_values_dictionary`\ -**New name**: `sap_swpm_inifile_parameters_dict`\ -**Reason**: This variable contains parameter names and values of the -sapinst input file, `inifile.params`. The new variable name is reflecting this purpose. - -#### sap_swpm_inifile_dictionary -> sap_swpm_role_parameters_dict - -**Previous name**: `sap_swpm_inifile_dictionary`\ -**New name**: `sap_swpm_role_parameters_dict`\ -**Reason**: This dictionary contains parameter names and values of the role `sap_swpm`. -The new variable name is reflecting this purpose.\ -**Note**: This variable was only used as a member of `sap_swpm_templates_install_dictionary`, in the -previous `default_templates` mode. - -#### Using sap_swpm_templates_install_dictionary - -The dictionary named `sap_swpm_templates_install_dictionary` can hold all necessary variables -needed by the role `sap_swpm` for different SAP products. See the `Ansible Playbooks for SAP` for examples. - -The role `sap_swpm` defines top level variables from low level members of this dictionary. -The dictionary may contain either the definitions for the previous version of the role -(used in the previous role modes `default_templates` and `advanced_templates`), -or an updated definition of the dictionary containing the new variable names. -The role will fail if both old and new variable names are defined in the dictionary. -Variables on the top level will be overridden by members of `sap_swpm_templates_install_dictionary` with the same name. - -Following is the complete list of conversions of members of the dictionary `sap_swpm_templates_install_dictionary`, where `sap_prod` is an -example entry for `sap_swpm_templates_product_input`: -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_product_catalog_id']` -> `sap_swpm_product_catalog_id` -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_sections_list']` -> `sap_swpm_inifile_sections_list` -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_parameters_dict']` -> `sap_swpm_inifile_parameters_dict` -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_role_parameters_dict']` -> `sap_swpm_role_parameters_dict` -> top level role variables\ - Example: `sap_swpm_install_saphostagent: 'true'` - -Former `default_templates` mode: -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_list']` -> `sap_swpm_inifile_sections_list` -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_dictionary']` -> top level role variables\ - Example: `sap_swpm_install_saphostagent: 'true'` - -Former `advanced_templates` mode: -- `sap_swpm_templates_install_dictionary[sap_prod]['sap_swpm_inifile_custom_values_dictionary']` -> `sap_swpm_inifile_parameters_dict` + ## Execution + + -Sample Ansible Playbook Execution + +### Recommended +It is recommended to execute this role together with other roles in this collection, in the following order:
+1. [sap_general_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_general_preconfigure) +2. [sap_netweaver_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_preconfigure) +3. [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect) +4. *`sap_swpm`* -- Local Host Installation - - `ansible-playbook --connection=local --limit localhost -i "localhost," sap-swpm.yml -e "@inputs/S4H.install"` +Note: For most scenarios, a database like SAP HANA must be available. Use the role [sap_hana_install](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_install) for installing the SAP HANA database. + -- Target Host Installation - - `ansible-playbook -i "" sap-swpm.yml -e "@inputs/S4H.install"` - -### Sample Playbook - -```yaml ---- -- hosts: all - become: true - roles: - - sap_swpm -``` - -## Execution Flow +### Execution Flow + ### Pre-Install @@ -205,9 +113,44 @@ It is also possible to use method 1 for creating the inifile and then replace or - Set expiry of Unix created users to 'never' - Apply firewall rules for SAP NW (optional - false by default) + -## Tags +### Example + +#### Playbook for installing a Primary Application Server (PAS) instance + +```yaml +--- +- name: Ansible Play for SAP NetWeaver Application Server - Primary Application Server (PAS) + hosts: nwas_pas + become: true + any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts + max_fail_percentage: 0 + tasks: + + - name: Execute Ansible Role sap_install_media_detect + ansible.builtin.include_role: + name: community.sap_install.sap_install_media_detect + vars: + 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_webdisp: false + sap_install_media_detect_db_client: "saphana" + + # Install SAP NetWeaver PAS via Ansible Role sap_swpm + - name: Execute Ansible Role sap_swpm + ansible.builtin.include_role: + name: community.sap_install.sap_swpm + vars: + *** TODO: Fill in variables *** +``` + + + +### Role Tags With the following tags, the role can be called to perform certain activities only: - tag `sap_swpm_generate_inifile`: Only create the sapinst inifile, without running most of the preinstall steps. This can be useful for checking if the inifile is created as desired. @@ -215,11 +158,15 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_swpm_pre_install`: Perform all preinstallation steps, then exit. - tag `sap_swpm_setup_firewall`: Only perform the firewall preinstallation settings (but only if variable `sap_swpm_setup_firewall` is set to `true`). - tag `sap_swpm_update_etchosts`: Only update file `/etc/hosts` (but only if variable `sap_swpm_update_etchosts` is set to `true`). +!-- END Role Tags --> ## License - -Apache license 2.0 - -## Author Information - -IBM Lab for SAP Solutions, Red Hat for SAP Community of Practice, Jason Masipiquena, Sean Freeman, Bernd Finger, Markus Koch + +Apache 2.0 + + +## Maintainers + +- [Bernd Finger](https://github.com/berndfinger) +- [Sean Freeman](https://github.com/seanfreeman) + From ac4b06f86c62963f9c0f90cdb996593dad78cb8f Mon Sep 17 00:00:00 2001 From: Marcel Mamula Date: Thu, 3 Oct 2024 15:47:01 +0200 Subject: [PATCH 23/33] docs: Update readme and add vars section --- roles/sap_swpm/README.md | 753 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 720 insertions(+), 33 deletions(-) diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 6d1faf5fa..04c7360a8 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -5,7 +5,7 @@ ## Description -The Ansible role `sap_swpm` installs the SAP ABAP Application Platform (formerly known as SAP NetWeaver) using the SAP Software Provisioning Manager (SWPM). +The Ansible role `sap_swpm` installs various SAP Systems installable by SAP Software Provisioning Manager (SWPM). @@ -20,30 +20,27 @@ Install required collections by `ansible-galaxy install -vv -r meta/collection-r ## Prerequisites Managed nodes: -- Directory with SAP Installation media is present and `sap_install_media_detect_source_directory` updated. Download can be completed using [community.sap_launchpad](https://github.com/sap-linuxlab/community). -- Ensure that servers are configured for SAP ABAP Application Platform. See [Recommended](#recommended) section. +- Directory with SAP Installation media is present and `sap_swpm_software_path` updated. Download can be completed using [community.sap_launchpad](https://github.com/sap-linuxlab/community). +- Ensure that servers are configured for SAP Systems. See [Recommended](#recommended) section. - Ensure that volumes and filesystems are configured correctly. See [Recommended](#recommended) section. -### Prepare SAP ABAP Application Platform installation media -Place a valid SAPCAR executable file in a directory specified by variable `sap_swpm_sapcar_path`, e.g. /software/sapcar. Example: - - SAPCAR_1300-70007716.EXE +### Prepare SAP installation media +Place a valid SAPCAR executable file in a directory specified by variable `sap_swpm_sapcar_path` (e.g. /software/sapcar). Example: `SAPCAR_1300-70007716.EXE` -Place the following files in a directory specified by variable `sap_swpm_swpm_path`, e.g. /software/sap_swpm: - - SWPM20SP18_3-80003424.SAR +Place a valid SWPM SAR file in a directory specified by variable `sap_swpm_swpm_path` (e.g. /software/sap_swpm). Example: `SWPM20SP18_3-80003424.SAR` -Place the following files in a directory specified by variable `sap_swpm_software_path`, e.g. /software/abap_application_platform: - - For a new installation - - Download the appropriate software from SAP Software Download Center, Maintenance Planner, etc - - For a restore or new installation - - SAP IGS - `igs*.sar` - - SAP IGS HELPER - `igshelper*sar` - - SAP Host Agent - `SAPHOSTAGENT*SAR` - - SAP Kernel DB - `SAPEXEDB_*SAR` - - SAP Kernel DB Independent - `SAPEXE_*SAR` - - SAP HANA Client - `IMDB_CLIENT*SAR` - -Alternatively, you can place all the files mentioned above into a single directory and use the role [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect) to identify the required files and set the role variables automatically so that the role `sap_swpm` has access to all the files needed for a successful installation of SAP ABAP Application Platform. +Place the following files in a directory specified by variable `sap_swpm_software_path` (e.g. /software/sap_swpm_download_basket): + - For a new installation + - Download the appropriate software from SAP Software Download Center, Maintenance Planner, etc. + - For a restore or new installation + - SAP IGS - `igs*.sar` + - SAP IGS HELPER - `igshelper*sar` + - SAP Host Agent - `SAPHOSTAGENT*SAR` + - SAP Kernel DB - `SAPEXEDB_*SAR` + - SAP Kernel DB Independent - `SAPEXE_*SAR` + - SAP HANA Client - `IMDB_CLIENT*SAR` +Alternatively, you can place all the files mentioned above into a single directory and use the role [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect) to identify the required files and set the role variables automatically so that the role `sap_swpm` has access to all the files needed for a successful installation of SAP System. ## Execution @@ -79,9 +76,9 @@ Note: For most scenarios, a database like SAP HANA must be available. Use the ro - Get all .SAR filenames from `sap_swpm_software_path` -- Update `/etc/hosts` (optional - `false` by default) +- (Optional) Update `/etc/hosts` if `sap_swpm_update_etchosts` is set to `true` (Default: `false`). -- Apply firewall rules for SAP HANA (optional - `false` by default) +- (Optional) Apply firewall rules for SAP HANA if `sap_swpm_setup_firewall` is set to `true` (Default: `false`). - At this stage, the role is searching for a sapinst inifile on the managed node, or it will create one: @@ -110,22 +107,22 @@ It is also possible to use method 1 for creating the inifile and then replace or ### Post-Install -- Set expiry of Unix created users to 'never' +- Set expiry of Linux created users to 'never' -- Apply firewall rules for SAP NW (optional - false by default) +- (Optional) Apply firewall rules for SAP Netweaver if `sap_swpm_setup_firewall` is set to `true` (Default: `false`). ### Example -#### Playbook for installing a Primary Application Server (PAS) instance - +#### Playbook for installing a SAP ABAP ASCS instance in distributed system with [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect) role +Example shows execution together with [sap_install_media_detect](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_install_media_detect) role, which sets required variables for `sap_swpm` role.
```yaml --- -- name: Ansible Play for SAP NetWeaver Application Server - Primary Application Server (PAS) - hosts: nwas_pas +- name: Ansible Play for SAP ABAP ASCS installation in distributed system + hosts: nwas_ascs become: true - any_errors_fatal: true # https://docs.ansible.com/ansible/latest/user_guide/playbooks_error_handling.html#aborting-a-play-on-all-hosts + any_errors_fatal: true max_fail_percentage: 0 tasks: @@ -138,15 +135,39 @@ It is also possible to use method 1 for creating the inifile and then replace or sap_install_media_detect_igs: true sap_install_media_detect_kernel: true sap_install_media_detect_webdisp: false - sap_install_media_detect_db_client: "saphana" + sap_install_media_detect_source_directory: /software - # Install SAP NetWeaver PAS via Ansible Role sap_swpm - name: Execute Ansible Role sap_swpm ansible.builtin.include_role: name: community.sap_install.sap_swpm vars: - *** TODO: Fill in variables *** + sap_swpm_sid: AE1 + sap_swpm_virtual_hostname: ae1ascs + sap_swpm_ascs_instance_nr: "01" + sap_swpm_master_password: "Password@1" # Do not use, this is example only! + sap_swpm_ddic_000_password: "Password@1" # Do not use, this is example only! + sap_swpm_sapadm_uid: "3000" + sap_swpm_sapsys_gid: "3001" + sap_swpm_sidadm_uid: "3001" + sap_swpm_product_catalog_id: NW_ABAP_ASCS:NW750.HDB.ABAPHA + sap_swpm_inifile_sections_list: + - swpm_installation_media + - swpm_installation_media_swpm1 + - credentials + - credentials_hana + - db_config_hana + - db_connection_nw_hana + - nw_config_other + - nw_config_central_services_abap + - nw_config_primary_application_server_instance + - nw_config_ports + - nw_config_host_agent + - sap_os_linux_user + + sap_swpm_role_parameters_dict: + sap_swpm_install_saphostagent: 'true' ``` + @@ -158,7 +179,7 @@ With the following tags, the role can be called to perform certain activities on - tag `sap_swpm_pre_install`: Perform all preinstallation steps, then exit. - tag `sap_swpm_setup_firewall`: Only perform the firewall preinstallation settings (but only if variable `sap_swpm_setup_firewall` is set to `true`). - tag `sap_swpm_update_etchosts`: Only update file `/etc/hosts` (but only if variable `sap_swpm_update_etchosts` is set to `true`). -!-- END Role Tags --> + ## License @@ -170,3 +191,669 @@ Apache 2.0 - [Bernd Finger](https://github.com/berndfinger) - [Sean Freeman](https://github.com/seanfreeman) + +## Role Variables + +**NOTE: Discontinued variables:** +- `sap_swpm_ansible_role_mode` + +### Variables for creating sapinst inifile + +#### sap_swpm_run_sapinst +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` to disable execution of sapinst after creation of inifile. + + +### Variables for controlling contents of inifile + +#### sap_swpm_inifile_sections_list +- _Type:_ `list` +- _Default:_ +```yaml +sap_swpm_inifile_sections_list: + - swpm_installation_media + - swpm_installation_media_swpm2_hana + - credentials + - credentials_hana + - db_config_hana + - db_connection_nw_hana + - db_restore_hana + - nw_config_other + - nw_config_central_services_abap + - nw_config_primary_application_server_instance + - nw_config_ports + - nw_config_host_agent + - sap_os_linux_user +``` + +Define list of sections that will be used to control parameters added into sapinst inifile. +Available values: +```yaml +sap_swpm_inifile_sections_list: + - swpm_installation_media + - swpm_installation_media_swpm2_hana + - swpm_installation_media_swpm1 + - swpm_installation_media_swpm1_exportfiles + - swpm_installation_media_swpm1_ibmdb2 + - swpm_installation_media_swpm1_oracledb_121 + - swpm_installation_media_swpm1_oracledb_122 + - swpm_installation_media_swpm1_oracledb_19 + - swpm_installation_media_swpm1_sapase + - swpm_installation_media_swpm1_sapmaxdb + - maintenance_plan_stack_tms_config + - maintenance_plan_stack_tms_transports + - maintenance_plan_stack_spam_config + - maintenance_plan_stack_sum_config + - maintenance_plan_stack_sum_10_batch_mode + - credentials + - credentials_hana + - credentials_anydb_ibmdb2 + - credentials_anydb_oracledb + - credentials_anydb_sapase + - credentials_anydb_sapmaxdb + - credentials_nwas_ssfs + - credentials_hdbuserstore + - db_config_hana + - db_config_anydb_all + - db_config_anydb_ibmdb2 + - db_config_anydb_oracledb + - db_config_anydb_oracledb_121 + - db_config_anydb_oracledb_122 + - db_config_anydb_oracledb_19 + - db_config_anydb_sapase + - db_config_anydb_sapmaxdb + - db_connection_nw_hana + - db_connection_nw_anydb_ibmdb2 + - db_connection_nw_anydb_oracledb + - db_connection_nw_anydb_sapase + - db_restore_hana + - nw_config_anydb + - nw_config_other + - nw_config_central_services_abap + - nw_config_central_services_java + - nw_config_primary_application_server_instance + - nw_config_additional_application_server_instance + - nw_config_ers + - nw_config_ports + - nw_config_java_ume + - nw_config_java_feature_template_ids + - nw_config_java_icm_credentials + - nw_config_webdisp_generic + - nw_config_webdisp_gateway + - nw_config_host_agent + - nw_config_post_load_abap_reports + - nw_config_livecache + - nw_config_sld + - nw_config_abap_language_packages + - sap_os_linux_user +``` + + +### Variables to define software paths + +#### sap_swpm_sapcar_path +- _Type:_ `string` + +Define path to directory with SAPCAR file. + +#### sap_swpm_sapcar_file_name +- _Type:_ `string` + +(Optional) Define name of SAPCAR file, or leave for auto-detection. + +#### sap_swpm_swpm_path +- _Type:_ `string` + +Define path to directory with SWPM. + +#### sap_swpm_swpm_sar_file_name +- _Type:_ `string` + +(Optional) Define name of SWPM file, or leave for auto-detection. + +#### sap_swpm_software_extract_directory +- _Type:_ `string` + +(Optional) Define path to directory with unpacked SWPM file. + +#### sap_swpm_software_use_media +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to use SAP Media files instead of SAR files.
+- SWPM2 (New SAP products like S4H, BW4H) uses SAR files.
+- SWPM1 (Older SAP products) use CD Media files. + +#### sap_swpm_inifile_directory +- _Type:_ `string` + +Define directory where sapinst inifile will be stored. + +#### sap_swpm_install_saphostagent +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` to disable installation of SAP Hostagent. **Not recommended** + + +### Variables specific to SAP Netweaver + +#### sap_swpm_product_catalog_id +- _Type:_ `string` + +Define SWPM Product catalog ID for installation. Example for SAP ASCS Netweaver: `NW_ABAP_ASCS:NW750.HDB.ABAPHA`. + +#### sap_swpm_sid +- _Type:_ `string` + +Define SAP System ID (SID) for installation. + +#### sap_swpm_ascs_instance_nr +- _Type:_ `string` + +Define SAP Netweaver ABAP Central Services (ASCS) instance number. + +#### sap_swpm_ascs_instance_hostname +- _Type:_ `string` + +Define SAP Netweaver ABAP Central Services (ASCS) hostname. + +#### sap_swpm_ers_instance_nr +- _Type:_ `string` + +Define SAP Netweaver Enqueue Replication Server (ERS) instance number. + +#### sap_swpm_ers_instance_hostname +- _Type:_ `string` + +Define SAP Netweaver Enqueue Replication Server (ERS) hostname. + +#### sap_swpm_pas_instance_nr +- _Type:_ `string` + +Define SAP Netweaver Primary Application Server (PAS) instance number. + +#### sap_swpm_pas_instance_hostname +- _Type:_ `string` + +Define SAP Netweaver Primary Application Server (PAS) hostname. + +#### sap_swpm_aas_instance_nr +- _Type:_ `string` + +Define SAP Netweaver Additional Application Server (AAS) instance number. + +#### sap_swpm_aas_instance_hostname +- _Type:_ `string` + +Define SAP Netweaver Additional Application Server (AAS) hostname. + +#### sap_swpm_java_scs_instance_nr +- _Type:_ `string` + +Define SAP Netweaver JAVA Central Services (SCS) instance number. + +#### sap_swpm_java_scs_instance_hostname +- _Type:_ `string` + +Define SAP Netweaver JAVA Central Services (SCS) hostname. + +#### sap_swpm_master_password +- _Type:_ `string` + +Define master password used for all users created during SWPM execution. + +#### sap_swpm_ddic_000_password +- _Type:_ `string` + +Define DDIC user password in client 000 for new install, or existing for restore. + +#### sap_swpm_virtual_hostname +- _Type:_ `string` + +Define virtual hostname when installing High Available instances (e.g. SAP ASCS/ERS cluster). + + +### Variables specific to SAP HANA Database Installation + +#### sap_swpm_db_ip +- _Type:_ `string` + +Define IP Address of database host for /etc/hosts update. + +#### sap_swpm_db_fqdn +- _Type:_ `string` + +Define FQDN of database host for /etc/hosts update. + +#### sap_swpm_db_host +- _Type:_ `string` + +Define hostname of database host for /etc/hosts update. + +#### sap_swpm_db_sid +- _Type:_ `string` + +Define database ID (SID). + +#### sap_swpm_db_instance_nr +- _Type:_ `string` + +Define database instance number. + +#### sap_swpm_db_system_password +- _Type:_ `string` + +Define database SYSTEM user password. + +#### sap_swpm_db_systemdb_password +- _Type:_ `string` + +Define database SYSTEMDB user password. + +#### sap_swpm_db_sidadm_password +- _Type:_ `string` + +Define database sidadm user password. + +#### sap_swpm_db_schema_abap +- _Type:_ `string` + +Define ABAP database schema name based on database type:
+- `SAPHANADB` for SAP HANA +- `ABAP` or `SAPABAP1` on IBM Db2 +- `SAPSR3` on Oracle DB + +#### sap_swpm_db_schema_abap_password +- _Type:_ `string` + +Define ABAP database schema password for new installation or restore from backup. + +#### sap_swpm_db_schema_java +- _Type:_ `string` + +Define JAVA database schema name. + +#### sap_swpm_db_schema_java_password +- _Type:_ `string` + +Define JAVA database schema password for new installation or restore from backup. + +#### sap_swpm_db_schema +- _Type:_ `string` + +#### sap_swpm_db_schema_password: +- _Type:_ `string` + + +### Variables specific to SAP JAVA UME + +#### sap_swpm_ume_client_nr +- _Type:_ `string` +- _Default:_ `000` + +Define client number of JAVA UME. + +#### sap_swpm_ume_type +- _Type:_ `string` + +Define type of JAVA UME. + +#### sap_swpm_ume_instance_nr +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_pas_instance_nr }}` + +Define instance number of JAVA UME. + +#### sap_swpm_ume_j2ee_admin_password +- _Type:_ `string` + +Define admin password for JAVA UME. + +#### sap_swpm_ume_j2ee_guest_password +- _Type:_ `string` + +Define guest password for JAVA UME. + +#### sap_swpm_ume_sapjsf_password +- _Type:_ `string` + +Define sapjsf password for JAVA UME. + +#### sap_swpm_ume_instance_hostname +- _Type:_ `string` + +Define instance hostname of JAVA UME. + + +### Variables specific to SAP HANA Database Restore + +#### sap_swpm_backup_location +- _Type:_ `string` + +Define directory with SAP HANA Backup files. + +#### sap_swpm_backup_prefix +- _Type:_ `string` + +Define prefix of SAP HANA Backup files. + +#### sap_swpm_backup_system_password +- _Type:_ `string` + +Define SAP HANA SYSTEM password from source database. + + +### Variables specific to SAP Web Dispatcher + +#### sap_swpm_wd_instance_nr +- _Type:_ `string` + +Define instance number of SAP Web Dispatcher. + +#### sap_swpm_wd_system_connectivity +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to set parameter `configureSystemConnectivity` to true during installation. + +#### sap_swpm_wd_activate_icf +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to activate ICF. + +#### sap_swpm_wd_backend_sid +- _Type:_ `string` + +Define backend SID for SAP Web Dispatcher connection. + +#### sap_swpm_wd_backend_ms_http_port +- _Type:_ `string` + +Define backend message server HTTP port for SAP Web Dispatcher connection. + +#### sap_swpm_wd_backend_ms_host +- _Type:_ `string` + +Define backend message server hostname for SAP Web Dispatcher connection. + +#### sap_swpm_wd_backend_rfc_host +- _Type:_ `string` + +Define backend hostname for SAP Web Dispatcher RFC connection. + +#### sap_swpm_wd_backend_rfc_instance_nr +- _Type:_ `string` + +Define backend instance number for SAP Web Dispatcher RFC connection. + +#### sap_swpm_wd_backend_rfc_client_nr +- _Type:_ `string` +- _Default:_ `000` + +Define backend SAP client for SAP Web Dispatcher RFC connection. + +#### sap_swpm_wd_backend_rfc_user +- _Type:_ `string` +- _Default:_ `DDIC` + +Define backend SAP user for SAP Web Dispatcher RFC connection. + +#### sap_swpm_wd_backend_rfc_user_password +- _Type:_ `string` + +Define password for backend SAP user for SAP Web Dispatcher RFC connection. + +#### sap_swpm_wd_backend_scenario_size +- _Type:_ `string` + +Define to set parameter `scenarioSize` during installation. + +#### sap_swpm_wd_virtual_host +- _Type:_ `string` + +Define virtual hostname of SAP Web Dispatcher. + + +### Variables for Linux User + +#### sap_swpm_sapadm_password +- _Type:_ `string` + +Define password for Linux user SAPADM. + +#### sap_swpm_sap_sidadm_password +- _Type:_ `string` + +Define password for Linux user SIDADM. + +#### sap_swpm_sapadm_uid +- _Type:_ `string` + +Define UID of Linux user SAPADM. + +#### sap_swpm_sapsys_gid +- _Type:_ `string` + +Define GID of Linux group SAPSYS. + +#### sap_swpm_sidadm_uid +- _Type:_ `string` + +Define UID of Linux user SIDADM. + + +### Miscellaneous Variables + +#### sap_swpm_ascs_install_gateway +- _Type:_ `string` +- _Default:_ `true` + +Enable to install gateway as part of ASCS installation. + +#### sap_swpm_parallel_jobs_nr +- _Type:_ `string` +- _Default:_ `23` + +Define to limit number of parallel extraction SAP HANA jobs. + +#### sap_swpm_diagnostics_agent_password +- _Type:_ `string` + +Define password for Diagnostic Agent. + +#### sap_swpm_igs_path +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_software_path }}` + +Define individual path for SAP IGS file. `sap_swpm_software_path` is used by default. + +#### sap_swpm_igs_file_name +- _Type:_ `string` + +Define individual name of SAP IGS file. Newest file is auto-detected in `sap_swpm_igs_path`. + +#### sap_swpm_igs_helper_path +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_software_path }}` + +Define individual path for SAP IGS Helper file. `sap_swpm_software_path` is used by default. + +#### sap_swpm_igs_helper_file_name +- _Type:_ `string` + +Define individual name of SAP IGS Helper file. Newest file is auto-detected in `sap_swpm_igs_helper_path`. + +#### sap_swpm_kernel_dependent_path +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_software_path }}` + +Define individual path for Database dependent kernel files. `sap_swpm_software_path` is used by default. + +#### sap_swpm_kernel_dependent_file_name +- _Type:_ `string` + +Define individual name of Database dependent kernel file. Newest file is auto-detected in `sap_swpm_kernel_dependent_path`. + +#### sap_swpm_kernel_independent_path +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_software_path }}` + +Define individual path for Database independent kernel files. `sap_swpm_software_path` is used by default. + +#### sap_swpm_kernel_independent_file_name +- _Type:_ `string` + +Define individual name of Database independent kernel file. Newest file is auto-detected in `sap_swpm_kernel_independent_path`. + +#### sap_swpm_web_dispatcher_path +- _Type:_ `string` +- _Default:_ `{{ sap_swpm_software_path }}` + +Define individual path for SAP Web Dispatcher files. `sap_swpm_software_path` is used by default. + +#### sap_swpm_web_dispatcher_file_name +- _Type:_ `string` + +Define individual name of SAP Web Dispatcher file. Newest file is auto-detected in `sap_swpm_web_dispatcher_path`. + +#### sap_swpm_fqdn +- _Type:_ `string` + +Define FQDN for SAP Installation. + +#### sap_swpm_set_fqdn +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` to disable enabling of FQDN during SWPM. + +#### sap_swpm_use_password_file +- _Type:_ `string` +- _Default:_ `n` + +Set to `y` to use encrypted password file for SWPM execution.
Location has to be same as parameter file location. + +#### sap_swpm_password_file_path +- _Type:_ `string` + +Define path to encrypted password file, used when `sap_swpm_use_password_file` is set to `y`. + +#### sap_swpm_use_livecache +- _Type:_ `bool` +- _Default:_ `false` + +Enable to use Livecache + +#### sap_swpm_load_type +- _Type:_ `string` +- _Default:_ `SAP` + +Define load type parameter `loadType`. + +#### sap_swpm_generic +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to execute `sap_swpm` role in generic auto-detection mode, ignoring steps for individual detection. + +#### sap_swpm_swpm_installation_type +- _Type:_ `string` + +Define installation type method. Available types: `restore`, `ha`, `maint_plan_stack`, `ha_maint_plan_stack`.
+Installation type is auto-detected from `sap_swpm_product_catalog_id`. + +#### sap_swpm_swpm_command_virtual_hostname +- _Type:_ `string` + +Define to override default virtual hostname `sap_swpm_virtual_hostname` sapinst command used for HA installation. + +#### sap_swpm_swpm_command_mp_stack +- _Type:_ `string` + +Define to override default sapinst command parameter for Maintenance Plan stack file. + +#### sap_swpm_setup_firewall +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to configure firewall after SWPM execution. + +#### sap_swpm_update_etchosts +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to to update `/etc/hosts` file with SAP system details for SWPM execution. + +#### sap_swpm_display_unattended_output +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to display what sapinst command is being executed. + + +### Variables for setting owner, group, and permissions for the SAP files in `sap_swpm_software_path` + +#### sap_swpm_set_file_permissions +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` to not change the owner, group, and permissions of the files in `sap_swpm_software_path`. + +#### sap_swpm_software_directory_mode +- _Type:_ `string` +- _Default:_ `0755` + +Set permissions for all directories in `sap_swpm_software_path`. + +#### sap_swpm_software_directory_owner +- _Type:_ `string` +- _Default:_ `root` + +Set owner for all directories in `sap_swpm_software_path`. + +#### sap_swpm_software_directory_group +- _Type:_ `string` +- _Default:_ `root` + +Set group ownership for all directories in `sap_swpm_software_path`. + +#### sap_swpm_files_sapcar_mode +- _Type:_ `string` +- _Default:_ `0755` + +Set permissions for SAPCAR file in `sap_swpm_sapcar_path`. + +#### sap_swpm_files_sapcar_owner +- _Type:_ `string` +- _Default:_ `root` + +Set owner for SAPCAR file in `sap_swpm_sapcar_path`. + +#### sap_swpm_files_sapcar_group +- _Type:_ `string` +- _Default:_ `root` + +Set group ownership for SAPCAR file in `sap_swpm_sapcar_path`. + +#### sap_swpm_files_non_sapcar_mode +- _Type:_ `string` +- _Default:_ `0644` + +Set permissions for all non-SAPCAR files in `sap_swpm_software_path` and for SWPM*.SAR files in `sap_swpm_swpm_path`. + +#### sap_swpm_files_non_sapcar_owner +- _Type:_ `string` +- _Default:_ `root` + +Set owner for all non-SAPCAR files in `sap_swpm_software_path` and for SWPM*.SAR files in `sap_swpm_swpm_path`. + +#### sap_swpm_files_non_sapcar_group +- _Type:_ `string` +- _Default:_ `root` + +Set group ownership for all non-SAPCAR files in `sap_swpm_software_path` and for SWPM*.SAR files in `sap_swpm_swpm_path`. + \ No newline at end of file From c12fa431f9451922c1ac7459c42347b2eb712269 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 21 Oct 2024 18:08:23 +0200 Subject: [PATCH 24/33] sap_swpm: Use sap_maintain_etc_hosts role; use booleans Signed-off-by: Bernd Finger --- roles/sap_swpm/defaults/main.yml | 30 +++++----- roles/sap_swpm/tasks/post_install.yml | 2 +- roles/sap_swpm/tasks/pre_install.yml | 4 +- roles/sap_swpm/tasks/pre_install/firewall.yml | 4 +- .../tasks/pre_install/prepare_software.yml | 2 +- .../tasks/pre_install/swpm_prepare.yml | 2 +- .../tasks/pre_install/update_etchosts.yml | 58 +++++++------------ 7 files changed, 44 insertions(+), 58 deletions(-) diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index fd24c156a..726342fcd 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -154,7 +154,7 @@ sap_swpm_software_extract_directory: # e.g. /software/sap_swpm_extracted # Note: # When using SWPM2 (for modern SAP products such as S/4 B/4), using .SAR files is recommended - param value should be false # When using SWPM1 (for older SAP products), using CD Media is the only choice - param value should be true -sap_swpm_software_use_media: 'false' +sap_swpm_software_use_media: false # Main path that this role will look for .SAR files #sap_swpm_software_path: /software/sapfiles @@ -190,12 +190,12 @@ sap_swpm_ibmdb2_unpack_path: "/db2/db2{{ sap_swpm_db_sid | lower }}/db2_software sap_swpm_mp_stack_path: sap_swpm_mp_stack_file_name: # SUM -sap_swpm_sum_prepare: 'false' -sap_swpm_sum_start: 'false' +sap_swpm_sum_prepare: false +sap_swpm_sum_start: false sap_swpm_sum_batch_file: -sap_swpm_spam_update: 'false' +sap_swpm_spam_update: false sap_swpm_spam_update_sar: -sap_swpm_configure_tms: 'true' +sap_swpm_configure_tms: true sap_swpm_tmsadm_password: sap_swpm_tms_tr_files_path: # --- Experimental --- # @@ -210,7 +210,7 @@ sap_swpm_swpm_observer_mode: false sap_swpm_swpm_remote_access_user: # --- Experimental - SWPM Observer mode --- # -sap_swpm_install_saphostagent: 'true' +sap_swpm_install_saphostagent: true ######################################## @@ -357,7 +357,7 @@ sap_swpm_backup_prefix: sap_swpm_backup_system_password: # ASCS Install Gateway -sap_swpm_ascs_install_gateway: "true" +sap_swpm_ascs_install_gateway: true ######################################## @@ -368,8 +368,8 @@ sap_swpm_ascs_install_gateway: "true" sap_swpm_wd_instance_nr: -sap_swpm_wd_system_connectivity: 'false' -sap_swpm_wd_activate_icf: 'false' +sap_swpm_wd_system_connectivity: false +sap_swpm_wd_activate_icf: false sap_swpm_wd_backend_sid: sap_swpm_wd_backend_ms_http_port: sap_swpm_wd_backend_ms_host: @@ -422,18 +422,18 @@ sap_swpm_kernel_independent_file_name: sap_swpm_web_dispatcher_path: sap_swpm_web_dispatcher_file_name: sap_swpm_fqdn: -sap_swpm_set_fqdn: "true" +sap_swpm_set_fqdn: true # If the template to use already has the passwords and they are encrypted the password file must be in the same path as the parameter file -sap_swpm_use_password_file: "n" +sap_swpm_use_password_file: false sap_swpm_password_file_path: -sap_swpm_use_livecache: "false" +sap_swpm_use_livecache: false sap_swpm_ddic_001_password: sap_swpm_load_type: 'SAP' -sap_swpm_generic: 'false' +sap_swpm_generic: false # SWPM sap_swpm_swpm_installation_type: "" @@ -442,10 +442,10 @@ sap_swpm_swpm_command_virtual_hostname: "" sap_swpm_swpm_command_mp_stack: "" # Firewall setup -sap_swpm_setup_firewall: 'false' +sap_swpm_setup_firewall: false # Update /etc/hosts -sap_swpm_update_etchosts: 'false' +sap_swpm_update_etchosts: false # Display SAP SWPM Unattended Mode output (sapinst stdout) sap_swpm_display_unattended_output: false diff --git a/roles/sap_swpm/tasks/post_install.yml b/roles/sap_swpm/tasks/post_install.yml index 935ed0571..65fba3cf0 100644 --- a/roles/sap_swpm/tasks/post_install.yml +++ b/roles/sap_swpm/tasks/post_install.yml @@ -17,7 +17,7 @@ - name: SAP SWPM Post Install - Firewall Setup ansible.builtin.include_tasks: post_install/firewall.yml when: - - "sap_swpm_setup_firewall | bool" + - sap_swpm_setup_firewall ######################################################################################################################## diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 3e8436560..803ad9c96 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -142,7 +142,7 @@ tags: sap_swpm_setup_firewall when: - sap_swpm_run_sapinst - - "sap_swpm_setup_firewall | bool" + - sap_swpm_setup_firewall tags: sap_swpm_setup_firewall # /etc/hosts @@ -154,7 +154,7 @@ tags: sap_swpm_update_etchosts when: - sap_swpm_run_sapinst - - "sap_swpm_update_etchosts | bool" + - sap_swpm_update_etchosts tags: sap_swpm_update_etchosts ################ diff --git a/roles/sap_swpm/tasks/pre_install/firewall.yml b/roles/sap_swpm/tasks/pre_install/firewall.yml index f27aea554..a36cb1644 100644 --- a/roles/sap_swpm/tasks/pre_install/firewall.yml +++ b/roles/sap_swpm/tasks/pre_install/firewall.yml @@ -54,7 +54,7 @@ - "51000" - "64997" when: - - not sap_swpm_generic | bool + - not sap_swpm_generic - name: SAP SWPM Pre Install - Add Ports Based on NR - {{ sap_swpm_db_instance_nr }} ansible.builtin.include_tasks: update_firewall.yml @@ -62,7 +62,7 @@ loop_control: loop_var: passed_port when: - - not sap_swpm_generic | bool + - not sap_swpm_generic # Reason for noqa: We currently do not determine if reloading the firewall changes anything - name: SAP SWPM Pre Install - Reload Firewall # noqa no-changed-when diff --git a/roles/sap_swpm/tasks/pre_install/prepare_software.yml b/roles/sap_swpm/tasks/pre_install/prepare_software.yml index 62ca21d1f..26e40fb98 100644 --- a/roles/sap_swpm/tasks/pre_install/prepare_software.yml +++ b/roles/sap_swpm/tasks/pre_install/prepare_software.yml @@ -177,7 +177,7 @@ - sap_swpm_set_file_permissions - name: SAP SWPM Pre Install - Full SAP System - when: not sap_swpm_generic | bool + when: not sap_swpm_generic block: # 3. IGS diff --git a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml index bbb21945a..f2ae6cb62 100644 --- a/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml +++ b/roles/sap_swpm/tasks/pre_install/swpm_prepare.yml @@ -26,7 +26,7 @@ dest: "{{ sap_swpm_tmpdir.path }}/instkey.pkey" remote_src: yes mode: '0640' - when: sap_swpm_use_password_file == "y" + when: sap_swpm_use_password_file # Create the SWPM inifile - name: SAP SWPM Pre Install - Generate the SWPM inifile diff --git a/roles/sap_swpm/tasks/pre_install/update_etchosts.yml b/roles/sap_swpm/tasks/pre_install/update_etchosts.yml index 4adbdcf34..815ae29e6 100644 --- a/roles/sap_swpm/tasks/pre_install/update_etchosts.yml +++ b/roles/sap_swpm/tasks/pre_install/update_etchosts.yml @@ -1,75 +1,61 @@ # SPDX-License-Identifier: Apache-2.0 --- -# Update etc hosts for NW +# Update /etc/hosts for NW -- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' is not configured for NW due to missing 'sap_swpm_fqdn' +- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' will not be configured for NW due to missing 'sap_swpm_fqdn' ansible.builtin.debug: msg: "WARN: Not configuring NW entries in '/etc/hosts' because 'sap_swpm_fqdn' is not defined!" when: (sap_swpm_fqdn | type_debug == 'NoneType') or (sap_swpm_fqdn | length == 0) -# Update etc hosts for HANA - - name: SAP SWPM Pre Install - Update '/etc/hosts' for NW + ansible.builtin.import_role: + name: 'community.sap_install.sap_maintain_etc_hosts' + vars: + sap_maintain_etc_hosts_list: + - node_ip: "{{ ansible_default_ipv4.address | d(ansible_all_ipv4_addresses[0]) }}" + node_name: "{{ ansible_hostname }}" + node_domain: "{{ sap_swpm_fqdn }}" + state: present when: - "sap_swpm_fqdn | type_debug != 'NoneType'" - "sap_swpm_fqdn | length > 0" - block: - - - name: SAP SWPM Pre Install - Deduplicate values from '/etc/hosts' - ansible.builtin.lineinfile: - path: /etc/hosts - create: false - regexp: (?i)^\s*{{ ansible_default_ipv4.address | d(ansible_all_ipv4_addresses[0]) }}\s+ - state: absent -# Reason for noqa: 1. Tabs can increase readability; -# 2. Tabs are allowed for /etc/hosts - - name: SAP SWPM Pre Install - Update '/etc/hosts' with NW entry # noqa no-tabs - ansible.builtin.lineinfile: - path: /etc/hosts - line: "{{ ansible_default_ipv4.address | d(ansible_all_ipv4_addresses[0]) }}\t{{ ansible_hostname }}.{{ sap_swpm_fqdn }}\t{{ ansible_hostname }}" +# Update /etc/hosts for HANA -- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' is not configured for HANA due to missing 'sap_swpm_db_ip' +- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' will not be configured for HANA due to missing 'sap_swpm_db_ip' ansible.builtin.debug: msg: "WARN: Not configuring HANA entries in '/etc/hosts' because 'sap_swpm_db_ip' is not defined!" when: (sap_swpm_db_ip | type_debug == 'NoneType') or (sap_swpm_db_ip | length == 0) -- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' is not configured for HANA due to missing 'sap_swpm_db_host' +- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' will not be configured for HANA due to missing 'sap_swpm_db_host' ansible.builtin.debug: msg: "WARN: Not configuring HANA entries in '/etc/hosts' because 'sap_swpm_db_host' is not defined!" when: (sap_swpm_db_host | type_debug == 'NoneType') or (sap_swpm_db_host | length == 0) -- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' is not configured for HANA because 'sap_swpm_db_host' is the current host +- name: SAP SWPM Pre Install - Display warning message if '/etc/hosts' will not be configured for HANA because 'sap_swpm_db_host' is the current host ansible.builtin.debug: msg: "WARN: Not configuring HANA entries in '/etc/hosts' because 'sap_swpm_db_host' is the current host!" when: sap_swpm_db_host == ansible_hostname - name: SAP SWPM Pre Install - Update '/etc/hosts' for HANA + ansible.builtin.import_role: + name: 'community.sap_install.sap_maintain_etc_hosts' + vars: + sap_maintain_etc_hosts_list: + - node_ip: "{{ sap_swpm_db_ip }}" + node_name: "{{ sap_swpm_db_host }}" + node_domain: "{{ sap_swpm_fqdn }}" + state: present when: - "sap_swpm_db_ip | type_debug != 'NoneType'" - "sap_swpm_db_ip | length > 0" - "sap_swpm_db_host | type_debug != 'NoneType'" - "sap_swpm_db_host | length > 0" - "sap_swpm_db_host != ansible_hostname" - block: - - - name: SAP SWPM Pre Install - Deduplicate values from '/etc/hosts' - ansible.builtin.lineinfile: - path: /etc/hosts - create: false - regexp: (?i)^\s*{{ sap_swpm_db_ip }}\s+ - state: absent - -# Reason for noqa: 1. Tabs can increase readability; -# 2. Tabs are allowed for /etc/hosts - - name: SAP SWPM Pre Install - Update '/etc/hosts' with HANA entry # noqa no-tabs - ansible.builtin.lineinfile: - path: /etc/hosts - line: "{{ sap_swpm_db_ip }}\t{{ sap_swpm_db_host }}.{{ sap_swpm_fqdn }}\t{{ sap_swpm_db_host }}" From 54c4ed728d74b1b5f6ddcd3f23773da30ffde599 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 28 Oct 2024 16:36:34 +0100 Subject: [PATCH 25/33] sap_swpm: Add support for HA virtual hostname resolution Signed-off-by: Bernd Finger --- roles/sap_swpm/README.md | 6 ++- roles/sap_swpm/defaults/main.yml | 2 +- roles/sap_swpm/tasks/pre_install.yml | 12 +++++ .../assert_hostname_resolution_for_ha.yml | 48 +++++++++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml diff --git a/roles/sap_swpm/README.md b/roles/sap_swpm/README.md index 04c7360a8..aafa3f751 100644 --- a/roles/sap_swpm/README.md +++ b/roles/sap_swpm/README.md @@ -414,7 +414,9 @@ Define DDIC user password in client 000 for new install, or existing for restore - _Type:_ `string` Define virtual hostname when installing High Available instances (e.g. SAP ASCS/ERS cluster). - +The role attempts to resolve `sap_swpm_virtual_hostname` on the managed node, using DNS and /etc/hosts, and will fail +if this hostname resolution fails. The role will also fail if the IPv4 address for `sap_swpm_virtual_hostname` is +not part of the IPv4 addresses of the managed node. ### Variables specific to SAP HANA Database Installation @@ -856,4 +858,4 @@ Set owner for all non-SAPCAR files in `sap_swpm_software_path` and for SWPM*.SAR - _Default:_ `root` Set group ownership for all non-SAPCAR files in `sap_swpm_software_path` and for SWPM*.SAR files in `sap_swpm_swpm_path`. - \ No newline at end of file + diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index 726342fcd..28913cb74 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -241,7 +241,7 @@ sap_swpm_ddic_000_password: # initial = not an HA setup # set this in the input file when installing ascs, ers to indicate an HA setup -sap_swpm_virtual_hostname: "initial" +sap_swpm_virtual_hostname: ######################################## diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 803ad9c96..23bdbfb70 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -147,6 +147,18 @@ # /etc/hosts +- name: SAP SWPM Pre Install - Assert hostname resolution for HA + ansible.builtin.include_tasks: + file: pre_install/assert_hostname_resolution_for_ha.yml + apply: + tags: sap_swpm_update_etchosts + when: + - sap_swpm_run_sapinst + - sap_swpm_update_etchosts + - sap_swpm_virtual_hostname | type_debug != 'NoneType' + - sap_swpm_virtual_hostname | length > 0 + tags: sap_swpm_update_etchosts + - name: SAP SWPM Pre Install - Update /etc/hosts ansible.builtin.include_tasks: file: pre_install/update_etchosts.yml diff --git a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml new file mode 100644 index 000000000..af8d26c06 --- /dev/null +++ b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml @@ -0,0 +1,48 @@ +# SPDX-License-Identifier: Apache-2.0 +--- + +# Assert HA settings + +- name: SAP SWPM Pre Install - HA settings - Ensure the dig command is present + ansible.builtin.package: + name: bind-utils + state: present + +- name: SAP SWPM Pre Install - HA settings - Try to resolve sap_swpm_virtual_hostname from DNS + ansible.builtin.command: dig +short +tries=1 +time=1 "{{ sap_swpm_virtual_hostname }}" + register: __sap_swpm_register_virtual_ip_dns + changed_when: false + failed_when: false + +- name: SAP SWPM Pre Install - HA settings - Assign sap_swpm_virtual_ip from DNS + ansible.builtin.set_fact: + __sap_swpm_fact_virtual_ip: "{{ __sap_swpm_register_virtual_ip_dns.stdout_lines[-1] }}" + when: __sap_swpm_register_virtual_ip_dns.stdout_lines | length > 0 + +- name: SAP SWPM Pre Install - HA settings - Try using /etc/hosts for name resolution + when: __sap_swpm_register_virtual_ip_dns.stdout_lines | length == 0 + block: + + - name: SAP SWPM Pre Install - HA settings - Try to resolve sap_swpm_virtual_hostname from /etc/hosts + ansible.builtin.shell: | + awk '/\s{{ sap_swpm_virtual_hostname }}\./||/\s{{ sap_swpm_virtual_hostname }}/{print $1}' /etc/hosts + register: __sap_swpm_register_virtual_ip_etc_hosts + changed_when: false + failed_when: false + + - name: SAP SWPM Pre Install - HA settings - Assign sap_swpm_virtual_ip from /etc/hosts + ansible.builtin.set_fact: + __sap_swpm_fact_virtual_ip: "{{ __sap_swpm_register_virtual_ip_etc_hosts.stdout_lines[-1] }}" + when: __sap_swpm_register_virtual_ip_etc_hosts.stdout_lines | length > 0 + +- name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_virtual_hostname can be resolved + ansible.builtin.assert: + that: __sap_swpm_fact_virtual_ip | length > 0 + fail_msg: "FAIL: sap_swpm_virtual_hostname cannot be resolved!" + success_msg: "PASS: sap_swpm__virtual_hostname can be resolved." + +- name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses + ansible.builtin.assert: + that: __sap_swpm_fact_virtual_ip in ansible_all_ipv4_addresses + fail_msg: "FAIL: __sap_swpm_fact_virtual_ip is not part of ansible_all_ipv4_addresses!" + success_msg: "PASS: __sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses." From b2f7bc4d15bc5d9d6b28fa3ae06caf3101da3330 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 31 Oct 2024 10:01:51 +0100 Subject: [PATCH 26/33] sap_swpm: remove roles/sap_swpm/requirements.yml This file should only exist on the collection level. Signed-off-by: Bernd Finger --- roles/sap_swpm/requirements.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 roles/sap_swpm/requirements.yml diff --git a/roles/sap_swpm/requirements.yml b/roles/sap_swpm/requirements.yml deleted file mode 100644 index 57520f357..000000000 --- a/roles/sap_swpm/requirements.yml +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 ---- -collections: - - name: https://github.com/ansible-collections/community.general - type: git - version: main From 87188fa09948e4d1819a0b2c5df473ad167dd044 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 4 Nov 2024 13:33:09 +0100 Subject: [PATCH 27/33] sap_swpm: Implement changes requested for virtual IP checks Signed-off-by: Bernd Finger --- .../pre_install/assert_hostname_resolution_for_ha.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml index af8d26c06..87f318978 100644 --- a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml +++ b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml @@ -37,12 +37,12 @@ - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_virtual_hostname can be resolved ansible.builtin.assert: - that: __sap_swpm_fact_virtual_ip | length > 0 - fail_msg: "FAIL: sap_swpm_virtual_hostname cannot be resolved!" - success_msg: "PASS: sap_swpm__virtual_hostname can be resolved." + that: __sap_swpm_fact_virtual_ip is defined and __sap_swpm_fact_virtual_ip | length > 0 + fail_msg: "FAIL: {{ sap_swpm_virtual_hostname }} cannot be resolved!" + success_msg: "PASS: {{ sap_swpm_virtual_hostname }} can be resolved." - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses ansible.builtin.assert: that: __sap_swpm_fact_virtual_ip in ansible_all_ipv4_addresses - fail_msg: "FAIL: __sap_swpm_fact_virtual_ip is not part of ansible_all_ipv4_addresses!" - success_msg: "PASS: __sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses." + fail_msg: "FAIL: {{ __sap_swpm_fact_virtual_ip }} is not part of ansible_all_ipv4_addresses!" + success_msg: "PASS: {{ __sap_swpm_fact_virtual_ip }} is part of ansible_all_ipv4_addresses." From 0034767e68579a3687e943ad8c650423e0220ee5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 4 Nov 2024 13:41:48 +0100 Subject: [PATCH 28/33] sap_swpm: Run the virtual IP checks before the swpm_prepare tasks Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install.yml | 29 ++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index 23bdbfb70..9d406993f 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -119,6 +119,23 @@ sap_swpm_inifile_parameters_dict: "{{ sap_swpm_inifile_parameters_dict | d({}) }}" tags: always +# Assert correct hostname and IP resolution of virtual hostname and IP if: +# - sapinst is requested to be run, and +# - /etc/hosts file is requested to be updated, and +# - sap_swpm_virtual_hostname has been defined + +- name: SAP SWPM Pre Install - Assert hostname resolution for HA + ansible.builtin.include_tasks: + file: pre_install/assert_hostname_resolution_for_ha.yml + apply: + tags: sap_swpm_update_etchosts + when: + - sap_swpm_run_sapinst + - sap_swpm_update_etchosts + - sap_swpm_virtual_hostname | type_debug != 'NoneType' + - sap_swpm_virtual_hostname | length > 0 + tags: sap_swpm_update_etchosts + ################ # Run Preinstallation Steps Based on Run Mode ################ @@ -147,18 +164,6 @@ # /etc/hosts -- name: SAP SWPM Pre Install - Assert hostname resolution for HA - ansible.builtin.include_tasks: - file: pre_install/assert_hostname_resolution_for_ha.yml - apply: - tags: sap_swpm_update_etchosts - when: - - sap_swpm_run_sapinst - - sap_swpm_update_etchosts - - sap_swpm_virtual_hostname | type_debug != 'NoneType' - - sap_swpm_virtual_hostname | length > 0 - tags: sap_swpm_update_etchosts - - name: SAP SWPM Pre Install - Update /etc/hosts ansible.builtin.include_tasks: file: pre_install/update_etchosts.yml From 3508e01fda422fc3003541060221a721a974c5a5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 4 Nov 2024 14:29:41 +0100 Subject: [PATCH 29/33] sap_swpm: Perform additional assertions for the install type ... and for the presence of sap_swpm_virtual_hostname in case of HA installation types Signed-off-by: Bernd Finger --- .../tasks/pre_install/install_type.yml | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install/install_type.yml b/roles/sap_swpm/tasks/pre_install/install_type.yml index 10936a31c..869f90f8b 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type.yml @@ -58,11 +58,41 @@ # Run Installation Type Steps ################ -- name: SAP SWPM Pre Install - Display the Installation Type - ansible.builtin.debug: - msg: "The Installation Type is: '{{ sap_swpm_swpm_installation_type }}'" - when: "sap_swpm_swpm_installation_type | length > 0" +- name: SAP SWPM Pre Install - Assert installation type is defined (including empty) + ansible.builtin.assert: + that: + - sap_swpm_swpm_installation_type is defined + fail_msg: + - "The installation type (variable 'sap_swpm_swpm_installation_type') is not defined!" + success_msg: + - "The installation type (variable 'sap_swpm_swpm_installation_type') is defined (including an empty string)." + +- name: SAP SWPM Pre Install - Assert supported installation types + ansible.builtin.assert: + that: + - sap_swpm_swpm_installation_type == '' or + sap_swpm_swpm_installation_type == 'restore' or + sap_swpm_swpm_installation_type == 'ha' or + sap_swpm_swpm_installation_type == 'maint_plan_stack' or + sap_swpm_swpm_installation_type == 'ha_maint_plan_stack' + fail_msg: + - "The specified installation type, '{{ sap_swpm_swpm_installation_type }}', is not supported!" + - "The following installation types are supported:" + - "- '' (empty string, the default)" + - "- 'restore'" + - "- 'ha'" + - "- 'maint_plan_stack'" + - "- 'ha_maint_plan_stack'" + success_msg: + - "The specified installation type, '{{ sap_swpm_swpm_installation_type }}', is supported." + +- name: SAP SWPM Pre Install - Assert that necessary variable for HA is defined + ansible.builtin.assert: + that: sap_swpm_virtual_hostname is defined and sap_swpm_virtual_hostname + fail_msg: "FAIL: {{ sap_swpm_virtual_hostname }} is not defined!" + success_msg: "PASS: The variable 'sap_swpm_virtual_hostname' is defined, as '{{ sap_swpm_virtual_hostname }}'." + when: + - sap_swpm_swpm_installation_type | regex_search('ha') - name: SAP SWPM Pre Install - Run Installation Type Steps ansible.builtin.include_tasks: "install_type/{{ sap_swpm_swpm_installation_type }}_install.yml" - when: "sap_swpm_swpm_installation_type | length > 0" From 262ca2ed519dd9c646386eb26fc094164aca349c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 5 Nov 2024 16:09:19 +0100 Subject: [PATCH 30/33] sap_swpm: Do not include the installation type file for default case Signed-off-by: Bernd Finger --- roles/sap_swpm/tasks/pre_install/install_type.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/roles/sap_swpm/tasks/pre_install/install_type.yml b/roles/sap_swpm/tasks/pre_install/install_type.yml index 869f90f8b..b5afe12f0 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type.yml @@ -94,5 +94,10 @@ when: - sap_swpm_swpm_installation_type | regex_search('ha') +################ +# Installation Type file will not be included if install type is empty (= the default): +################ + - name: SAP SWPM Pre Install - Run Installation Type Steps ansible.builtin.include_tasks: "install_type/{{ sap_swpm_swpm_installation_type }}_install.yml" + when: "sap_swpm_swpm_installation_type | length > 0" From 37fff999b48097ea2c8fa02f639e2342896611c1 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 6 Nov 2024 10:43:01 +0100 Subject: [PATCH 31/33] sap_swpm: Skip comments in /etc/hosts check Signed-off-by: Bernd Finger --- .../tasks/pre_install/assert_hostname_resolution_for_ha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml index 87f318978..c97fbcd43 100644 --- a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml +++ b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml @@ -25,7 +25,7 @@ - name: SAP SWPM Pre Install - HA settings - Try to resolve sap_swpm_virtual_hostname from /etc/hosts ansible.builtin.shell: | - awk '/\s{{ sap_swpm_virtual_hostname }}\./||/\s{{ sap_swpm_virtual_hostname }}/{print $1}' /etc/hosts + awk '/^[^#]/&&(/\s{{ sap_swpm_virtual_hostname }}\./||/\s{{ sap_swpm_virtual_hostname }}/){print $1}' /etc/hosts register: __sap_swpm_register_virtual_ip_etc_hosts changed_when: false failed_when: false From c1ec50309c86efcf87559c54f734d0cb3b693841 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 6 Nov 2024 11:12:36 +0100 Subject: [PATCH 32/33] sap_swpm: Fix /etc/hosts ip address resolution Also modify the fail_msg to not resolve sap_swpm_virtual_hostname Signed-off-by: Bernd Finger --- .../tasks/pre_install/assert_hostname_resolution_for_ha.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml index c97fbcd43..4f9e075a2 100644 --- a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml +++ b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml @@ -23,9 +23,10 @@ when: __sap_swpm_register_virtual_ip_dns.stdout_lines | length == 0 block: +# We assign the IP address only if there is exactly one line containing ipv4 and hostname: - name: SAP SWPM Pre Install - HA settings - Try to resolve sap_swpm_virtual_hostname from /etc/hosts ansible.builtin.shell: | - awk '/^[^#]/&&(/\s{{ sap_swpm_virtual_hostname }}\./||/\s{{ sap_swpm_virtual_hostname }}/){print $1}' /etc/hosts + awk 'BEGIN{a=0}/^[^#]/&&(/\s{{ sap_swpm_virtual_hostname }}\./||/\s{{ sap_swpm_virtual_hostname }}/){a++; ipaddr=$1}END{if(a==1){print ipaddr}}' /etc/hosts register: __sap_swpm_register_virtual_ip_etc_hosts changed_when: false failed_when: false @@ -38,7 +39,7 @@ - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_virtual_hostname can be resolved ansible.builtin.assert: that: __sap_swpm_fact_virtual_ip is defined and __sap_swpm_fact_virtual_ip | length > 0 - fail_msg: "FAIL: {{ sap_swpm_virtual_hostname }} cannot be resolved!" + fail_msg: "FAIL: 'sap_swpm_virtual_hostname' is not defined or cannot be resolved correctly!" success_msg: "PASS: {{ sap_swpm_virtual_hostname }} can be resolved." - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses From f6034713d6f8708affbaec48346e91e5f80006ed Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 6 Nov 2024 13:46:02 +0100 Subject: [PATCH 33/33] sap_swpm: Improve the fail message for virt hostname resolution Signed-off-by: Bernd Finger --- .../tasks/pre_install/assert_hostname_resolution_for_ha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml index 4f9e075a2..97b7c594a 100644 --- a/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml +++ b/roles/sap_swpm/tasks/pre_install/assert_hostname_resolution_for_ha.yml @@ -39,7 +39,7 @@ - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_virtual_hostname can be resolved ansible.builtin.assert: that: __sap_swpm_fact_virtual_ip is defined and __sap_swpm_fact_virtual_ip | length > 0 - fail_msg: "FAIL: 'sap_swpm_virtual_hostname' is not defined or cannot be resolved correctly!" + fail_msg: "FAIL: 'sap_swpm_virtual_hostname' is not defined, cannot be resolved, or has multiple entries in /etc/hosts!" success_msg: "PASS: {{ sap_swpm_virtual_hostname }} can be resolved." - name: SAP SWPM Pre Install - HA settings - Assert that sap_swpm_fact_virtual_ip is part of ansible_all_ipv4_addresses