From 982a9a7a8d374c6cdb47c871aa4c88aa0fd9c8cf Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 16 Mar 2023 16:08:51 +0100 Subject: [PATCH 001/128] sap_general_preconfigure: use meta/argument_specs.yml Perform additional changes related to variables. Solves issue #320. --- roles/sap_general_preconfigure/README.md | 363 +++++++++++------- .../defaults/main.yml | 6 +- .../meta/argument_specs.yml | 290 ++++++++++++++ .../assert-kernel-parameters-loop-block.yml | 10 +- .../generic/assert-kernel-parameters.yml | 12 +- .../generic/configure-kernel-parameters.yml | 6 +- roles/sap_general_preconfigure/tasks/main.yml | 2 +- roles/sap_general_preconfigure/vars/main.yml | 13 +- 8 files changed, 542 insertions(+), 160 deletions(-) create mode 100644 roles/sap_general_preconfigure/meta/argument_specs.yml diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index 8d4492c0b..90552f6c6 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -19,178 +19,271 @@ Note ---- Do not run this role against an SAP or other production system. The role will enforce a certain configuration on the managed node(s), which might not be intended. -## Role Variables + +## Role Input Parameters -- set in `defaults/main.yml`: +#### Minimum required parameters: -### Execute only certain steps of SAP notes -If the following variable is set to `no`, only certain steps of SAP notes will be executed or checked as per setting of variable `sap_general_preconfigure__`. If this variable is undefined or set to `yes`, all installation and configuration steps of applicable SAP notes will be executed. -```yaml -sap_general_preconfigure_config_all -``` +This role does not require any parameter to be set in the playbook or inventory. -### Perform installation or configuration steps, or both -If you have set `sap_general_preconfigure_config_all` (see above) to `no`, you can limit the scope of the role to only execute the installation or the configuration steps. For this purpose, set one of the following variables, or both, to `yes`. The default for both is `no`. -```yaml -sap_general_preconfigure_installation -sap_general_preconfigure_configuration -``` -### Define configuration steps of SAP notes -For defining one or more configuration steps of SAP notes to be executed or checked only, set variable `sap_general_preconfigure_config_all` to `no`, `sap_general_preconfigure_configuration` to `yes`, and one or more of the following variables to `yes`: -```yaml -sap_general_preconfigure_2002167_0[2...6], example: sap_general_preconfigure_2002167_03 -sap_general_preconfigure_1391070 -sap_general_preconfigure_0941735 -sap_general_preconfigure_2772999_[02...10], example: sap_general_preconfigure_2772999_10 -``` +### sap_general_preconfigure_config_all +- _Type:_ `bool` +- _Default:_ `true` -### Run the role in assert mode -If the following variable is set to `yes`, the role will only check if the configuration of the managed node(s) is according to the applicable SAP notes. Default is `no`. -```yaml -sap_general_preconfigure_assert -``` +If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes.
+Default is to perform installation and configuration steps.
-### Behavior of the role in assert mode -If the role is run in assert mode (see above) and the following variable is set to `yes`, assertion errors will not cause the role to fail. This can be useful for creating reports. -Default is `no`, meaning that the role will fail for any assertion error which is discovered. This variable has no meaning if the role is not run in assert mode. -```yaml -sap_general_preconfigure_assert_ignore_errors -``` +### sap_general_preconfigure_installation +- _Type:_ `bool` +- _Default:_ `false` -### (RHEL only): Enable repos -If the following variable is set to `yes`, the role will enable all repos as per definitions below. Default is `no`. -```yaml -sap_general_preconfigure_enable_repos -``` +If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
+installation steps of SAP notes.
-### (RHEL only): Use SAP NetWeaver repo -If the following variable is set to `no`, the role will not enable the SAP NetWeaver(s) repo if variable -`sap_general_preconfigure_enable_repos` is set to `yes`. Default is `yes`. -```yaml -sap_general_preconfigure_use_netweaver_repos -``` +### sap_general_preconfigure_configuration +- _Type:_ `bool` +- _Default:_ `false` -### (RHEL only): Enable SAP HANA repo -If the following variable is set to `no`, the role will not enable the SAP HANA repo(s) if variable -`sap_general_preconfigure_enable_repos` is set to `yes`. Default is `yes`. -```yaml -sap_general_preconfigure_use_hana_repos -``` +If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
+configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`.
+See also the comments at the top of file `defaults/main.yml`.
-### (RHEL only): Enable HA repo -If the following variable is set to `no`, the role will not enable the high availability repo(s) if variable -`sap_general_preconfigure_enable_repos` is set to `yes`. Default is `yes`. -```yaml -sap_general_preconfigure_use_ha_repos -``` +Example: -### (RHEL only): Disable all other repos -Set the following variable to `no` to leave all currently enabled repos enabled. The default is `yes`, which means -that the subscription-manager command will disable all repos before enabling the desired ones. ```yaml -sap_general_preconfigure_disable_all_other_repos +sap_general_preconfigure_config_all: false +sap_general_preconfigure_configuration: true +sap_general_preconfigure_2002167_02: true +sap_general_preconfigure_1391070: true ``` -### (RHEL only): Provide your own list of repos to enable -If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly. -Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically -(e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4). -```yaml -sap_general_preconfigure_req_repos -``` +### sap_general_preconfigure_assert +- _Type:_ `bool` +- _Default:_ `false` -### (RHEL only): Set the minor release lock -Set to `yes` if you want the role to set the RHEL minor release, which is a requirement for SAP HANA. Default is `no`. -Note: If you set the RHEL minor release lock, then it is strongly recommended to also set variable -`sap_general_preconfigure_repo_type` (see below) to `e4s`. -```yaml -sap_general_preconfigure_set_minor_release -``` +If set to `true`, the role will run in assertion mode instead of the default configuration mode.
-### Minimum package check -The following variable will make sure packages are installed at minimum required versions as defined in files `vars/*.yml`. Default is `yes`. -```yaml -sap_general_preconfigure_min_package_check -``` +### sap_general_preconfigure_assert_ignore_errors +- _Type:_ `bool` +- _Default:_ `false` -### Perform a yum update -If the following variable is set to `yes`, the role will run a `yum update` before performing configuration changes. Default is `no`. \ -*Note*: The outcome of a `yum update` depends on the managed node's configuration for sticky OS minor version, see the description of the release option in `man subscription-manager`. For SAP HANA installations, setting a certain minor version with `subscscription-manager release --set=X.Y` is a strict requirement. -```yaml -sap_general_preconfigure_update -``` +In assertion mode, the role will abort when encountering any assertion error.
+If this parameter is set to `false`, the role will *not* abort when encountering an assertion error.
+This is useful if the role is used for reporting a system's SAP notes compliance.
-### Reboot the system if required -If the following variable is set to `yes`, the role will reboot the managed node if required. The default is `no`, in which case the role will only report that a reboot is required. -```yaml -sap_general_preconfigure_reboot_ok -``` +### sap_general_preconfigure_system_roles_collection +- _Type:_ `str` +- _Default:_ `fedora.linux_system_roles` +- _Possible Values:_
+ - `fedora.linux_system_roles` + - `redhat.rhel_system_roles` -### How to behave if a reboot is required -In case `sap_general_preconfigure_reboot_ok` (see above) is set to `no`, we should make sure that a reboot requirement does not remain unnoticed. -The following variable will cause the role to fail if a reboot is required, if undefined or set to `yes`, which is also the default. -By setting the variable to `no`, the role will not fail if a reboot is required but just print a warning message. -```yaml -sap_general_preconfigure_fail_if_reboot_required -``` +Set which Ansible Collection to use for the Linux System Roles.
+For community/upstream, use 'fedora.linux_system_roles'
+For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles'
-### Define SELinux state -The following variable allows for defining the desired SELinux state. Default is `disabled`. -```yaml -sap_general_preconfigure_selinux_state -``` +### sap_general_preconfigure_enable_repos +- _Type:_ `bool` +- _Default:_ `false` -### Size of TMPFS in GB: -The following variable contains a formula for setting the size of TMPFS according to SAP note 941735. You can modify the formula or replace it by a static value if needed. -```yaml -sap_general_preconfigure_size_of_tmpfs_gb -``` +Set to `true` if you want the role to enable the repos as configured by the following repo related parameters.
+The default is `false`, meaning that the role will not enable repos.
-### Locale -The following variable contains the locale to be check. This check is currently not implemented. -```yaml -sap_general_preconfigure_locale -``` +### sap_general_preconfigure_use_netweaver_repos +- _Type:_ `bool` +- _Default:_ `true` -### Modify /etc/hosts -If you not want the role to check and if necessary modify `/etc/hosts` according to SAP's requirements, set the following variable to `no`. Default is `yes`. -```yaml -sap_general_preconfigure_modify_etc_hosts -``` +Set to `false` if you want the role to not enable the SAP NetWeaver repo(s).
+The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s).
+{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
-### Maximum length of the hostname -The role will fail if the hostname has more than 13 characters (defined in vars/main.yml), to catch such cases before attempting to install SAP software. -There might be cases where other limits are desired (e.g. just 8 characters). In this case, set the following variable according to your needs (e.g. '8'). -See also SAP note 611361. -```yaml -sap_general_preconfigure_max_hostname_length -``` +### sap_general_preconfigure_use_hana_repos +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` if you want the role to not enable the SAP HANA repo(s).
+The default is `true`, meaning that the role will enable the SAP HANA repo(s).
+{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+ +### sap_general_preconfigure_use_ha_repos +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` if you want the role to not enable the high availability repo(s).
+The default is `true`, meaning that the role will enable the high availability repo(s).
+{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+ +### sap_general_preconfigure_disable_all_other_repos +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above.
+The default is `true`, meaning that the role will disable all repos before enabling the desired ones.
+{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+ +### sap_general_preconfigure_req_repos +- _Type:_ `list` +- _Default:_ `undefined` + +If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly.
+Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically
+(e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4).
+ +Example: -### hostname -If the role should not use the hostname as reported by Ansible (=`ansible_hostname`), set the following variable according to your needs: ```yaml -sap_hostname +sap_general_preconfigure_req_repos: +- rhel-8-for-x86_64-baseos-eus-rpms +- rhel-8-for-x86_64-appstream-eus-rpms +- rhel-8-for-x86_64-sap-solutions-eus-rpms +- rhel-8-for-x86_64-sap-netweaver-eus-rpms +- rhel-8-for-x86_64-highavailability-eus-rpms ``` -### DNS domain name -If the role should not use the DNS domain name as reported by Ansible (=`ansible_domain`), set the following variable according to your needs: +### sap_general_preconfigure_set_minor_release +- _Type:_ `bool` +- _Default:_ `false` + +Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`.
+{'Note': 'If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos.'}
+ +### sap_general_preconfigure_packagegroups +- _Type:_ `str` +- _Default:_ `{{ __sap_general_preconfigure_packagegroups }}` + +The name of the software package group to install.
+ +Example: + ```yaml -sap_domain +'@minimal-environment' ``` -### IP address -If the role should not use the primary IP address as reported by Ansible (=`ansible_default_ipv4.address`), set the following variable according to your needs: +### sap_general_preconfigure_envgroups +- _Type:_ `str` +- _Default:_ `{{ __sap_general_preconfigure_envgroups }}` + +The name of the software environment group to check.
+ +Example: + ```yaml -sap_ip +'@minimal-environment' ``` -### Linux group name of the database user -The following variable contains the name of the group which is used for the database(s), e.g. 'dba'. +### sap_general_preconfigure_packages +- _Type:_ `list` +- _Default:_ `{{ __sap_general_preconfigure_packages }}` + +The list of packages to install.
+ +### sap_general_preconfigure_min_package_check +- _Type:_ `bool` +- _Default:_ `true` + +The default is to install or check if the minimum package versions are installed as defined in the vars files.
+Set to `false` if you do not install or check these minimum package versions.
+ +### sap_general_preconfigure_update +- _Type:_ `bool` +- _Default:_ `false` + +By default, the role will not update the system, for avoiding an unintentional minor OS release update.
+Set this parameter to `true` if you want to update your system to the latest package versions.
+When using SAP HANA, make sure to set the release lock properly so the minor OS release will be one of
+those for which SAP HANA is supported. See also `sap_general_preconfigure_set_minor_release`.
+ +### sap_general_preconfigure_reboot_ok +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` if you want to perform a reboot at the end of the role, if necessary.
+ +### sap_general_preconfigure_fail_if_reboot_required +- _Type:_ `bool` +- _Default:_ `true` + +If `sap_general_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not
+remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior.
+Can be useful if you want to implement your own reboot handling.
+ +### sap_general_preconfigure_selinux_state +- _Type:_ `str` +- _Default:_ `permissive` +- _Possible Values:_
+ - `enforcing` + - `permissive` + - `disabled` + +One of the SELinux states to be set on the system.
+ +### sap_general_preconfigure_modify_selinux_labels +- _Type:_ `bool` +- _Default:_ `true` + +Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`.
+ +### sap_general_preconfigure_size_of_tmpfs_gb +- _Type:_ `str` +- _Default:_ `{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}` + +The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.
+ +### sap_general_preconfigure_modify_etc_hosts +- _Type:_ `bool` +- _Default:_ `true` + +Set to `no` if you do not want the role to modify the `/etc/hosts` file.
+ +### sap_general_preconfigure_etc_sysctl_sap_conf +- _Type:_ `str` +- _Default:_ `/etc/sysctl.d/sap.conf` + +The file name of the sysctl config file to be used
+ +### sap_general_preconfigure_kernel_parameters +- _Type:_ `list` +- _Default:_ `{{ __sap_general_preconfigure_kernel_parameters_default }}` + +The Linux kernel parameters to use. By default, these are taken from the vars file.
+ +Example: + ```yaml -sap_general_preconfigure_db_group_name +sap_general_preconfigure_kernel_parameters: +- name: vm.max_map_count + value: '2147483647' +- name: fs.aio-max-nr + value: '18446744073709551615' ``` +### sap_general_preconfigure_max_hostname_length +- _Type:_ `str` +- _Default:_ `13` + +The maximum length of the hostname. See SAP note 611361.
+ +### sap_hostname +- _Type:_ `str` +- _Default:_ `{{ ansible_hostname }}` + +The hostname to be used for updating or checking `/etc/hosts` entries.
+ +### sap_domain +- _Type:_ `str` +- _Default:_ `{{ ansible_domain }}` + +The DNS domain name to be used for updating or checking `/etc/hosts` entries.
+ +### sap_ip +- _Type:_ `str` +- _Default:_ `{{ ansible_default_ipv4.address }}` + +The IPV4 address to be used for updating or checking `/etc/hosts` entries.
+ + + ## Dependencies This role does not depend on any other role. diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 759947120..b73bc8a72 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -81,14 +81,14 @@ sap_general_preconfigure_modify_selinux_labels: yes sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}" -sap_general_preconfigure_locale: en_US.UTF-8 - sap_general_preconfigure_modify_etc_hosts: yes +sap_general_preconfigure_etc_sysctl_sap_conf: '/etc/sysctl.d/sap.conf' + sap_general_preconfigure_kernel_parameters: "{{ __sap_general_preconfigure_kernel_parameters_default }}" # see SAP note 611361 for possible restrictions for the maximum length of the hostname: -sap_general_preconfigure_max_hostname_length: "{{ __sap_general_preconfigure_max_hostname_length }}" +sap_general_preconfigure_max_hostname_length: '13' sap_hostname: "{{ ansible_hostname }}" diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml new file mode 100644 index 000000000..62c169f3e --- /dev/null +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -0,0 +1,290 @@ +--- +# Requires: ansible 2.11 +# Argument specifications in this separate file maintain backwards compatibility. +argument_specs: + + main: + short_description: Variables for SAP general preconfiguration + options: + +# sap_general_preconfigure_... +# default: +# description: +# - +# example: +# +# required: false +# type: +# options: # additional options for lists and dicts +# : +# description: +# ... + + sap_general_preconfigure_config_all: + default: true + description: + - If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes. + - Default is to perform installation and configuration steps. + required: false + type: bool + + sap_general_preconfigure_installation: + default: false + description: + - If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the + - installation steps of SAP notes. + required: false + type: bool + + sap_general_preconfigure_configuration: + default: false + description: + - If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the + - configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. + - See also the comments at the top of file `defaults/main.yml`. + example: + sap_general_preconfigure_config_all: false + sap_general_preconfigure_configuration: true + sap_general_preconfigure_2002167_02: true + sap_general_preconfigure_1391070: true + required: false + type: bool + + sap_general_preconfigure_assert: + default: false + description: + - If set to `true`, the role will run in assertion mode instead of the default configuration mode. + required: false + type: bool + + sap_general_preconfigure_assert_ignore_errors: + default: false + description: + - In assertion mode, the role will abort when encountering any assertion error. + - If this parameter is set to `false`, the role will *not* abort when encountering an assertion error. + - This is useful if the role is used for reporting a system's SAP notes compliance. + required: false + type: bool + + sap_general_preconfigure_system_roles_collection: + default: 'fedora.linux_system_roles' + description: + - Set which Ansible Collection to use for the Linux System Roles. + - For community/upstream, use 'fedora.linux_system_roles' + - For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' + choices: + - 'fedora.linux_system_roles' + - 'redhat.rhel_system_roles' + required: false + type: str + + sap_general_preconfigure_enable_repos: + default: false + description: + - Set to `true` if you want the role to enable the repos as configured by the following repo related parameters. + - The default is `false`, meaning that the role will not enable repos. + required: false + type: bool + + sap_general_preconfigure_use_netweaver_repos: + default: true + description: + - Set to `false` if you want the role to not enable the SAP NetWeaver repo(s). + - The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s). + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + required: false + type: bool + + sap_general_preconfigure_use_hana_repos: + default: true + description: + - Set to `false` if you want the role to not enable the SAP HANA repo(s). + - The default is `true`, meaning that the role will enable the SAP HANA repo(s). + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + required: false + type: bool + + sap_general_preconfigure_use_ha_repos: + default: true + description: + - Set to `false` if you want the role to not enable the high availability repo(s). + - The default is `true`, meaning that the role will enable the high availability repo(s). + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + required: false + type: bool + + sap_general_preconfigure_disable_all_other_repos: + default: true + description: + - Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above. + - The default is `true`, meaning that the role will disable all repos before enabling the desired ones. + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + required: false + type: bool + + sap_general_preconfigure_req_repos: + default: undefined + description: + - If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly. + - Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically + - (e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4). + example: + sap_general_preconfigure_req_repos: + - rhel-8-for-x86_64-baseos-eus-rpms + - rhel-8-for-x86_64-appstream-eus-rpms + - rhel-8-for-x86_64-sap-solutions-eus-rpms + - rhel-8-for-x86_64-sap-netweaver-eus-rpms + - rhel-8-for-x86_64-highavailability-eus-rpms + required: false + type: list + elements: str + + sap_general_preconfigure_set_minor_release: + default: false + description: + - Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. + - Note: If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos. + required: false + type: bool + + sap_general_preconfigure_packagegroups: + default: "{{ __sap_general_preconfigure_packagegroups }}" + description: + - The name of the software package group to install. + example: + '@minimal-environment' + required: false + type: str + + sap_general_preconfigure_envgroups: + default: "{{ __sap_general_preconfigure_envgroups }}" + description: + - The name of the software environment group to check. + example: + '@minimal-environment' + required: false + type: str + + sap_general_preconfigure_packages: + default: "{{ __sap_general_preconfigure_packages }}" + description: + - The list of packages to install. + required: false + type: list + elements: str + + sap_general_preconfigure_min_package_check: + default: true + description: + - The default is to install or check if the minimum package versions are installed as defined in the vars files. + - Set to `false` if you do not install or check these minimum package versions. + required: false + type: bool + + sap_general_preconfigure_update: + default: false + description: + - By default, the role will not update the system, for avoiding an unintentional minor OS release update. + - Set this parameter to `true` if you want to update your system to the latest package versions. + - When using SAP HANA, make sure to set the release lock properly so the minor OS release will be one of + - those for which SAP HANA is supported. See also `sap_general_preconfigure_set_minor_release`. + required: false + type: bool + + sap_general_preconfigure_reboot_ok: + default: false + description: + - Set to `true` if you want to perform a reboot at the end of the role, if necessary. + required: false + type: bool + + sap_general_preconfigure_fail_if_reboot_required: + default: true + description: + - If `sap_general_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not + - remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior. + - Can be useful if you want to implement your own reboot handling. + required: false + type: bool + + sap_general_preconfigure_selinux_state: + default: 'permissive' + description: + - One of the SELinux states to be set on the system. + choices: + - 'enforcing' + - 'permissive' + - 'disabled' + required: false + type: str + + sap_general_preconfigure_modify_selinux_labels: + default: true + description: + - Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`. + required: false + type: bool + + sap_general_preconfigure_size_of_tmpfs_gb: + default: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}" + description: + - The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735. + required: false + type: str + + sap_general_preconfigure_modify_etc_hosts: + default: true + description: + - Set to `no` if you do not want the role to modify the `/etc/hosts` file. + required: false + type: bool + + sap_general_preconfigure_etc_sysctl_sap_conf: + default: '/etc/sysctl.d/sap.conf' + description: + - The file name of the sysctl config file to be used + required: false + type: str + + sap_general_preconfigure_kernel_parameters: + default: "{{ __sap_general_preconfigure_kernel_parameters_default }}" + description: + - The Linux kernel parameters to use. By default, these are taken from the vars file. + example: + sap_general_preconfigure_kernel_parameters: + - name: vm.max_map_count + value: '2147483647' + - name: fs.aio-max-nr + value: '18446744073709551615' + required: false + type: list + elements: dict + +# see SAP note 611361 for possible restrictions for the maximum length of the hostname: + sap_general_preconfigure_max_hostname_length: + default: '13' + description: + - The maximum length of the hostname. See SAP note 611361. + required: false + type: str + + sap_hostname: + default: "{{ ansible_hostname }}" + description: + - The hostname to be used for updating or checking `/etc/hosts` entries. + required: false + type: str + + sap_domain: + default: "{{ ansible_domain }}" + description: + - The DNS domain name to be used for updating or checking `/etc/hosts` entries. + required: false + type: str + + sap_ip: + default: "{{ ansible_default_ipv4.address }}" + description: + - The IPV4 address to be used for updating or checking `/etc/hosts` entries. + required: false + type: str diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml index 2c721ed28..d3b90e0ae 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters-loop-block.yml @@ -2,19 +2,19 @@ # loop block for sapnote/RedHat/generic/assert-kernel-parameters.yml -- name: Get {{ line_item.name }} from {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} - ansible.builtin.shell: awk 'BEGIN{FS="="}/{{ line_item.name }}/{gsub ("^\\s*", "", $NF); print $NF}' {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} +- name: Get {{ line_item.name }} from {{ sap_general_preconfigure_etc_sysctl_sap_conf }} + ansible.builtin.shell: awk 'BEGIN{FS="="}/{{ line_item.name }}/{gsub ("^\\s*", "", $NF); print $NF}' {{ sap_general_preconfigure_etc_sysctl_sap_conf }} register: __sap_general_preconfigure_register_sysctl_sap_conf_kernel_parameter_assert changed_when: no ignore_errors: yes when: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.exists -- name: Assert that {{ line_item.name }} is set correctly in {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} +- name: Assert that {{ line_item.name }} is set correctly in {{ sap_general_preconfigure_etc_sysctl_sap_conf }} ansible.builtin.assert: that: "__sap_general_preconfigure_register_sysctl_sap_conf_kernel_parameter_assert.stdout == '{{ line_item.value }}'" - fail_msg: "FAIL: The value of '{{ line_item.name }}' in '{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}' is + fail_msg: "FAIL: The value of '{{ line_item.name }}' in '{{ sap_general_preconfigure_etc_sysctl_sap_conf }}' is '{{ __sap_general_preconfigure_register_sysctl_sap_conf_kernel_parameter_assert.stdout }}' but the expected value is '{{ line_item.value }}'!" - success_msg: "PASS: The value of '{{ line_item.name }}' in '{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}' is + success_msg: "PASS: The value of '{{ line_item.name }}' in '{{ sap_general_preconfigure_etc_sysctl_sap_conf }}' is '{{ __sap_general_preconfigure_register_sysctl_sap_conf_kernel_parameter_assert.stdout }}'." ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" when: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.exists diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters.yml index caa1dae03..a6d2f49b0 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/assert-kernel-parameters.yml @@ -1,22 +1,22 @@ --- -- name: Get info about file {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} +- name: Get info about file {{ sap_general_preconfigure_etc_sysctl_sap_conf }} ansible.builtin.stat: - path: "{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}" + path: "{{ sap_general_preconfigure_etc_sysctl_sap_conf }}" register: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert - name: Assert that file /etc/sysctl.d/sap.conf exists ansible.builtin.assert: that: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.exists - fail_msg: "FAIL: File {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} does not exist!" - success_msg: "PASS: File {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} exist." + fail_msg: "FAIL: File {{ sap_general_preconfigure_etc_sysctl_sap_conf }} does not exist!" + success_msg: "PASS: File {{ sap_general_preconfigure_etc_sysctl_sap_conf }} exist." ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" - name: Assert that file /etc/sysctl.d/sap.conf is a regular file ansible.builtin.assert: that: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.isreg - fail_msg: "FAIL: File {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} is not a regular file!" - success_msg: "PASS: File {{ __sap_general_preconfigure_etc_sysctl_sap_conf }} is a regular file." + fail_msg: "FAIL: File {{ sap_general_preconfigure_etc_sysctl_sap_conf }} is not a regular file!" + success_msg: "PASS: File {{ sap_general_preconfigure_etc_sysctl_sap_conf }} is a regular file." ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" when: __sap_general_preconfigure_register_stat_sysctl_sap_conf_assert.stat.exists diff --git a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml index 736849aaa..192d90042 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/generic/configure-kernel-parameters.yml @@ -2,7 +2,7 @@ - name: Set kernel parameters ansible.builtin.lineinfile: - path: "{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}" + path: "{{ sap_general_preconfigure_etc_sysctl_sap_conf }}" create: yes mode: '0644' regexp: ^{{ line_item.name }}.* @@ -12,8 +12,8 @@ loop_control: loop_var: line_item -- name: Reload kernel parameters from file '{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}' - ansible.builtin.command: sysctl -p "{{ __sap_general_preconfigure_etc_sysctl_sap_conf }}" +- name: Reload kernel parameters from file '{{ sap_general_preconfigure_etc_sysctl_sap_conf }}' + ansible.builtin.command: sysctl -p "{{ sap_general_preconfigure_etc_sysctl_sap_conf }}" register: __sap_general_preconfigure_register_sap_conf_sysctl_p_output changed_when: true diff --git a/roles/sap_general_preconfigure/tasks/main.yml b/roles/sap_general_preconfigure/tasks/main.yml index 8f8068da5..52b5fe1ae 100644 --- a/roles/sap_general_preconfigure/tasks/main.yml +++ b/roles/sap_general_preconfigure/tasks/main.yml @@ -27,7 +27,7 @@ sap_general_preconfigure_fail_if_reboot_required: "{{ sap_preconfigure_fail_if_reboot_required | d(sap_general_preconfigure_fail_if_reboot_required) }}" sap_general_preconfigure_selinux_state: "{{ sap_preconfigure_selinux_state | d(sap_general_preconfigure_selinux_state) }}" sap_general_preconfigure_size_of_tmpfs_gb: "{{ sap_preconfigure_size_of_tmpfs_gb | d(sap_general_preconfigure_size_of_tmpfs_gb) }}" - sap_general_preconfigure_locale: "{{ sap_preconfigure_locale | d(sap_general_preconfigure_locale) }}" +# sap_general_preconfigure_locale: "{{ sap_preconfigure_locale | d(sap_general_preconfigure_locale) }}" sap_general_preconfigure_modify_etc_hosts: "{{ sap_preconfigure_modify_etc_hosts | d(sap_general_preconfigure_modify_etc_hosts) }}" sap_general_preconfigure_kernel_parameters: "{{ sap_preconfigure_kernel_parameters | d(sap_general_preconfigure_kernel_parameters) }}" sap_general_preconfigure_max_hostname_length: "{{ sap_preconfigure_max_hostname_length | d(sap_general_preconfigure_max_hostname_length) }}" diff --git a/roles/sap_general_preconfigure/vars/main.yml b/roles/sap_general_preconfigure/vars/main.yml index 46c54f846..f3d4ba772 100644 --- a/roles/sap_general_preconfigure/vars/main.yml +++ b/roles/sap_general_preconfigure/vars/main.yml @@ -1,9 +1,8 @@ --- -# define variables here that will not change -# Those are valid for all OS -# - -__sap_general_preconfigure_etc_sysctl_sap_conf: /etc/sysctl.d/sap.conf - -__sap_general_preconfigure_max_hostname_length: '13' +# dummy entries for passing the arg spec validation: +__sap_general_preconfigure_packagegroups: '' +__sap_general_preconfigure_envgroups: '' +__sap_general_preconfigure_packages: [] +__sap_general_preconfigure_size_of_tmpfs_gb: '' +__sap_general_preconfigure_kernel_parameters_default: [] From c194c46deaf320f725b034494ca7c8cc624f3e87 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 17 Mar 2023 00:11:39 +0100 Subject: [PATCH 002/128] sap_general_preconfigure: Use argument_specs.yml Solves issue #320 README.md and defaults/main.yml have been recreated programmatically from meta/argument_specs.yml --- roles/sap_general_preconfigure/README.md | 91 +++++----- .../defaults/main.yml | 156 +++++++++++------- .../meta/argument_specs.yml | 16 +- 3 files changed, 149 insertions(+), 114 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index 90552f6c6..a4b07d3ab 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -19,7 +19,7 @@ Note ---- Do not run this role against an SAP or other production system. The role will enforce a certain configuration on the managed node(s), which might not be intended. - + ## Role Input Parameters #### Minimum required parameters: @@ -28,21 +28,21 @@ This role does not require any parameter to be set in the playbook or inventory. ### sap_general_preconfigure_config_all -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes.
Default is to perform installation and configuration steps.
### sap_general_preconfigure_installation -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
installation steps of SAP notes.
### sap_general_preconfigure_configuration -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
@@ -59,13 +59,13 @@ sap_general_preconfigure_1391070: true ``` ### sap_general_preconfigure_assert -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` If set to `true`, the role will run in assertion mode instead of the default configuration mode.
### sap_general_preconfigure_assert_ignore_errors -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` In assertion mode, the role will abort when encountering any assertion error.
@@ -73,8 +73,8 @@ If this parameter is set to `false`, the role will *not* abort when encountering This is useful if the role is used for reporting a system's SAP notes compliance.
### sap_general_preconfigure_system_roles_collection -- _Type:_ `str` -- _Default:_ `fedora.linux_system_roles` +- _Type:_ `str` +- _Default:_ `'fedora.linux_system_roles'` - _Possible Values:_
- `fedora.linux_system_roles` - `redhat.rhel_system_roles` @@ -84,14 +84,14 @@ For community/upstream, use 'fedora.linux_system_roles'
For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles'
### sap_general_preconfigure_enable_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `true` if you want the role to enable the repos as configured by the following repo related parameters.
The default is `false`, meaning that the role will not enable repos.
### sap_general_preconfigure_use_netweaver_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the SAP NetWeaver repo(s).
@@ -99,7 +99,7 @@ The default is `true`, meaning that the role will enable the SAP NetWeaver repo( {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
### sap_general_preconfigure_use_hana_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the SAP HANA repo(s).
@@ -107,7 +107,7 @@ The default is `true`, meaning that the role will enable the SAP HANA repo(s). ### sap_general_preconfigure_use_ha_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the high availability repo(s).
@@ -115,7 +115,7 @@ The default is `true`, meaning that the role will enable the high availability r {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
### sap_general_preconfigure_disable_all_other_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above.
@@ -123,10 +123,9 @@ The default is `true`, meaning that the role will disable all repos before enabl {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
### sap_general_preconfigure_req_repos -- _Type:_ `list` -- _Default:_ `undefined` +- _Type:_ `list` with elements of type `str` -If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly.
+If you want to provide your own list of repos (e.g. on cloud systems), set this variable accordingly.
Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically
(e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4).
@@ -142,15 +141,15 @@ sap_general_preconfigure_req_repos: ``` ### sap_general_preconfigure_set_minor_release -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`.
{'Note': 'If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos.'}
### sap_general_preconfigure_packagegroups -- _Type:_ `str` -- _Default:_ `{{ __sap_general_preconfigure_packagegroups }}` +- _Type:_ `str` +- _Default:_ `"{{ __sap_general_preconfigure_packagegroups }}"` The name of the software package group to install.
@@ -161,8 +160,8 @@ Example: ``` ### sap_general_preconfigure_envgroups -- _Type:_ `str` -- _Default:_ `{{ __sap_general_preconfigure_envgroups }}` +- _Type:_ `str` +- _Default:_ `"{{ __sap_general_preconfigure_envgroups }}"` The name of the software environment group to check.
@@ -173,20 +172,20 @@ Example: ``` ### sap_general_preconfigure_packages -- _Type:_ `list` -- _Default:_ `{{ __sap_general_preconfigure_packages }}` +- _Type:_ `list` with elements of type `str` +- _Default:_ `"{{ __sap_general_preconfigure_packages }}"` The list of packages to install.
### sap_general_preconfigure_min_package_check -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` The default is to install or check if the minimum package versions are installed as defined in the vars files.
Set to `false` if you do not install or check these minimum package versions.
### sap_general_preconfigure_update -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` By default, the role will not update the system, for avoiding an unintentional minor OS release update.
@@ -195,13 +194,13 @@ When using SAP HANA, make sure to set the release lock properly so the minor OS those for which SAP HANA is supported. See also `sap_general_preconfigure_set_minor_release`.
### sap_general_preconfigure_reboot_ok -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `true` if you want to perform a reboot at the end of the role, if necessary.
### sap_general_preconfigure_fail_if_reboot_required -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` If `sap_general_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not
@@ -209,8 +208,8 @@ remain unnoticed. For this reason, we let the role fail. Set this parameter to ` Can be useful if you want to implement your own reboot handling.
### sap_general_preconfigure_selinux_state -- _Type:_ `str` -- _Default:_ `permissive` +- _Type:_ `str` +- _Default:_ `'permissive'` - _Possible Values:_
- `enforcing` - `permissive` @@ -219,32 +218,32 @@ Can be useful if you want to implement your own reboot handling.
One of the SELinux states to be set on the system.
### sap_general_preconfigure_modify_selinux_labels -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`.
### sap_general_preconfigure_size_of_tmpfs_gb -- _Type:_ `str` -- _Default:_ `{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}` +- _Type:_ `str` +- _Default:_ `"{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}"` The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.
### sap_general_preconfigure_modify_etc_hosts -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `no` if you do not want the role to modify the `/etc/hosts` file.
### sap_general_preconfigure_etc_sysctl_sap_conf -- _Type:_ `str` -- _Default:_ `/etc/sysctl.d/sap.conf` +- _Type:_ `str` +- _Default:_ `'/etc/sysctl.d/sap.conf'` The file name of the sysctl config file to be used
### sap_general_preconfigure_kernel_parameters -- _Type:_ `list` -- _Default:_ `{{ __sap_general_preconfigure_kernel_parameters_default }}` +- _Type:_ `list` with elements of type `dict` +- _Default:_ `"{{ __sap_general_preconfigure_kernel_parameters_default }}"` The Linux kernel parameters to use. By default, these are taken from the vars file.
@@ -259,30 +258,30 @@ sap_general_preconfigure_kernel_parameters: ``` ### sap_general_preconfigure_max_hostname_length -- _Type:_ `str` -- _Default:_ `13` +- _Type:_ `str` +- _Default:_ `'13'` The maximum length of the hostname. See SAP note 611361.
### sap_hostname -- _Type:_ `str` -- _Default:_ `{{ ansible_hostname }}` +- _Type:_ `str` +- _Default:_ `"{{ ansible_hostname }}"` The hostname to be used for updating or checking `/etc/hosts` entries.
### sap_domain -- _Type:_ `str` -- _Default:_ `{{ ansible_domain }}` +- _Type:_ `str` +- _Default:_ `"{{ ansible_domain }}"` The DNS domain name to be used for updating or checking `/etc/hosts` entries.
### sap_ip -- _Type:_ `str` -- _Default:_ `{{ ansible_default_ipv4.address }}` +- _Type:_ `str` +- _Default:_ `"{{ ansible_default_ipv4.address }}"` The IPV4 address to be used for updating or checking `/etc/hosts` entries.
- + ## Dependencies diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index b73bc8a72..1719acb91 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -1,102 +1,132 @@ --- -# defaults file for sap_general_preconfigure - -# For executing just some of the configuration steps, -# 1 - set sap_general_preconfigure_config_all to "no" (default is "yes"), -# 2 - set sap_general_preconfigure_installation or sap_general_preconfigure_configuration, or both, to "yes" (default for both is "no") -# 3 - and set one or more of the SAP notes related variables to "yes": -# sap_general_preconfigure_config_all: no -# sap_general_preconfigure_installation: yes -# sap_general_preconfigure_configuration: yes -## examples for RHEL7: -# sap_general_preconfigure_2002167_02: yes -# sap_general_preconfigure_2002167_06: yes -# sap_general_preconfigure_1391070: yes -# sap_general_preconfigure_0941735: yes -## examples for RHEL8: -# sap_general_preconfigure_2772999_02: yes -# sap_general_preconfigure_2772999_10: yes - -sap_general_preconfigure_assert: no - -sap_general_preconfigure_assert_ignore_errors: no +# BEGIN: Default Variables for sap_general_preconfigure -# Set which Ansible Collection to use for the Linux System Roles. -# For community/upstream, use 'fedora.linux_system_roles' -# For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' -sap_general_preconfigure_system_roles_collection: 'fedora.linux_system_roles' - -# Set to `yes` if you want the role to enable the repos as configured below. The default is `no`. -sap_general_preconfigure_enable_repos: no +# sap_general_preconfigure_config_all: (not defined by default) +# If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes. +# Default is to perform installation and configuration steps. -# Set to `no` if you want the role to not enable the SAP NetWeaver repo(s). The default is `yes`. -sap_general_preconfigure_use_netweaver_repos: yes +# sap_general_preconfigure_installation: (not defined by default) +# If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the +# installation steps of SAP notes. -# Set to `no` if you want the role to not enable the SAP HANA repo(s). The default is `yes`. -sap_general_preconfigure_use_hana_repos: yes +# sap_general_preconfigure_configuration: (not defined by default) +# If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the +# configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. +# See also the comments at the top of file `defaults/main.yml`. -# Set to `no` if you want the role to not enable the high availability repo(s). The default is `yes`. -sap_general_preconfigure_use_ha_repos: yes +sap_general_preconfigure_assert: false +# If set to `true`, the role will run in assertion mode instead of the default configuration mode. -# Set to `yes` if you want the role to disable all repos before enabling the desired ones as configured above. The default is `yes`. -sap_general_preconfigure_disable_all_other_repos: yes +sap_general_preconfigure_assert_ignore_errors: false +# In assertion mode, the role will abort when encountering any assertion error. +# If this parameter is set to `false`, the role will *not* abort when encountering an assertion error. +# This is useful if the role is used for reporting a system's SAP notes compliance. -# If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly. +sap_general_preconfigure_system_roles_collection: 'fedora.linux_system_roles' +# Set which Ansible Collection to use for the Linux System Roles. +# For community/upstream, use 'fedora.linux_system_roles' +# For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' +# Possible Values: +# - fedora.linux_system_roles +# - redhat.rhel_system_roles + +sap_general_preconfigure_enable_repos: false +# Set to `true` if you want the role to enable the repos as configured by the following repo related parameters. +# The default is `false`, meaning that the role will not enable repos. + +sap_general_preconfigure_use_netweaver_repos: true +# Set to `false` if you want the role to not enable the SAP NetWeaver repo(s). +# The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s). +# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} + +sap_general_preconfigure_use_hana_repos: true +# Set to `false` if you want the role to not enable the SAP HANA repo(s). +# The default is `true`, meaning that the role will enable the SAP HANA repo(s). +# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} + +sap_general_preconfigure_use_ha_repos: true +# Set to `false` if you want the role to not enable the high availability repo(s). +# The default is `true`, meaning that the role will enable the high availability repo(s). +# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} + +sap_general_preconfigure_disable_all_other_repos: true +# Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above. +# The default is `true`, meaning that the role will disable all repos before enabling the desired ones. +# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} + +# sap_general_preconfigure_req_repos: (not defined by default) +# If you want to provide your own list of repos (e.g. on cloud systems), set this variable accordingly. # Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically # (e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4). -#sap_general_preconfigure_req_repos: -# - rhel-8-for-x86_64-baseos-e4s-rpms -# - rhel-8-for-x86_64-appstream-e4s-rpms -# - rhel-8-for-x86_64-sap-solutions-e4s-rpms -# - rhel-8-for-x86_64-sap-netweaver-e4s-rpms -# - rhel-8-for-x86_64-highavailability-e4s-rpms +sap_general_preconfigure_set_minor_release: false # Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. -# Note: If you set the RHEL minor release, then it is strongly recommended to also set the repository type to `e4s` -# (see above) -sap_general_preconfigure_set_minor_release: no +# {'Note': 'If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos.'} sap_general_preconfigure_packagegroups: "{{ __sap_general_preconfigure_packagegroups }}" -# sap_general_preconfigure_packagegroups: '@minimal-environment' +# The name of the software package group to install. sap_general_preconfigure_envgroups: "{{ __sap_general_preconfigure_envgroups }}" -# sap_general_preconfigure_envgroups: '@minimal-environment' +# The name of the software environment group to check. sap_general_preconfigure_packages: "{{ __sap_general_preconfigure_packages }}" +# The list of packages to install. -sap_general_preconfigure_min_package_check: yes +sap_general_preconfigure_min_package_check: true +# The default is to install or check if the minimum package versions are installed as defined in the vars files. +# Set to `false` if you do not install or check these minimum package versions. -sap_general_preconfigure_update: no +sap_general_preconfigure_update: false +# By default, the role will not update the system, for avoiding an unintentional minor OS release update. +# Set this parameter to `true` if you want to update your system to the latest package versions. +# When using SAP HANA, make sure to set the release lock properly so the minor OS release will be one of +# those for which SAP HANA is supported. See also `sap_general_preconfigure_set_minor_release`. -sap_general_preconfigure_reboot_ok: no +sap_general_preconfigure_reboot_ok: false +# Set to `true` if you want to perform a reboot at the end of the role, if necessary. -sap_general_preconfigure_fail_if_reboot_required: yes +sap_general_preconfigure_fail_if_reboot_required: true +# If `sap_general_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not +# remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior. +# Can be useful if you want to implement your own reboot handling. -sap_general_preconfigure_selinux_state: permissive +sap_general_preconfigure_selinux_state: 'permissive' +# One of the SELinux states to be set on the system. +# Possible Values: +# - enforcing +# - permissive +# - disabled -# For compatibility of SAP software with SELinux in enforcing mode, the role will recursively add -# the 'usr_t' label to directories and files in `/usr/sap`. -# If relabeling not desired, set the following variable to `no`. -sap_general_preconfigure_modify_selinux_labels: yes +sap_general_preconfigure_modify_selinux_labels: true +# Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`. sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}" +# The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735. -sap_general_preconfigure_modify_etc_hosts: yes +sap_general_preconfigure_modify_etc_hosts: true +# Set to `no` if you do not want the role to modify the `/etc/hosts` file. sap_general_preconfigure_etc_sysctl_sap_conf: '/etc/sysctl.d/sap.conf' +# The file name of the sysctl config file to be used sap_general_preconfigure_kernel_parameters: "{{ __sap_general_preconfigure_kernel_parameters_default }}" +# The Linux kernel parameters to use. By default, these are taken from the vars file. -# see SAP note 611361 for possible restrictions for the maximum length of the hostname: sap_general_preconfigure_max_hostname_length: '13' +# The maximum length of the hostname. See SAP note 611361. sap_hostname: "{{ ansible_hostname }}" +# The hostname to be used for updating or checking `/etc/hosts` entries. sap_domain: "{{ ansible_domain }}" +# The DNS domain name to be used for updating or checking `/etc/hosts` entries. sap_ip: "{{ ansible_default_ipv4.address }}" +# The IPV4 address to be used for updating or checking `/etc/hosts` entries. + +# sap_general_preconfigure_db_group_name: (not defined by default) +# Use this variable to specify the name of the RHEL group which is used for the database processes. +# If defined, it will be used to configure process limits as per step +# Configuring Process Resource Limits -# use the following variable to specify the name of the RHEL group which is used for the database processes -# (if it exists, it will be used to configure process limits as per step -# "Configuring Process Resource Limits" of SAP note 2002167/2772999): -# sap_general_preconfigure_db_group_name: dba +# END: Default Variables for sap_general_preconfigure diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index 62c169f3e..035705447 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -21,7 +21,6 @@ argument_specs: # ... sap_general_preconfigure_config_all: - default: true description: - If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes. - Default is to perform installation and configuration steps. @@ -29,7 +28,6 @@ argument_specs: type: bool sap_general_preconfigure_installation: - default: false description: - If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the - installation steps of SAP notes. @@ -37,7 +35,6 @@ argument_specs: type: bool sap_general_preconfigure_configuration: - default: false description: - If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the - configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. @@ -123,9 +120,8 @@ argument_specs: type: bool sap_general_preconfigure_req_repos: - default: undefined description: - - If you want to provide your own list of repos (e.g. on cloud systems), set the following variable accordingly. + - If you want to provide your own list of repos (e.g. on cloud systems), set this variable accordingly. - Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically - (e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4). example: @@ -288,3 +284,13 @@ argument_specs: - The IPV4 address to be used for updating or checking `/etc/hosts` entries. required: false type: str + + sap_general_preconfigure_db_group_name: + description: + - Use this variable to specify the name of the RHEL group which is used for the database processes. + - If defined, it will be used to configure process limits as per step + - "Configuring Process Resource Limits" + example: + sap_general_preconfigure_db_group_name: 'dba' + required: false + type: str From 7837de1fffa321d60ee3f2bb86893a91c3540392 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 17 Apr 2023 11:07:39 +0200 Subject: [PATCH 003/128] sap_general_preconfigure: Further tweaks to defaults/main.yml and README.md --- roles/sap_general_preconfigure/README.md | 81 ++++++++++--------- .../defaults/main.yml | 17 ++-- .../meta/argument_specs.yml | 11 ++- 3 files changed, 61 insertions(+), 48 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index a4b07d3ab..e65d9f582 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -28,26 +28,22 @@ This role does not require any parameter to be set in the playbook or inventory. ### sap_general_preconfigure_config_all -- _Type:_ `bool` -- _Default:_ `true` +- _Type:_ `bool` If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes.
Default is to perform installation and configuration steps.
### sap_general_preconfigure_installation -- _Type:_ `bool` -- _Default:_ `false` +- _Type:_ `bool` If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
installation steps of SAP notes.
### sap_general_preconfigure_configuration -- _Type:_ `bool` -- _Default:_ `false` +- _Type:_ `bool` If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`.
-See also the comments at the top of file `defaults/main.yml`.
Example: @@ -59,13 +55,13 @@ sap_general_preconfigure_1391070: true ``` ### sap_general_preconfigure_assert -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` If set to `true`, the role will run in assertion mode instead of the default configuration mode.
### sap_general_preconfigure_assert_ignore_errors -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` In assertion mode, the role will abort when encountering any assertion error.
@@ -73,7 +69,7 @@ If this parameter is set to `false`, the role will *not* abort when encountering This is useful if the role is used for reporting a system's SAP notes compliance.
### sap_general_preconfigure_system_roles_collection -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `'fedora.linux_system_roles'` - _Possible Values:_
- `fedora.linux_system_roles` @@ -84,43 +80,43 @@ For community/upstream, use 'fedora.linux_system_roles'
For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles'
### sap_general_preconfigure_enable_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `true` if you want the role to enable the repos as configured by the following repo related parameters.
The default is `false`, meaning that the role will not enable repos.
### sap_general_preconfigure_use_netweaver_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the SAP NetWeaver repo(s).
The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s).
-{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+Only valid if `sap_general_preconfigure_enable_repos` is set to `true`.
### sap_general_preconfigure_use_hana_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the SAP HANA repo(s).
The default is `true`, meaning that the role will enable the SAP HANA repo(s).
-{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+Only valid if `sap_general_preconfigure_enable_repos` is set to `true`.
### sap_general_preconfigure_use_ha_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not enable the high availability repo(s).
The default is `true`, meaning that the role will enable the high availability repo(s).
-{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+Only valid if `sap_general_preconfigure_enable_repos` is set to `true`.
### sap_general_preconfigure_disable_all_other_repos -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above.
The default is `true`, meaning that the role will disable all repos before enabling the desired ones.
-{'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None}
+Only valid if `sap_general_preconfigure_enable_repos` is set to `true`.
### sap_general_preconfigure_req_repos - _Type:_ `list` with elements of type `str` @@ -141,14 +137,14 @@ sap_general_preconfigure_req_repos: ``` ### sap_general_preconfigure_set_minor_release -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`.
-{'Note': 'If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos.'}
+If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos.
### sap_general_preconfigure_packagegroups -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ __sap_general_preconfigure_packagegroups }}"` The name of the software package group to install.
@@ -160,7 +156,7 @@ Example: ``` ### sap_general_preconfigure_envgroups -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ __sap_general_preconfigure_envgroups }}"` The name of the software environment group to check.
@@ -178,14 +174,14 @@ Example: The list of packages to install.
### sap_general_preconfigure_min_package_check -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` The default is to install or check if the minimum package versions are installed as defined in the vars files.
Set to `false` if you do not install or check these minimum package versions.
### sap_general_preconfigure_update -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` By default, the role will not update the system, for avoiding an unintentional minor OS release update.
@@ -194,13 +190,13 @@ When using SAP HANA, make sure to set the release lock properly so the minor OS those for which SAP HANA is supported. See also `sap_general_preconfigure_set_minor_release`.
### sap_general_preconfigure_reboot_ok -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `false` Set to `true` if you want to perform a reboot at the end of the role, if necessary.
### sap_general_preconfigure_fail_if_reboot_required -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` If `sap_general_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not
@@ -208,7 +204,7 @@ remain unnoticed. For this reason, we let the role fail. Set this parameter to ` Can be useful if you want to implement your own reboot handling.
### sap_general_preconfigure_selinux_state -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `'permissive'` - _Possible Values:_
- `enforcing` @@ -218,25 +214,25 @@ Can be useful if you want to implement your own reboot handling.
One of the SELinux states to be set on the system.
### sap_general_preconfigure_modify_selinux_labels -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `false` if you do not want to modify the SELinux labels for the SAP directory `/usr/sap`.
### sap_general_preconfigure_size_of_tmpfs_gb -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ ((0.75 * (ansible_memtotal_mb + ansible_swaptotal_mb)) / 1024) | round | int }}"` The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735.
### sap_general_preconfigure_modify_etc_hosts -- _Type:_ `bool` +- _Type:_ `bool` - _Default:_ `true` Set to `no` if you do not want the role to modify the `/etc/hosts` file.
### sap_general_preconfigure_etc_sysctl_sap_conf -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `'/etc/sysctl.d/sap.conf'` The file name of the sysctl config file to be used
@@ -258,29 +254,42 @@ sap_general_preconfigure_kernel_parameters: ``` ### sap_general_preconfigure_max_hostname_length -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `'13'` The maximum length of the hostname. See SAP note 611361.
### sap_hostname -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ ansible_hostname }}"` The hostname to be used for updating or checking `/etc/hosts` entries.
### sap_domain -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ ansible_domain }}"` The DNS domain name to be used for updating or checking `/etc/hosts` entries.
### sap_ip -- _Type:_ `str` +- _Type:_ `str` - _Default:_ `"{{ ansible_default_ipv4.address }}"` The IPV4 address to be used for updating or checking `/etc/hosts` entries.
+### sap_general_preconfigure_db_group_name +- _Type:_ `str` + +Use this variable to specify the name of the RHEL group which is used for the database processes.
+If defined, it will be used to configure process limits as per step
+Configuring Process Resource Limits
+ +Example: + +```yaml +sap_general_preconfigure_db_group_name: dba +``` + ## Dependencies diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 1719acb91..25b67d31d 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -12,7 +12,7 @@ # sap_general_preconfigure_configuration: (not defined by default) # If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the # configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. -# See also the comments at the top of file `defaults/main.yml`. +# Example: See README.md sap_general_preconfigure_assert: false # If set to `true`, the role will run in assertion mode instead of the default configuration mode. @@ -37,37 +37,40 @@ sap_general_preconfigure_enable_repos: false sap_general_preconfigure_use_netweaver_repos: true # Set to `false` if you want the role to not enable the SAP NetWeaver repo(s). # The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s). -# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} +# Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. sap_general_preconfigure_use_hana_repos: true # Set to `false` if you want the role to not enable the SAP HANA repo(s). # The default is `true`, meaning that the role will enable the SAP HANA repo(s). -# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} +# Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. sap_general_preconfigure_use_ha_repos: true # Set to `false` if you want the role to not enable the high availability repo(s). # The default is `true`, meaning that the role will enable the high availability repo(s). -# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} +# Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. sap_general_preconfigure_disable_all_other_repos: true # Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above. # The default is `true`, meaning that the role will disable all repos before enabling the desired ones. -# {'Only valid if `sap_general_preconfigure_enable_repos` is set to `true`': None} +# Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. # sap_general_preconfigure_req_repos: (not defined by default) # If you want to provide your own list of repos (e.g. on cloud systems), set this variable accordingly. # Otherwise, the RHEL default repo names with the maximum support duration for the RHEL minor release are chosen automatically # (e.g. normal repos for RHEL 8.3, e4s repos for RHEL 8.4). +# Example: See README.md sap_general_preconfigure_set_minor_release: false # Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. -# {'Note': 'If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos.'} +# If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos. sap_general_preconfigure_packagegroups: "{{ __sap_general_preconfigure_packagegroups }}" # The name of the software package group to install. +# Example: See README.md sap_general_preconfigure_envgroups: "{{ __sap_general_preconfigure_envgroups }}" # The name of the software environment group to check. +# Example: See README.md sap_general_preconfigure_packages: "{{ __sap_general_preconfigure_packages }}" # The list of packages to install. @@ -111,6 +114,7 @@ sap_general_preconfigure_etc_sysctl_sap_conf: '/etc/sysctl.d/sap.conf' sap_general_preconfigure_kernel_parameters: "{{ __sap_general_preconfigure_kernel_parameters_default }}" # The Linux kernel parameters to use. By default, these are taken from the vars file. +# Example: See README.md sap_general_preconfigure_max_hostname_length: '13' # The maximum length of the hostname. See SAP note 611361. @@ -128,5 +132,6 @@ sap_ip: "{{ ansible_default_ipv4.address }}" # Use this variable to specify the name of the RHEL group which is used for the database processes. # If defined, it will be used to configure process limits as per step # Configuring Process Resource Limits +# Example: See README.md # END: Default Variables for sap_general_preconfigure diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index 035705447..83fa80a04 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -38,7 +38,6 @@ argument_specs: description: - If `sap_general_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the - configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. - - See also the comments at the top of file `defaults/main.yml`. example: sap_general_preconfigure_config_all: false sap_general_preconfigure_configuration: true @@ -88,7 +87,7 @@ argument_specs: description: - Set to `false` if you want the role to not enable the SAP NetWeaver repo(s). - The default is `true`, meaning that the role will enable the SAP NetWeaver repo(s). - - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. required: false type: bool @@ -97,7 +96,7 @@ argument_specs: description: - Set to `false` if you want the role to not enable the SAP HANA repo(s). - The default is `true`, meaning that the role will enable the SAP HANA repo(s). - - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. required: false type: bool @@ -106,7 +105,7 @@ argument_specs: description: - Set to `false` if you want the role to not enable the high availability repo(s). - The default is `true`, meaning that the role will enable the high availability repo(s). - - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. required: false type: bool @@ -115,7 +114,7 @@ argument_specs: description: - Set to `false` if you want the role to not disable all repos before enabling the desired ones as configured above. - The default is `true`, meaning that the role will disable all repos before enabling the desired ones. - - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`: + - Only valid if `sap_general_preconfigure_enable_repos` is set to `true`. required: false type: bool @@ -139,7 +138,7 @@ argument_specs: default: false description: - Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. - - Note: If you set the RHEL minor release, then it is strongly recommended to also use the `eus` or `e4s` repos. + - If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos. required: false type: bool From e8238f6dddcab0386f7b8f3fe8600216e9d20e52 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 28 Apr 2023 15:06:41 +0000 Subject: [PATCH 004/128] sap_storage_setup: first generic tasks for device discovery and filesystem creation --- roles/sap_storage_setup/defaults/main.yml | 6 +- .../sap_storage_setup/tasks/generic_main.yml | 147 +++++++++++++++++- .../generic_tasks/configure_filesystems.yml | 146 +++++++++++++++++ roles/sap_storage_setup/tasks/main.yml | 133 +++++++++++++++- 4 files changed, 418 insertions(+), 14 deletions(-) create mode 100644 roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index a31120e6b..2d11f2faf 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -8,7 +8,7 @@ sap_storage_cloud_type: 'generic' sap_storage_sap_type: 'sap_onehost' # sap_onehost | sap_hana | sap_nw -sap_storage_action: 'prepare' +#sap_storage_action: # prepare | remove @@ -24,8 +24,8 @@ sap_storage_az_lun: '/dev/disk/azure/scsi1/lun' # AWS variables -sap_storage_aws_imds_url: -sap_storage_aws_vmsize_url: +sap_storage_aws_imds_url: +sap_storage_aws_vmsize_url: sap_storage_aws_vmsize: diff --git a/roles/sap_storage_setup/tasks/generic_main.yml b/roles/sap_storage_setup/tasks/generic_main.yml index d1301adc7..fdbe56fe5 100644 --- a/roles/sap_storage_setup/tasks/generic_main.yml +++ b/roles/sap_storage_setup/tasks/generic_main.yml @@ -1,9 +1,144 @@ --- +- name: LVM - Create volume groups + community.general.lvg: + vg: "{{ vg_item.vg_name }}" + state: present + pvs: "{{ vg_item.device }}" + pesize: "{{ vg_item.pesize }}" + vg_options: "{{ vg_item.vg_opts }}" + pv_options: "{{ vg_item.pv_opts }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: vg_item + label: "{{ vg_item.volume_group }}" +# when: +# - vg_item.device | length > 0 +# - not vg_item.use_nfs -################ -# Generic Specific Pre-Tasks -################ +- name: LVM - Create volumes + community.general.lvol: + lv: "{{ lv_item.volume_name }}" + vg: "{{ lv_item.volume_group }}" + shrink: false + size: 100%VG + state: present + opts: "{{ lv_item.lv_opts }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: lv_item + label: "{{ lv_item.volume_name }}" +# when: +# - lv_item.device | length > 0 +# - not lv_item.use_nfs -- name: SAP Storage Preparation - Generic Pretasks - debug: - msg: "No pre task" +- name: Create filesystems + community.general.filesystem: + fstype: "{{ fs_item.filesystem_type }}" + dev: "/dev/{{ fs_item.volume_group }}/{{ fs_item.volume_name }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: fs_item + label: "{{ fs_item.volume_name }}" +# when: +# - not fs_item.use_nfs +# - not fs_item.use_swapfile + + +#- name: Block handling the swap file +# block: +# +# - name: Swap File - Check if {{ swap_file }} exists +# ansible.builtin.stat: +# path: "{{ swap_file }}" +# register: check_swapfile +# +# - name: Swap File - Allocate space for {{ swap_file }} +# ansible.builtin.shell: | +# fallocate -l {{ swap_size|int * 1024 }}MB {{ swap_file }} +# when: +# - not check_swapfile.stat.exists +# +# - name: Swap File - Adjust permissions of {{ swap_file }} +# ansible.builtin.file: +# path: "{{ swap_file }}" +# mode: 0600 +# +# - name: Swap File - (Re-)create and activate swap as {{ swap_file }} +# ansible.builtin.shell: | +# mkswap {{ swap_file }} +# swapon {{ swap_file }} +# when: +# - not check_swapfile.stat.exists +# +# - name: Swap File - Add fstab entry for {{ swap_file }} +# ansible.posix.mount: +# path: swap +# src: "{{ swap_file }}" +# fstype: swap +# opts: defaults +# state: present +# +# # Block parameters +# vars: +# swap_file: /swapfile +# swap_size: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile_size }}" +# when: +# - aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile | default(false) +# +# +#- name: Block handling a swap partition filesystem +# block: +# +# - name: Swap Partition - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) +# ansible.builtin.shell: | +# swapon --show --noheadings | grep /dev/ +# ignore_errors: true +# register: check_swap_partition +# +# - name: Swap Partition - Create on LVM Logical Volume (static set to expected path /dev/vg_swap/lv_swap) +# ansible.builtin.shell: | +# swapoff /dev/vg_swap/lv_swap +# mkswap /dev/vg_swap/lv_swap +# swapon /dev/vg_swap/lv_swap +# when: +# - check_swap_partition.rc != 0 +# +# - name: Swap Partition - Add fstab entry (static set to expected path /dev/vg_swap/lv_swap) +# ansible.posix.mount: +# path: swap +# src: /dev/vg_swap/lv_swap +# fstype: swap +# opts: defaults +# state: present +# when: +# - check_swap_partition.rc != 0 +# +# # Block parameters +# vars: +# node_definition: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node] }}" +# +# # Block conditionals: only execute tasks when swap is a volume, not a file +# when: +# - node_definition.filesystem_swap is defined +# - (node_definition.filesystem_swap.use_swapfile is not defined or +# not node_definition.filesystem_swap.use_swapfile) +# - hostvars[host_node].ansible_swaptotal_mb < (node_definition.filesystem_swap.disk_size * 1024) +# # - '"swap" in node_definition.filesystem_swap.volume_name' +# +#### End of block: swap filesystem +# +# +- name: Create mountpoints, add fstab entries and mount + ansible.posix.mount: + path: "{{ mnt_item.mountpoint }}" + src: "/dev/{{ mnt_item.volume_group }}/{{ mnt_item.volume_name }}" + fstype: "{{ mnt_item.filesystem_type }}" + state: mounted # performs fstab entry and mount + loop: "{{ volume_map }}" + loop_control: + loop_var: mnt_item + label: "{{ mnt_item.volume_name }}" +# when: +# - not mnt_item.use_nfs +# - not mnt_item.use_swapfile +# - not mnt_item.mountpoint == "swap" diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml new file mode 100644 index 000000000..7b34481ea --- /dev/null +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml @@ -0,0 +1,146 @@ +--- +- name: LVM - Create volume groups + community.general.lvg: + vg: "{{ vg_item.volume_group }}" + state: present + pvs: "{{ vg_item.device }}" + pesize: "{{ vg_item.pesize }}" + vg_options: "{{ vg_item.vg_opts }}" + pv_options: "{{ vg_item.pv_opts }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: vg_item + label: "{{ vg_item.volume_group }}" +# when: +# - vg_item.device | length > 0 +# - not vg_item.use_nfs + +- name: LVM - Create volumes + community.general.lvol: + lv: "{{ lv_item.volume_name }}" + vg: "{{ lv_item.volume_group }}" + shrink: false + size: 100%VG + state: present + opts: "{{ lv_item.lv_opts }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: lv_item + label: "{{ lv_item.volume_name }}" + when: + - not ansible_check_mode +# - lv_item.device | length > 0 +# - not lv_item.use_nfs + +- name: Create filesystems + community.general.filesystem: + fstype: "{{ fs_item.filesystem_type }}" + dev: "/dev/{{ fs_item.volume_group }}/{{ fs_item.volume_name }}" + loop: "{{ volume_map }}" + loop_control: + loop_var: fs_item + label: "{{ fs_item.volume_name }}" + when: + - not ansible_check_mode +# - not fs_item.use_nfs +# - not fs_item.use_swapfile + + +#- name: Block handling the swap file +# block: +# +# - name: Swap File - Check if {{ swap_file }} exists +# ansible.builtin.stat: +# path: "{{ swap_file }}" +# register: check_swapfile +# +# - name: Swap File - Allocate space for {{ swap_file }} +# ansible.builtin.shell: | +# fallocate -l {{ swap_size|int * 1024 }}MB {{ swap_file }} +# when: +# - not check_swapfile.stat.exists +# +# - name: Swap File - Adjust permissions of {{ swap_file }} +# ansible.builtin.file: +# path: "{{ swap_file }}" +# mode: 0600 +# +# - name: Swap File - (Re-)create and activate swap as {{ swap_file }} +# ansible.builtin.shell: | +# mkswap {{ swap_file }} +# swapon {{ swap_file }} +# when: +# - not check_swapfile.stat.exists +# +# - name: Swap File - Add fstab entry for {{ swap_file }} +# ansible.posix.mount: +# path: swap +# src: "{{ swap_file }}" +# fstype: swap +# opts: defaults +# state: present +# +# # Block parameters +# vars: +# swap_file: /swapfile +# swap_size: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile_size }}" +# when: +# - aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile | default(false) +# +# +#- name: Block handling a swap partition filesystem +# block: +# +# - name: Swap Partition - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) +# ansible.builtin.shell: | +# swapon --show --noheadings | grep /dev/ +# ignore_errors: true +# register: check_swap_partition +# +# - name: Swap Partition - Create on LVM Logical Volume (static set to expected path /dev/vg_swap/lv_swap) +# ansible.builtin.shell: | +# swapoff /dev/vg_swap/lv_swap +# mkswap /dev/vg_swap/lv_swap +# swapon /dev/vg_swap/lv_swap +# when: +# - check_swap_partition.rc != 0 +# +# - name: Swap Partition - Add fstab entry (static set to expected path /dev/vg_swap/lv_swap) +# ansible.posix.mount: +# path: swap +# src: /dev/vg_swap/lv_swap +# fstype: swap +# opts: defaults +# state: present +# when: +# - check_swap_partition.rc != 0 +# +# # Block parameters +# vars: +# node_definition: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node] }}" +# +# # Block conditionals: only execute tasks when swap is a volume, not a file +# when: +# - node_definition.filesystem_swap is defined +# - (node_definition.filesystem_swap.use_swapfile is not defined or +# not node_definition.filesystem_swap.use_swapfile) +# - hostvars[host_node].ansible_swaptotal_mb < (node_definition.filesystem_swap.disk_size * 1024) +# # - '"swap" in node_definition.filesystem_swap.volume_name' +# +#### End of block: swap filesystem +# +# +- name: Create mountpoints, add fstab entries and mount + ansible.posix.mount: + path: "{{ mnt_item.mountpoint }}" + src: "/dev/{{ mnt_item.volume_group }}/{{ mnt_item.volume_name }}" + fstype: "{{ mnt_item.filesystem_type }}" + state: mounted # performs fstab entry and mount + loop: "{{ volume_map }}" + loop_control: + loop_var: mnt_item + label: "{{ mnt_item.volume_name }}" +# when: +# - not mnt_item.use_nfs +# - not mnt_item.use_swapfile +# - not mnt_item.mountpoint == "swap" diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 5337f8bcf..6d1c87d2d 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -4,13 +4,136 @@ # Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml ################ -- name: SAP Storage Preparation - {{ sap_storage_cloud_type }} - include_tasks: "{{ sap_storage_cloud_type }}_main.yml" +#- name: SAP Storage Setup - Preparation for '{{ sap_storage_cloud_type }}' +# include_tasks: "{{ sap_storage_cloud_type }}_main.yml" + + + +########## +# Creating a list of unused devices that match the requested filesystem sizes, using +# - custom definition: sap_storage_definition +# - ansible facts: ansible_devices +# +######### +- name: Make a list of unused disk devices of the requested sizes + ansible.builtin.set_fact: + available_devices: | + {% set av_disks = [] %} + {% set all_disks = (ansible_devices | dict2items) %} + {% for disk in all_disks %} + {%- for fs in sap_storage_definition %} + {%- if disk.value.links.uuids | length == 0 + and disk.value.partitions | length == 0 + and (fs.disk_size | upper) in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} + {%- set add_to_list = av_disks.append(disk) %} + {%- endif %} + {%- endfor %} + {%- endfor %} + {{ av_disks | items2dict }} + +# !! +# If the DISK MATCHING syntax has changed in the above, it must also +# be adjusted in the next task +# !! + +# This task assigns device names for each volume to be created. +# - custom definition: sap_storage_definition +# - ansible facts: ansible-devices + +- name: Set fact for target filesystem device mapping + ansible.builtin.set_fact: + filesystem_device_map: | + {% set device_map = [] %} + {% set av_dev = (available_devices | dict2items) %} + {% set assigned_dev = [] %} + {% for fs in sap_storage_definition %} + {% set matching_dev = [] %} + + {%- if (fs.disk_size is defined + and ('nfs' not in fs.filesystem_type | default('xfs')) + and ('swapfile' not in fs.filesystem_type | default('xfs'))) -%} + + {%- for dev in av_dev -%} + {%- if (fs.disk_size | upper) in (dev.value.size | regex_replace('(\.\d+\s*)', '')) + and dev.key not in assigned_dev + and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} + + {%- set assigned = assigned_dev.append(dev.key) %} + {%- set add = matching_dev.append('/dev/' + dev.key) %} + + {%- endif %} + {%- endfor %} + + {%- endif %} + + {%- set extend = device_map.extend([ + { + 'device': matching_dev | join(','), + 'fstype': fs.filesystem_type | default('xfs'), + 'mountpoint': fs.mountpoint, + 'name': fs.name, + 'size': fs.disk_size, + } + ]) %} + {%- endfor %} + {{ device_map }} + + +- debug: + var: filesystem_device_map +#- fail: + + +# This task combines information to create a mapping list of devices to filesystems. +# Sources: +# - Extravars definition: sap_storage_definition +# - Ansible host facts: hostvars[host_node].ansible_devices +- name: MAPPING - Set fact for device to filesystem mapping + ansible.builtin.set_fact: + volume_map: "{{ volume_map + volume_element }}" + vars: + volume_map: [] + volume_element: + - filesystem_type: |- + {% if map_item.name == 'swap' -%} + swap + {%- else -%} + {{ map_item.filesystem_type | default('xfs') }} + {%- endif %} + mountpoint: "{{ map_item.mountpoint }}" + volume_group: "vg_{{ map_item.name }}" + volume_name: "lv_{{ map_item.name }}" + device: |- + {% for entry in filesystem_device_map %} + {%- if map_item.name == entry.name -%} + {{ entry.device }} + {%- endif %} + {%- endfor %} + pesize: "{{ map_item.lvm_vg_physical_extent_size | default('4') }}" + pv_opts: "{{ map_item.lvm_pv_options | default('') }}" + vg_opts: "{{ map_item.lvm_vg_options | default('') }}" + lv_opts: |- + {% set lvopts = [] %} + {% if map_item.lvm_lv_stripes is defined and + map_item.lvm_lv_stripes | int > 0 -%} + {% set addopt = lvopts.append('--stripes ' + map_item.lvm_lv_stripes | string) %} + {%- endif %} + {% if map_item.lvm_lv_stripe_size is defined and + map_item.lvm_lv_stripe_size | length > 0 -%} + {% set addopt = lvopts.append('--stripesize ' + map_item.lvm_lv_stripe_size) %} + {%- endif %} + {{ lvopts | join(' ') }} + loop: "{{ sap_storage_definition }}" + loop_control: + label: "{{ map_item.name }}" + loop_var: map_item + +#- debug: +# var: volume_map ################ # Main Run - call cloud specific tasks thru {{ sap_storage_cloud_type }}_tasks/prep_storage.yml ################ -- name: SAP Storage Preparation - {{ sap_storage_action | capitalize }} Volume Groups and Logical Volumes - include_tasks: "{{ sap_storage_cloud_type }}_tasks/{{ sap_storage_action }}_storage.yml" - loop: "{{ lookup('dict', sap_storage_dict) }}" +- name: SAP Storage Setup - Configure Volume Groups and Logical Volumes + include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_filesystems.yml" From 05754dafd4fbcf582307d7cae3b61e3bbc6275ef Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 28 Apr 2023 15:33:00 +0000 Subject: [PATCH 005/128] sap_storage_setup: clear content that was moved to generic_tasks/configure_filesystems.yml --- .../sap_storage_setup/tasks/generic_main.yml | 144 +----------------- 1 file changed, 1 insertion(+), 143 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_main.yml b/roles/sap_storage_setup/tasks/generic_main.yml index fdbe56fe5..6f805d254 100644 --- a/roles/sap_storage_setup/tasks/generic_main.yml +++ b/roles/sap_storage_setup/tasks/generic_main.yml @@ -1,144 +1,2 @@ --- -- name: LVM - Create volume groups - community.general.lvg: - vg: "{{ vg_item.vg_name }}" - state: present - pvs: "{{ vg_item.device }}" - pesize: "{{ vg_item.pesize }}" - vg_options: "{{ vg_item.vg_opts }}" - pv_options: "{{ vg_item.pv_opts }}" - loop: "{{ volume_map }}" - loop_control: - loop_var: vg_item - label: "{{ vg_item.volume_group }}" -# when: -# - vg_item.device | length > 0 -# - not vg_item.use_nfs - -- name: LVM - Create volumes - community.general.lvol: - lv: "{{ lv_item.volume_name }}" - vg: "{{ lv_item.volume_group }}" - shrink: false - size: 100%VG - state: present - opts: "{{ lv_item.lv_opts }}" - loop: "{{ volume_map }}" - loop_control: - loop_var: lv_item - label: "{{ lv_item.volume_name }}" -# when: -# - lv_item.device | length > 0 -# - not lv_item.use_nfs - -- name: Create filesystems - community.general.filesystem: - fstype: "{{ fs_item.filesystem_type }}" - dev: "/dev/{{ fs_item.volume_group }}/{{ fs_item.volume_name }}" - loop: "{{ volume_map }}" - loop_control: - loop_var: fs_item - label: "{{ fs_item.volume_name }}" -# when: -# - not fs_item.use_nfs -# - not fs_item.use_swapfile - - -#- name: Block handling the swap file -# block: -# -# - name: Swap File - Check if {{ swap_file }} exists -# ansible.builtin.stat: -# path: "{{ swap_file }}" -# register: check_swapfile -# -# - name: Swap File - Allocate space for {{ swap_file }} -# ansible.builtin.shell: | -# fallocate -l {{ swap_size|int * 1024 }}MB {{ swap_file }} -# when: -# - not check_swapfile.stat.exists -# -# - name: Swap File - Adjust permissions of {{ swap_file }} -# ansible.builtin.file: -# path: "{{ swap_file }}" -# mode: 0600 -# -# - name: Swap File - (Re-)create and activate swap as {{ swap_file }} -# ansible.builtin.shell: | -# mkswap {{ swap_file }} -# swapon {{ swap_file }} -# when: -# - not check_swapfile.stat.exists -# -# - name: Swap File - Add fstab entry for {{ swap_file }} -# ansible.posix.mount: -# path: swap -# src: "{{ swap_file }}" -# fstype: swap -# opts: defaults -# state: present -# -# # Block parameters -# vars: -# swap_file: /swapfile -# swap_size: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile_size }}" -# when: -# - aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile | default(false) -# -# -#- name: Block handling a swap partition filesystem -# block: -# -# - name: Swap Partition - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) -# ansible.builtin.shell: | -# swapon --show --noheadings | grep /dev/ -# ignore_errors: true -# register: check_swap_partition -# -# - name: Swap Partition - Create on LVM Logical Volume (static set to expected path /dev/vg_swap/lv_swap) -# ansible.builtin.shell: | -# swapoff /dev/vg_swap/lv_swap -# mkswap /dev/vg_swap/lv_swap -# swapon /dev/vg_swap/lv_swap -# when: -# - check_swap_partition.rc != 0 -# -# - name: Swap Partition - Add fstab entry (static set to expected path /dev/vg_swap/lv_swap) -# ansible.posix.mount: -# path: swap -# src: /dev/vg_swap/lv_swap -# fstype: swap -# opts: defaults -# state: present -# when: -# - check_swap_partition.rc != 0 -# -# # Block parameters -# vars: -# node_definition: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node] }}" -# -# # Block conditionals: only execute tasks when swap is a volume, not a file -# when: -# - node_definition.filesystem_swap is defined -# - (node_definition.filesystem_swap.use_swapfile is not defined or -# not node_definition.filesystem_swap.use_swapfile) -# - hostvars[host_node].ansible_swaptotal_mb < (node_definition.filesystem_swap.disk_size * 1024) -# # - '"swap" in node_definition.filesystem_swap.volume_name' -# -#### End of block: swap filesystem -# -# -- name: Create mountpoints, add fstab entries and mount - ansible.posix.mount: - path: "{{ mnt_item.mountpoint }}" - src: "/dev/{{ mnt_item.volume_group }}/{{ mnt_item.volume_name }}" - fstype: "{{ mnt_item.filesystem_type }}" - state: mounted # performs fstab entry and mount - loop: "{{ volume_map }}" - loop_control: - loop_var: mnt_item - label: "{{ mnt_item.volume_name }}" -# when: -# - not mnt_item.use_nfs -# - not mnt_item.use_swapfile -# - not mnt_item.mountpoint == "swap" +# placeholder, if needed? From 0dc2090bf24f61e63611b62c0b2e02d17f2db733 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 28 Apr 2023 15:54:28 +0000 Subject: [PATCH 006/128] sap_storage_setup: first definition specification --- .../sap_storage_setup/meta/argument_specs.yml | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 roles/sap_storage_setup/meta/argument_specs.yml diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml new file mode 100644 index 000000000..1330b3ab6 --- /dev/null +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -0,0 +1,94 @@ +--- +# Requires: ansible 2.11 +# Argument specifications in this separate file maintain backwards compatibility. +argument_specs: + + main: + short_description: SAP system storage setup + options: + +# Take this template and copy it to the desired place. +# Add content and remove placeholders that are not needed. +# Ideally sort by key (variable name) alphabetically. +# +# sap_storage_setup_ +# default: +# description: +# - +# example: +# +# required: false +# type: +# options: # additional options for lists and dicts +# : +# description: +# ... + + sap_storage_definition: + description: + - Describes the filesystems to be configured. + + example: + sap_storage_definition: + - name: hanadata + mountpoint: /hana/data + disk_size: 100G + filesystem_type: xfs + + - name: hanalog + mountpoint: /hana/log + disk_size: 100G + filesystem_type: xfs + + elements: dict + required: true + type: list + options: + name: + description: + - A name of the filesystem definition entry. + - This name is used to generate volume group name and logical volume name. + required: true + type: str + + mountpoint: + description: + - The path to where the filesystem will be mounted. + required: true + type: str + + disk_size: + description: + - Size of the disk device that is used for the filesystem. + - For filesystems with no LVM logical volume striping, this is the end size of the filesystem. + - For filesystems with LVM lv striping defined, this the size of each disk. Filesystem size will result in disk_size multiplied by amount of stripes (=disks). + required: true + type: str + + filesystem_type: + default: xfs + description: + - The type of filesystem that will be created on the logical volume. + required: false + type: str + + lvm_lv_stripes: + default: 1 + description: + - Number of disks that will be configured in a striped volume. + required: false + type: int + + lvm_lv_stripe_size: + description: + - When setting up a striped volume, the stripe size can be defined. + - Example format - "128K". + required: false + type: str + + lvm_vg_physical_extent_size: + default: 4 + description: + - Adjustable size of the physical extents of the volume group in LVM. + required: false + type: str From 32924b3d9d74074708eaedea7e02dbe38272a75c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 2 May 2023 17:14:35 +0000 Subject: [PATCH 007/128] sap_ha_pacemaker_cluster: fix issue #362 --- .../templates/sudofile_20-saphana.j2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/templates/sudofile_20-saphana.j2 b/roles/sap_ha_pacemaker_cluster/templates/sudofile_20-saphana.j2 index a4f2fe08d..a8f3709b7 100644 --- a/roles/sap_ha_pacemaker_cluster/templates/sudofile_20-saphana.j2 +++ b/roles/sap_ha_pacemaker_cluster/templates/sudofile_20-saphana.j2 @@ -6,10 +6,10 @@ # to update the SAP HANA cluster resource status. {% for node in sap_ha_pacemaker_cluster_cluster_nodes %} -Cmnd_Alias {{ node.hana_site }}_SOK = /usr/sbin/crm_attribute -n hana_{{ sap_ha_pacemaker_cluster_hana_sid | lower }}_site_srHook_{{ node.hana_site }} -v SOK -t crm_config -s {{ sap_ha_pacemaker_cluster_hadr_provider_name }} -Cmnd_Alias {{ node.hana_site }}_SFAIL = /usr/sbin/crm_attribute -n hana_{{ sap_ha_pacemaker_cluster_hana_sid | lower }}_site_srHook_{{ node.hana_site }} -v SFAIL -t crm_config -s {{ sap_ha_pacemaker_cluster_hadr_provider_name }} +Cmnd_Alias {{ node.hana_site | upper }}_SOK = /usr/sbin/crm_attribute -n hana_{{ sap_ha_pacemaker_cluster_hana_sid | lower }}_site_srHook_{{ node.hana_site }} -v SOK -t crm_config -s {{ sap_ha_pacemaker_cluster_hadr_provider_name }} +Cmnd_Alias {{ node.hana_site | upper }}_SFAIL = /usr/sbin/crm_attribute -n hana_{{ sap_ha_pacemaker_cluster_hana_sid | lower }}_site_srHook_{{ node.hana_site }} -v SFAIL -t crm_config -s {{ sap_ha_pacemaker_cluster_hadr_provider_name }} {% endfor %} -{{ sap_ha_pacemaker_cluster_hana_sid|lower }}adm ALL=(ALL) NOPASSWD: {% for node in sap_ha_pacemaker_cluster_cluster_nodes %}{{ node.hana_site }}_SOK, {{ node.hana_site }}_SFAIL{{ ", " if not loop.last else "" }}{% endfor %} +{{ sap_ha_pacemaker_cluster_hana_sid | lower }}adm ALL=(ALL) NOPASSWD: {% for node in sap_ha_pacemaker_cluster_cluster_nodes %}{{ node.hana_site | upper }}_SOK, {{ node.hana_site | upper }}_SFAIL{{ ", " if not loop.last else "" }}{% endfor %} -Defaults!{% for node in sap_ha_pacemaker_cluster_cluster_nodes %}{{ node.hana_site }}_SOK, {{ node.hana_site }}_SFAIL{{ ", " if not loop.last else "" }}{% endfor %} !requiretty +Defaults!{% for node in sap_ha_pacemaker_cluster_cluster_nodes %}{{ node.hana_site | upper }}_SOK, {{ node.hana_site | upper }}_SFAIL{{ ", " if not loop.last else "" }}{% endfor %} !requiretty From 0b6f74aa8b33d1b0bd3abf88e04f4035383f16e3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 2 May 2023 17:49:50 +0000 Subject: [PATCH 008/128] sap_ha_pacemaker_cluster: fix issue#363 - removed quotes around pcmk_host_map parameter --- roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index 62e4f2144..c65140216 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -48,7 +48,7 @@ {% set map = attrs.extend([ { 'name': 'pcmk_host_map', - 'value': '"' + __sap_ha_pacemaker_cluster_pcmk_host_map + '"' + 'value': __sap_ha_pacemaker_cluster_pcmk_host_map }]) -%} {%- for agent_opt in (sap_ha_pacemaker_cluster_stonith_default.options | dict2items) -%} {% set aopts = attrs.extend([ From 3d4e28c7ec346391992689aca60172d0c5b1b898 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 3 May 2023 14:03:53 +0000 Subject: [PATCH 009/128] sap_ha_pacemaker_cluster: fixed issue #365 - resource meta attributes construction --- .../tasks/construct_vars_hana_common.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index aff797867..e7c55d432 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -101,15 +101,14 @@ vars: __clone_topology: resource_id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}" - promotable: "no" meta_attrs: - attrs: - name: clone-max value: 2 - name: clone-node-max value: 1 - - name: interleave - value: "true" + - name: interleave + value: "true" when: - __clone_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) @@ -119,7 +118,6 @@ vars: __clone_hana: resource_id: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}" - promotable: "yes" meta_attrs: - attrs: - name: clone-max @@ -128,6 +126,8 @@ value: 1 - name: interleave value: "true" + - name: promotable + value: "true" when: - __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) From 563015550ae7a1fcfc948b78375805f203313363 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 3 May 2023 14:35:55 +0000 Subject: [PATCH 010/128] gh action update for sap_ha_pacemaker_cluster --- .github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml index 9e880b21e..bc215a523 100644 --- a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml +++ b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml @@ -24,10 +24,10 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' From 27bde872e76668fabb01928240ddd8533ecf5320 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 3 May 2023 16:16:50 +0000 Subject: [PATCH 011/128] gh action - workaround for compatibility with older ansible-lint on python 3.9 --- .github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml index bc215a523..1c718e9df 100644 --- a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml +++ b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml @@ -32,7 +32,9 @@ jobs: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_ha_pacemaker_cluster From 4b42900f3325c4f2c7f0ea43ec2062a543f84108 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 3 May 2023 18:43:05 +0200 Subject: [PATCH 012/128] gh actions: install fixed ansible-compat version to keep compatibility --- .../workflows/ansible-lint-sap_general_preconfigure.yml | 8 +++++--- .../workflows/ansible-lint-sap_ha_install_hana_hsr.yml | 8 +++++--- .github/workflows/ansible-lint-sap_hana_install.yml | 8 +++++--- .github/workflows/ansible-lint-sap_hana_preconfigure.yml | 8 +++++--- .../ansible-lint-sap_hypervisor_node_preconfigure.yml | 8 +++++--- .../workflows/ansible-lint-sap_netweaver_preconfigure.yml | 8 +++++--- .github/workflows/ansible-lint-sap_swpm.yml | 8 +++++--- .github/workflows/ansible-lint-sap_vm_preconfigure.yml | 8 +++++--- .github/workflows/ansible-lint.yml | 8 +++++--- .github/workflows/ansible-test-sanity.yml | 8 +++++--- 10 files changed, 50 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ansible-lint-sap_general_preconfigure.yml b/.github/workflows/ansible-lint-sap_general_preconfigure.yml index 46dfc0fc3..b41cc3002 100644 --- a/.github/workflows/ansible-lint-sap_general_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_general_preconfigure.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_general_preconfigure diff --git a/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml b/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml index 5b1f5e4a0..ba05ecd25 100644 --- a/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml +++ b/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_ha_install_hana_hsr diff --git a/.github/workflows/ansible-lint-sap_hana_install.yml b/.github/workflows/ansible-lint-sap_hana_install.yml index dab7b855b..9f6cde49b 100644 --- a/.github/workflows/ansible-lint-sap_hana_install.yml +++ b/.github/workflows/ansible-lint-sap_hana_install.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hana_install diff --git a/.github/workflows/ansible-lint-sap_hana_preconfigure.yml b/.github/workflows/ansible-lint-sap_hana_preconfigure.yml index ad3f90d67..a2967b9d0 100644 --- a/.github/workflows/ansible-lint-sap_hana_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_hana_preconfigure.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hana_preconfigure diff --git a/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml b/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml index f96b0f786..26e78abcf 100644 --- a/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hypervisor_node_preconfigure diff --git a/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml b/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml index 4e9f7d9d9..2be0a2e8d 100644 --- a/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_netweaver_preconfigure diff --git a/.github/workflows/ansible-lint-sap_swpm.yml b/.github/workflows/ansible-lint-sap_swpm.yml index 29e94f3c2..067e19488 100644 --- a/.github/workflows/ansible-lint-sap_swpm.yml +++ b/.github/workflows/ansible-lint-sap_swpm.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_swpm diff --git a/.github/workflows/ansible-lint-sap_vm_preconfigure.yml b/.github/workflows/ansible-lint-sap_vm_preconfigure.yml index 9c0740c16..7dc1df564 100644 --- a/.github/workflows/ansible-lint-sap_vm_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_vm_preconfigure.yml @@ -24,15 +24,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_vm_preconfigure diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index eccb59883..536ed65ec 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -16,15 +16,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 # - name: Install collection dependencies # run: ansible-galaxy collection install community.general diff --git a/.github/workflows/ansible-test-sanity.yml b/.github/workflows/ansible-test-sanity.yml index aa47bc80a..b3ce12573 100644 --- a/.github/workflows/ansible-test-sanity.yml +++ b/.github/workflows/ansible-test-sanity.yml @@ -16,15 +16,17 @@ jobs: steps: - name: Check out the code - uses: actions/checkout@v2 + uses: actions/checkout@main - name: Set up Python 3 - uses: actions/setup-python@v2 + uses: actions/setup-python@main with: python-version: '3.9' - name: Install test dependencies - run: pip3 install ansible ansible-lint==6.8.6 + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 # - name: Install collection dependencies # run: ansible-galaxy collection install community.general From ff827f58d39a53b0ca0b77d2d6d9d9f4fdebe5e6 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 3 May 2023 19:11:40 +0200 Subject: [PATCH 013/128] sap_ha_pacemaker_cluster: fix issue #370 - argument_specs options restrictions --- roles/sap_ha_pacemaker_cluster/README.md | 10 -------- .../meta/argument_specs.yml | 23 ------------------- 2 files changed, 33 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 88952e58f..8d433da0c 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -159,16 +159,6 @@ These options are applied to fencing resources this role uses automatically for The listed options are set by default.
Additional options can be added by defining this parameter in dictionary format and adding the defaults plus any valid stonith resource key-value pair.
-- **pcmk_reboot_retries**
- _Default:_ `4`
- STONITH resource parameter to define how often it retries to restart a node. -- **pcmk_reboot_timeout**
- _Default:_ `400`
- STONITH resource parameter to define after which timeout a node restart is returned as failed. -- **power_timeout**
- _Default:_ `240`
- STONITH resource parameter to test X seconds for status change after ON/OFF. - Example: ```yaml diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 665579505..7844b03ef 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -126,29 +126,6 @@ argument_specs: required: false type: dict - options: - - pcmk_reboot_retries: - default: 4 - description: - - STONITH resource parameter to define how often it retries to restart a node. - required: false - type: int - - pcmk_reboot_timeout: - default: 400 - description: - - STONITH resource parameter to define after which timeout a node restart is returned as failed. - required: false - type: int - - power_timeout: - default: 240 - description: - - STONITH resource parameter to test X seconds for status change after ON/OFF. - required: false - type: int - sap_ha_pacemaker_cluster_hana_automated_register: default: true description: From 1513127131450c7a2ce0ced4000cbaee3c4a0b4c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 4 May 2023 11:40:25 +0000 Subject: [PATCH 014/128] sap_storage_setup: added swap configuration --- .../sap_storage_setup/meta/argument_specs.yml | 21 +++- .../generic_tasks/configure_filesystems.yml | 101 ++---------------- .../tasks/generic_tasks/configure_swap.yml | 101 ++++++++++++++++++ roles/sap_storage_setup/tasks/main.yml | 67 +++++++----- 4 files changed, 166 insertions(+), 124 deletions(-) create mode 100644 roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 1330b3ab6..00627eeba 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -54,7 +54,8 @@ argument_specs: mountpoint: description: - The path to where the filesystem will be mounted. - required: true + - This can be left out for the definition of a swap volume. + required: false type: str disk_size: @@ -72,6 +73,14 @@ argument_specs: required: false type: str + lvm_lv_name: + default: lv_ + description: + - The name of the LVM volume. + - The default name is derived from the name value of the filesystem definition entry. + required: false + type: str + lvm_lv_stripes: default: 1 description: @@ -86,9 +95,19 @@ argument_specs: required: false type: str + lvm_vg_name: + default: vg_ + description: + - The name of the LVM volume group. + - The default name is derived from the name value of the filesystem definition entry. + required: false + type: str + lvm_vg_physical_extent_size: default: 4 description: - Adjustable size of the physical extents of the volume group in LVM. required: false type: str + +# TODO: adding all possible options, otherwise they will fail the argument validation when used diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml index 7b34481ea..f9414fc48 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml @@ -1,5 +1,5 @@ --- -- name: LVM - Create volume groups +- name: SAP Storage Setup - Create LVM volume groups community.general.lvg: vg: "{{ vg_item.volume_group }}" state: present @@ -12,10 +12,9 @@ loop_var: vg_item label: "{{ vg_item.volume_group }}" # when: -# - vg_item.device | length > 0 # - not vg_item.use_nfs -- name: LVM - Create volumes +- name: SAP Storage Setup - Create LVM volumes community.general.lvol: lv: "{{ lv_item.volume_name }}" vg: "{{ lv_item.volume_group }}" @@ -29,10 +28,9 @@ label: "{{ lv_item.volume_name }}" when: - not ansible_check_mode -# - lv_item.device | length > 0 # - not lv_item.use_nfs -- name: Create filesystems +- name: SAP Storage Setup - Create filesystems community.general.filesystem: fstype: "{{ fs_item.filesystem_type }}" dev: "/dev/{{ fs_item.volume_group }}/{{ fs_item.volume_name }}" @@ -43,94 +41,8 @@ when: - not ansible_check_mode # - not fs_item.use_nfs -# - not fs_item.use_swapfile - -#- name: Block handling the swap file -# block: -# -# - name: Swap File - Check if {{ swap_file }} exists -# ansible.builtin.stat: -# path: "{{ swap_file }}" -# register: check_swapfile -# -# - name: Swap File - Allocate space for {{ swap_file }} -# ansible.builtin.shell: | -# fallocate -l {{ swap_size|int * 1024 }}MB {{ swap_file }} -# when: -# - not check_swapfile.stat.exists -# -# - name: Swap File - Adjust permissions of {{ swap_file }} -# ansible.builtin.file: -# path: "{{ swap_file }}" -# mode: 0600 -# -# - name: Swap File - (Re-)create and activate swap as {{ swap_file }} -# ansible.builtin.shell: | -# mkswap {{ swap_file }} -# swapon {{ swap_file }} -# when: -# - not check_swapfile.stat.exists -# -# - name: Swap File - Add fstab entry for {{ swap_file }} -# ansible.posix.mount: -# path: swap -# src: "{{ swap_file }}" -# fstype: swap -# opts: defaults -# state: present -# -# # Block parameters -# vars: -# swap_file: /swapfile -# swap_size: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile_size }}" -# when: -# - aws_host_specifications_dictionary[host_specification_plan][host_node].filesystem_swap.use_swapfile | default(false) -# -# -#- name: Block handling a swap partition filesystem -# block: -# -# - name: Swap Partition - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) -# ansible.builtin.shell: | -# swapon --show --noheadings | grep /dev/ -# ignore_errors: true -# register: check_swap_partition -# -# - name: Swap Partition - Create on LVM Logical Volume (static set to expected path /dev/vg_swap/lv_swap) -# ansible.builtin.shell: | -# swapoff /dev/vg_swap/lv_swap -# mkswap /dev/vg_swap/lv_swap -# swapon /dev/vg_swap/lv_swap -# when: -# - check_swap_partition.rc != 0 -# -# - name: Swap Partition - Add fstab entry (static set to expected path /dev/vg_swap/lv_swap) -# ansible.posix.mount: -# path: swap -# src: /dev/vg_swap/lv_swap -# fstype: swap -# opts: defaults -# state: present -# when: -# - check_swap_partition.rc != 0 -# -# # Block parameters -# vars: -# node_definition: "{{ aws_host_specifications_dictionary[host_specification_plan][host_node] }}" -# -# # Block conditionals: only execute tasks when swap is a volume, not a file -# when: -# - node_definition.filesystem_swap is defined -# - (node_definition.filesystem_swap.use_swapfile is not defined or -# not node_definition.filesystem_swap.use_swapfile) -# - hostvars[host_node].ansible_swaptotal_mb < (node_definition.filesystem_swap.disk_size * 1024) -# # - '"swap" in node_definition.filesystem_swap.volume_name' -# -#### End of block: swap filesystem -# -# -- name: Create mountpoints, add fstab entries and mount +- name: SAP Storage Setup - Create mountpoints, add fstab entries and mount ansible.posix.mount: path: "{{ mnt_item.mountpoint }}" src: "/dev/{{ mnt_item.volume_group }}/{{ mnt_item.volume_name }}" @@ -140,7 +52,6 @@ loop_control: loop_var: mnt_item label: "{{ mnt_item.volume_name }}" -# when: + when: # - not mnt_item.use_nfs -# - not mnt_item.use_swapfile -# - not mnt_item.mountpoint == "swap" + - not mnt_item.filesystem_type == "swap" diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml new file mode 100644 index 000000000..ff5b83547 --- /dev/null +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml @@ -0,0 +1,101 @@ +--- +- name: SAP Storage Setup - Block handling the swap file + block: + + - name: SAP Storage Setup - Check if {{ swap_file.mountpoint }} exists + ansible.builtin.stat: + path: "{{ swap_file.mountpoint }}" + register: check_swapfile + + - name: SAP Storage Setup - Allocate space for {{ swap_file.mountpoint }} + ansible.builtin.shell: | + fallocate -l {{ swap_file.disk_size | int * 1024 }}MB {{ swap_file.mountpoint }} + when: + - not check_swapfile.stat.exists + + - name: SAP Storage Setup - Adjust permissions of {{ swap_file.mountpoint }} + ansible.builtin.file: + path: "{{ swap_file.mountpoint }}" + mode: 0600 + + - name: SAP Storage Setup - Create and activate swap as {{ swap_file.mountpoint }} + ansible.builtin.shell: | + mkswap {{ swap_file.mountpoint }} + swapon {{ swap_file.mountpoint }} + when: + - not check_swapfile.stat.exists + + - name: SAP Storage Setup - Add fstab entry for {{ swap_file.mountpoint }} + ansible.posix.mount: + path: swap + src: "{{ swap_file.mountpoint }}" + fstype: swap + opts: defaults + state: present + + # Block parameters + vars: + # Select the swap_file entry from the storage definition + swap_file: | + {{- sap_storage_definition + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") + | selectattr("mountpoint", "defined") + | map('dict2items') + | flatten + | items2dict + -}} + + # Block conditional + when: | + sap_storage_definition + | selectattr("mountpoint", "defined") + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") + +### End of swapfile block + +- name: SAP Storage Setup - Block handling a swap partition filesystem + block: + + - name: SAP Storage Setup - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) + ansible.builtin.shell: | + lsblk | grep SWAP || echo "no active swap" + register: check_swap_partition + + - name: SAP Storage Setup - Add fstab entry for swap + ansible.posix.mount: + path: swap + src: "/dev/{{ swap_volume.lvm_vg_name | default('vg_swap') }}/{{ swap_volume.lvm_lv_name | default('lv_swap') }}" + fstype: swap + opts: defaults + state: present + + - name: SAP Storage Setup - Enable swap + ansible.builtin.shell: | + swapon /dev/{{ swap_volume.lvm_vg_name | default('vg_swap') }}/{{ swap_volume.lvm_lv_name | default('lv_swap') }} + when: + - not ansible_check_mode + - swap_volume.lvm_lv_name | default("lv_swap") not in check_swap_partition.stdout + + # Block parameters + vars: + # Select the swap volume entry from the storage definition. + # Difference to swapfile logic is the absence of a mountpoint definition in that entry. + swap_volume: | + {{- sap_storage_definition + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") + | selectattr("mountpoint", "undefined") + | map('dict2items') + | flatten + | items2dict + -}} + + # Block conditional + when: | + sap_storage_definition + | selectattr("mountpoint", "undefined") + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") +### End of block: swap filesystem diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 6d1c87d2d..b32c0a962 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -8,6 +8,8 @@ # include_tasks: "{{ sap_storage_cloud_type }}_main.yml" +# TODO: verify that the number of disks matches the fs definition +# TODO: add functionality to work with existing LVM volumes and skip disk assignment ########## # Creating a list of unused devices that match the requested filesystem sizes, using @@ -24,7 +26,7 @@ {%- for fs in sap_storage_definition %} {%- if disk.value.links.uuids | length == 0 and disk.value.partitions | length == 0 - and (fs.disk_size | upper) in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} + and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} {%- set add_to_list = av_disks.append(disk) %} {%- endif %} {%- endfor %} @@ -46,15 +48,16 @@ {% set device_map = [] %} {% set av_dev = (available_devices | dict2items) %} {% set assigned_dev = [] %} - {% for fs in sap_storage_definition %} - {% set matching_dev = [] %} + {% for fs in sap_storage_definition -%} + {% set matching_dev = [] -%} - {%- if (fs.disk_size is defined + {%- if fs.disk_size is defined and ('nfs' not in fs.filesystem_type | default('xfs')) - and ('swapfile' not in fs.filesystem_type | default('xfs'))) -%} + and ('swap' not in fs.filesystem_type | default('xfs') + or fs.mountpoint is not defined) -%} {%- for dev in av_dev -%} - {%- if (fs.disk_size | upper) in (dev.value.size | regex_replace('(\.\d+\s*)', '')) + {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) and dev.key not in assigned_dev and matching_dev | length < (fs.lvm_lv_stripes | d('1') | int) %} @@ -64,26 +67,24 @@ {%- endif %} {%- endfor %} - {%- endif %} - {%- set extend = device_map.extend([ - { - 'device': matching_dev | join(','), - 'fstype': fs.filesystem_type | default('xfs'), - 'mountpoint': fs.mountpoint, - 'name': fs.name, - 'size': fs.disk_size, - } + {%- set extend = device_map.extend([ + { + 'device': matching_dev | join(','), + 'fstype': fs.filesystem_type | default('xfs'), + 'mountpoint': fs.mountpoint | default(''), + 'name': fs.name, + 'size': fs.disk_size, + } ]) %} + {%- endif %} {%- endfor %} {{ device_map }} - - debug: var: filesystem_device_map #- fail: - # This task combines information to create a mapping list of devices to filesystems. # Sources: # - Extravars definition: sap_storage_definition @@ -94,15 +95,10 @@ vars: volume_map: [] volume_element: - - filesystem_type: |- - {% if map_item.name == 'swap' -%} - swap - {%- else -%} - {{ map_item.filesystem_type | default('xfs') }} - {%- endif %} - mountpoint: "{{ map_item.mountpoint }}" - volume_group: "vg_{{ map_item.name }}" - volume_name: "lv_{{ map_item.name }}" + - filesystem_type: "{{ map_item.filesystem_type | default('xfs') }}" + mountpoint: "{{ map_item.mountpoint | default('') }}" + volume_group: "{{ map_item.lvm_vg_name | default('vg_' + map_item.name) }}" + volume_name: "{{ map_item.lvm_lv_name | default('lv_' + map_item.name) }}" device: |- {% for entry in filesystem_device_map %} {%- if map_item.name == entry.name -%} @@ -127,9 +123,16 @@ loop_control: label: "{{ map_item.name }}" loop_var: map_item + when: + # - map_item.mountpoint is defined + # - map_item.mountpoint | length > 0 + # - '"swap" not in (map_item.filesystem_type | default("xfs"))' + - '"nfs" not in (map_item.filesystem_type | default("xfs"))' -#- debug: -# var: volume_map +- debug: + var: volume_map + +#- fail: ################ # Main Run - call cloud specific tasks thru {{ sap_storage_cloud_type }}_tasks/prep_storage.yml @@ -137,3 +140,11 @@ - name: SAP Storage Setup - Configure Volume Groups and Logical Volumes include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_filesystems.yml" + + +# NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) +# Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map +- name: SAP Storage Setup - Configure swap + include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_swap.yml" + when: + - '"swap" in sap_storage_definition | map(attribute="filesystem_type", default="xfs")' From d9a4047e19fc7958dd77749c121c4e2b9eb3daf4 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 4 May 2023 16:53:05 +0000 Subject: [PATCH 015/128] sap_storage_setup: first part of NFS filesystem creation tasks --- roles/sap_storage_setup/defaults/main.yml | 6 +++ .../sap_storage_setup/meta/argument_specs.yml | 15 +++++++- ...ms.yml => configure_local_filesystems.yml} | 0 .../configure_nfs_filesystems.yml | 37 +++++++++++++++++++ roles/sap_storage_setup/tasks/main.yml | 31 ++++++++-------- 5 files changed, 73 insertions(+), 16 deletions(-) rename roles/sap_storage_setup/tasks/generic_tasks/{configure_filesystems.yml => configure_local_filesystems.yml} (100%) create mode 100644 roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index 2d11f2faf..d3b6519e3 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -11,6 +11,9 @@ sap_storage_sap_type: 'sap_onehost' #sap_storage_action: # prepare | remove +sap_storage_setup_nfs_options: 'hard,acl' +sap_storage_setup_nfs_filesystem: nfs4 + # Azure variables @@ -24,6 +27,9 @@ sap_storage_az_lun: '/dev/disk/azure/scsi1/lun' # AWS variables +# should probably put into a platform specific vars file, to be included and overwriting the default +#sap_storage_setup_aws_nfs_options: 'nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,acl' + sap_storage_aws_imds_url: sap_storage_aws_vmsize_url: diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 00627eeba..3e89aff93 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -63,7 +63,7 @@ argument_specs: - Size of the disk device that is used for the filesystem. - For filesystems with no LVM logical volume striping, this is the end size of the filesystem. - For filesystems with LVM lv striping defined, this the size of each disk. Filesystem size will result in disk_size multiplied by amount of stripes (=disks). - required: true + required: false type: str filesystem_type: @@ -110,4 +110,17 @@ argument_specs: required: false type: str + nfs_path: + description: + - When defining an NFS filesystem, this is the directory path of the filesystem to be mounted. + required: false + type: str + + nfs_server: + description: + - When defining an NFS filesystem, this is the address of the NFS server. + - The address must contain the root path, in which the mount directories exist or will be created. + required: false + type: str + # TODO: adding all possible options, otherwise they will fail the argument validation when used diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml similarity index 100% rename from roles/sap_storage_setup/tasks/generic_tasks/configure_filesystems.yml rename to roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml new file mode 100644 index 000000000..b718ace8e --- /dev/null +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -0,0 +1,37 @@ +--- +# Put temporary tasks inside a block which only runs once and will make sure +# that even in case of failure the temporary mountpoint will be removed +- name: SAP Storage Setup - Temporary steps that only run once + block: + + - name: SAP Storage Setup - Create directory as temporary mountpoint + ansible.builtin.tempfile: + state: directory + prefix: sap_storage_setup_nfs + register: sap_storage_setup_tmpnfs_register + + - name: SAP Storage Setup - Attach NFS host and prepare to create subdirectories on the share + ansible.posix.mount: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + src: "{{ nfs_item.nfs_server | default(sap_storage_setup_nfs_server) }}" + fstype: "{{ nfs_item.nfs_filesystem | default(sap_storage_setup_nfs_filesystem) }}" + opts: "{{ nfs_item.nfs_mount_options | default(sap_storage_setup_nfs_options) }}" + state: mounted + loop: "{{ sap_storage_definition }}" + loop_control: + loop_var: nfs_item + label: "{{ nfs_item.name }}" + when: + - nfs_item.nfs_path is defined + + + # Block task that is even run when something failed + always: + + - name: SAP Storage Setup - Remove temporary NFS mount and directory + ansible.posix.mount: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + state: absent + + # Block global parameters + run_once: true diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index b32c0a962..17d4f5217 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -17,7 +17,7 @@ # - ansible facts: ansible_devices # ######### -- name: Make a list of unused disk devices of the requested sizes +- name: SAP Storage Setup - Make a list of unused disk devices of the requested sizes ansible.builtin.set_fact: available_devices: | {% set av_disks = [] %} @@ -26,6 +26,7 @@ {%- for fs in sap_storage_definition %} {%- if disk.value.links.uuids | length == 0 and disk.value.partitions | length == 0 + and fs.disk_size is defined and (fs.disk_size | string + 'GB') in (disk.value.size | regex_replace('(\.\d+\s*)', '')) %} {%- set add_to_list = av_disks.append(disk) %} {%- endif %} @@ -42,7 +43,7 @@ # - custom definition: sap_storage_definition # - ansible facts: ansible-devices -- name: Set fact for target filesystem device mapping +- name: SAP Storage Setup - Set fact for target filesystem device mapping ansible.builtin.set_fact: filesystem_device_map: | {% set device_map = [] %} @@ -81,15 +82,12 @@ {%- endfor %} {{ device_map }} -- debug: - var: filesystem_device_map -#- fail: # This task combines information to create a mapping list of devices to filesystems. # Sources: # - Extravars definition: sap_storage_definition # - Ansible host facts: hostvars[host_node].ansible_devices -- name: MAPPING - Set fact for device to filesystem mapping +- name: SAP Storage Setup - Set fact for device to filesystem mapping ansible.builtin.set_fact: volume_map: "{{ volume_map + volume_element }}" vars: @@ -124,22 +122,20 @@ label: "{{ map_item.name }}" loop_var: map_item when: - # - map_item.mountpoint is defined - # - map_item.mountpoint | length > 0 - # - '"swap" not in (map_item.filesystem_type | default("xfs"))' - - '"nfs" not in (map_item.filesystem_type | default("xfs"))' + - map_item.nfs_path is not defined -- debug: - var: volume_map - -#- fail: +#- debug: +# var: volume_map ################ # Main Run - call cloud specific tasks thru {{ sap_storage_cloud_type }}_tasks/prep_storage.yml ################ - name: SAP Storage Setup - Configure Volume Groups and Logical Volumes - include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_filesystems.yml" + include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_local_filesystems.yml" + when: + - volume_map is defined + - volume_map | length > 0 # NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) @@ -148,3 +144,8 @@ include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_swap.yml" when: - '"swap" in sap_storage_definition | map(attribute="filesystem_type", default="xfs")' + +- name: SAP Storage Setup - Configure NFS filesystems + include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_nfs_filesystems.yml" + when: + - sap_storage_definition | selectattr("nfs_path", "defined") From ead4b66c83d4d678f6d468397344ff0c35af7666 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 5 May 2023 19:26:58 +0000 Subject: [PATCH 016/128] sap_storage_setup: added nfs subdir and mount logic --- roles/sap_storage_setup/defaults/main.yml | 55 ++++++- .../sap_storage_setup/meta/argument_specs.yml | 18 ++- .../configure_local_filesystems.yml | 7 +- .../configure_nfs_filesystems.yml | 145 ++++++++++++++++-- .../tasks/generic_tasks/configure_swap.yml | 20 +-- roles/sap_storage_setup/tasks/main.yml | 36 +++-- 6 files changed, 228 insertions(+), 53 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index d3b6519e3..cdb3f4d9c 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -1,18 +1,57 @@ --- -# Important variables +### not defaults, keeping these here for reference for now -sap_storage_cloud_type: 'generic' +#sap_storage_setup_sid: +#sap_storage_setup_nwas_abap_ascs_instance_nr: +#sap_storage_setup_nwas_abap_ers_instance_nr: +#sap_storage_setup_nwas_abap_pas_instance_nr: +#sap_storage_setup_nwas_abap_aas_instance_nr: +#sap_storage_setup_nwas_java_scs_instance_nr: +#sap_storage_setup_nwas_java_ers_instance_nr: +#sap_storage_setup_nwas_java_as_instance_nr: + +# Directories use static prefixes /SYS, /ASCS, /ERS, /D, /SCS, /J +# Required File Systems and Directories - SAP Directories +# https://help.sap.com/docs/SLTOOLSET/39c32e9783f6439e871410848f61544c/d8d6abf3dceb45b9aa7b5f4e44b0d4b4.html?version=CURRENT_VERSION_SWPM20 +# +# Predefined prefixes during SAP SWPM installation: +# - NWAS ABAP ASCS uses ASCS +# - NWAS ABAP ERS uses ERS +# - NWAS ABAP PAS/AAS uses D +# - NWAS JAVA SCS uses SCS +# - NWAS JAVA ERS uses ERS +# - NWAS JAVA AS uses J +# - NWAS WebDispatcher uses W + +#----------------------------------------------------------# + +sap_storage_setup_cloud_type: 'generic' # generic | az | aws -sap_storage_sap_type: 'sap_onehost' -# sap_onehost | sap_hana | sap_nw +sap_storage_setup_nfs_filesystem_type: nfs4 +sap_storage_setup_nfs_mount_options: 'hard,acl' +sap_storage_setup_local_filesystem_type: xfs -#sap_storage_action: -# prepare | remove +# subdirectories as per SAP requirements -sap_storage_setup_nfs_options: 'hard,acl' -sap_storage_setup_nfs_filesystem: nfs4 +sap_storage_setup_nfs_dirs_usr_sap: + all: + - "{{ sap_storage_setup_sid }}/SYS" + nwas_abap_aas: + - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}" + nwas_abap_ascs: + - "{{ sap_storage_setup_sid }}/ASCS{{ sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}" + nwas_abap_ers: + - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_abap_ers_instance_nr | default('') }}" + nwas_abap_pas: + - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}" + nwas_java_as: + - "{{ sap_storage_setup_sid }}/J{{ sap_storage_setup_nwas_java_as_instance_nr | default('') }}" + nwas_java_ers: + - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_java_ers_instance_nr | default('') }}" + nwas_java_scs: + - "{{ sap_storage_setup_sid }}/SCS{{ sap_storage_setup_nwas_java_scs_instance_nr | default('') }}" # Azure variables diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 3e89aff93..845fa01a2 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -24,12 +24,12 @@ argument_specs: # description: # ... - sap_storage_definition: + sap_storage_setup_definition: description: - Describes the filesystems to be configured. example: - sap_storage_definition: + sap_storage_setup_definition: - name: hanadata mountpoint: /hana/data disk_size: 100G @@ -120,7 +120,21 @@ argument_specs: description: - When defining an NFS filesystem, this is the address of the NFS server. - The address must contain the root path, in which the mount directories exist or will be created. + - For example, `192.168.1.100:/`. required: false type: str + nfs_filesystem_type: + default: nfs4 + description: + - The type of the NFS filesystem, for example `nfs`, `nfs4`. + required: false + type: str + + nfs_mount_options: + description: + - Mount options to use for the NFS mount. + - Generic default is `hard,acl`. + - Defaults depend on the specific platform detected by the role or defined explicitly. + # TODO: adding all possible options, otherwise they will fail the argument validation when used diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml index f9414fc48..1b00eccd0 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_local_filesystems.yml @@ -11,8 +11,6 @@ loop_control: loop_var: vg_item label: "{{ vg_item.volume_group }}" -# when: -# - not vg_item.use_nfs - name: SAP Storage Setup - Create LVM volumes community.general.lvol: @@ -28,7 +26,6 @@ label: "{{ lv_item.volume_name }}" when: - not ansible_check_mode -# - not lv_item.use_nfs - name: SAP Storage Setup - Create filesystems community.general.filesystem: @@ -40,7 +37,6 @@ label: "{{ fs_item.volume_name }}" when: - not ansible_check_mode -# - not fs_item.use_nfs - name: SAP Storage Setup - Create mountpoints, add fstab entries and mount ansible.posix.mount: @@ -53,5 +49,6 @@ loop_var: mnt_item label: "{{ mnt_item.volume_name }}" when: -# - not mnt_item.use_nfs - not mnt_item.filesystem_type == "swap" + +# TODO: target permissions and ownership on the filesystems diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index b718ace8e..ff5a33949 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -1,37 +1,160 @@ --- +# These tasks are executed in a loop over all NFS filesystems +# defined in sap_storage_setup_definition. + + +# First, build a list of target mountpoints, based on the defined node role +# and filesystems. +# +# Required parameters: +# +# Custom filesystem definition: sap_storage_setup_definition +# /sapmnt subdir list: sap_storage_setup_nfs_dirs_sapmnt (default/main.yml) +# /usr/sap subdir list: sap_storage_setup_nfs_dirs_usr_sap (default/main.yml) +# Host role: sap_storage_setup_host_role + + +- name: SAP Storage Setup - ({{ nfs_item.name }}) Set fact for directories + ansible.builtin.set_fact: + related_directories: | + {% set mount_list = [] %} + + {%- if nfs_item.mountpoint | regex_replace('/$', '') == '/sapmnt' -%} + {%- set add_sapmnt = mount_list.extend([ + { + 'mount_src': nfs_item.nfs_path, + 'mountpoint': nfs_item.mountpoint, + 'dir_only': '/' + sap_storage_setup_sid, + } + ]) %} + {%- endif %} + + {%- if nfs_item.mountpoint | regex_replace('/$', '') == '/usr/sap/trans' %} + {%- set add_trans = mount_list.extend([ + { + 'mount_src': nfs_item.nfs_path, + 'mountpoint': nfs_item.mountpoint, + } + ]) %} + {%- endif %} + + {%- if nfs_item.mountpoint | regex_replace('/$', '') == '/usr/sap' -%} + {%- for common in sap_storage_setup_nfs_dirs_usr_sap.all %} + {%- set add_all_usrsap = mount_list.extend([ + { + 'mount_src': nfs_item.nfs_path + '/' + common, + 'mountpoint': nfs_item.mountpoint + common, + } + ]) %} + {%- endfor %} + + {%- for role in host_role %} + {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[role] %} + {%- set role_dirs = mount_list.extend([ + { + 'mount_src': nfs_item.nfs_path + '/' + dir, + 'mountpoint': nfs_item.mountpoint + dir, + } + ]) %} + {%- endfor %} + {%- endfor %} + + {%- endif %} + {{ mount_list }} + + vars: + # Convert the parameter to a list, if it is not one already. + # Careful with the whitespace control, spaces in front of a list variable + # convert it to a string. + host_role: | + {% if sap_storage_setup_host_role | type_debug != 'list' -%} + {{ sap_storage_setup_host_role | split(' ') }} + {%- else -%} + {{ sap_storage_setup_host_role }} + {%- endif %} + + # Put temporary tasks inside a block which only runs once and will make sure # that even in case of failure the temporary mountpoint will be removed - name: SAP Storage Setup - Temporary steps that only run once block: - - name: SAP Storage Setup - Create directory as temporary mountpoint + - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directory as temporary mountpoint ansible.builtin.tempfile: state: directory prefix: sap_storage_setup_nfs register: sap_storage_setup_tmpnfs_register - - name: SAP Storage Setup - Attach NFS host and prepare to create subdirectories on the share + - name: SAP Storage Setup - ({{ nfs_item.name }}) Attach NFS host root for subdirectory verification/creation ansible.posix.mount: path: "{{ sap_storage_setup_tmpnfs_register.path }}" - src: "{{ nfs_item.nfs_server | default(sap_storage_setup_nfs_server) }}" - fstype: "{{ nfs_item.nfs_filesystem | default(sap_storage_setup_nfs_filesystem) }}" - opts: "{{ nfs_item.nfs_mount_options | default(sap_storage_setup_nfs_options) }}" + src: "{{ attach_item.nfs_server | default(sap_storage_setup_nfs_server) }}" + fstype: "{{ attach_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" + opts: "{{ attach_item.nfs_mount_options | default(sap_storage_setup_nfs_mount_options) }}" state: mounted - loop: "{{ sap_storage_definition }}" + when: + - sap_storage_setup_tmpnfs_register.path is defined + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Check if directories exist on NFS share + ansible.builtin.stat: + path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" + register: sap_storage_setup_nfs_dir_register + loop: "{{ related_directories }}" loop_control: - loop_var: nfs_item - label: "{{ nfs_item.name }}" + loop_var: stat_item + label: "{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" when: - - nfs_item.nfs_path is defined + - sap_storage_setup_tmpnfs_register.path is defined + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directories if missing + ansible.builtin.file: + path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ dir_item.stat_item.mount_src }}{{ dir_item.stat_item.dir_only | default('') }}" + mode: '0777' + recurse: true + state: directory + loop: "{{ sap_storage_setup_nfs_dir_register.results }}" + loop_control: + loop_var: dir_item + label: "{{ dir_item.stat_item.mount_src }}{{ stat_item.dir_only | default('') }}" + when: + - sap_storage_setup_tmpnfs_register.path is defined + - dir_item.stat is defined + - not dir_item.stat.exists - # Block task that is even run when something failed + + # Tasks that are even run when something failed always: - - name: SAP Storage Setup - Remove temporary NFS mount and directory + - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount and directory ansible.posix.mount: path: "{{ sap_storage_setup_tmpnfs_register.path }}" state: absent + when: + - sap_storage_setup_tmpnfs_register.path is defined # Block global parameters run_once: true + vars: + attach_item: "{{ sap_storage_setup_definition | selectattr('name', 'eq', nfs_item.name) }}" + +### End of block: temporary NFS mount for subdirectory creation + +######## +# Mount the subdirectories +# ##### + +- name: SAP Storage Setup - ({{ nfs_item.name }}) Mount NFS + ansible.posix.mount: + path: "{{ mount_item.mountpoint }}" + src: "{{ nfs_server }}/{{ mount_item.mount_src | regex_replace('^/', '') }}" + fstype: "{{ nfs_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" + state: mounted + loop: "{{ related_directories }}" + loop_control: + loop_var: mount_item + label: "{{ mount_item.mountpoint }}" + vars: + nfs_path: "{{ nfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }}" + nfs_server: "{{ nfs_item.nfs_server | default(sap_storage_setup_nfs_server) | regex_replace('/$', '') }}" + attach_item: "{{ sap_storage_setup_definition | selectattr('name', 'eq', nfs_item.name) }}" diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml index ff5b83547..49b4e5171 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml @@ -2,30 +2,30 @@ - name: SAP Storage Setup - Block handling the swap file block: - - name: SAP Storage Setup - Check if {{ swap_file.mountpoint }} exists + - name: SAP Storage Setup - (swap file) Check if file exists ansible.builtin.stat: path: "{{ swap_file.mountpoint }}" register: check_swapfile - - name: SAP Storage Setup - Allocate space for {{ swap_file.mountpoint }} + - name: SAP Storage Setup - (swap file) Allocate space ansible.builtin.shell: | fallocate -l {{ swap_file.disk_size | int * 1024 }}MB {{ swap_file.mountpoint }} when: - not check_swapfile.stat.exists - - name: SAP Storage Setup - Adjust permissions of {{ swap_file.mountpoint }} + - name: SAP Storage Setup - (swap file) Adjust file permissions ansible.builtin.file: path: "{{ swap_file.mountpoint }}" mode: 0600 - - name: SAP Storage Setup - Create and activate swap as {{ swap_file.mountpoint }} + - name: SAP Storage Setup - (swap file) Create and activate swap ansible.builtin.shell: | mkswap {{ swap_file.mountpoint }} swapon {{ swap_file.mountpoint }} when: - not check_swapfile.stat.exists - - name: SAP Storage Setup - Add fstab entry for {{ swap_file.mountpoint }} + - name: SAP Storage Setup - (swap file) Add fstab entry ansible.posix.mount: path: swap src: "{{ swap_file.mountpoint }}" @@ -37,7 +37,7 @@ vars: # Select the swap_file entry from the storage definition swap_file: | - {{- sap_storage_definition + {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") | selectattr("mountpoint", "defined") @@ -48,7 +48,7 @@ # Block conditional when: | - sap_storage_definition + sap_storage_setup_definition | selectattr("mountpoint", "defined") | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") @@ -58,7 +58,7 @@ - name: SAP Storage Setup - Block handling a swap partition filesystem block: - - name: SAP Storage Setup - Check if swap partition exists (static set to expected path /dev/vg_swap/lv_swap) + - name: SAP Storage Setup - Check if swap partition exists ansible.builtin.shell: | lsblk | grep SWAP || echo "no active swap" register: check_swap_partition @@ -83,7 +83,7 @@ # Select the swap volume entry from the storage definition. # Difference to swapfile logic is the absence of a mountpoint definition in that entry. swap_volume: | - {{- sap_storage_definition + {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") | selectattr("mountpoint", "undefined") @@ -94,7 +94,7 @@ # Block conditional when: | - sap_storage_definition + sap_storage_setup_definition | selectattr("mountpoint", "undefined") | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 17d4f5217..37298f08d 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -13,7 +13,7 @@ ########## # Creating a list of unused devices that match the requested filesystem sizes, using -# - custom definition: sap_storage_definition +# - custom definition: sap_storage_setup_definition # - ansible facts: ansible_devices # ######### @@ -23,7 +23,7 @@ {% set av_disks = [] %} {% set all_disks = (ansible_devices | dict2items) %} {% for disk in all_disks %} - {%- for fs in sap_storage_definition %} + {%- for fs in sap_storage_setup_definition %} {%- if disk.value.links.uuids | length == 0 and disk.value.partitions | length == 0 and fs.disk_size is defined @@ -40,7 +40,7 @@ # !! # This task assigns device names for each volume to be created. -# - custom definition: sap_storage_definition +# - custom definition: sap_storage_setup_definition # - ansible facts: ansible-devices - name: SAP Storage Setup - Set fact for target filesystem device mapping @@ -49,12 +49,12 @@ {% set device_map = [] %} {% set av_dev = (available_devices | dict2items) %} {% set assigned_dev = [] %} - {% for fs in sap_storage_definition -%} + {% for fs in sap_storage_setup_definition -%} {% set matching_dev = [] -%} {%- if fs.disk_size is defined - and ('nfs' not in fs.filesystem_type | default('xfs')) - and ('swap' not in fs.filesystem_type | default('xfs') + and ('nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type)) + and ('swap' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) or fs.mountpoint is not defined) -%} {%- for dev in av_dev -%} @@ -72,7 +72,7 @@ {%- set extend = device_map.extend([ { 'device': matching_dev | join(','), - 'fstype': fs.filesystem_type | default('xfs'), + 'fstype': fs.filesystem_type | default(sap_storage_setup_local_filesystem_type), 'mountpoint': fs.mountpoint | default(''), 'name': fs.name, 'size': fs.disk_size, @@ -85,7 +85,7 @@ # This task combines information to create a mapping list of devices to filesystems. # Sources: -# - Extravars definition: sap_storage_definition +# - Extravars definition: sap_storage_setup_definition # - Ansible host facts: hostvars[host_node].ansible_devices - name: SAP Storage Setup - Set fact for device to filesystem mapping ansible.builtin.set_fact: @@ -93,7 +93,7 @@ vars: volume_map: [] volume_element: - - filesystem_type: "{{ map_item.filesystem_type | default('xfs') }}" + - filesystem_type: "{{ map_item.filesystem_type | default(sap_storage_setup_local_filesystem_type) }}" mountpoint: "{{ map_item.mountpoint | default('') }}" volume_group: "{{ map_item.lvm_vg_name | default('vg_' + map_item.name) }}" volume_name: "{{ map_item.lvm_lv_name | default('lv_' + map_item.name) }}" @@ -117,7 +117,7 @@ {% set addopt = lvopts.append('--stripesize ' + map_item.lvm_lv_stripe_size) %} {%- endif %} {{ lvopts | join(' ') }} - loop: "{{ sap_storage_definition }}" + loop: "{{ sap_storage_setup_definition }}" loop_control: label: "{{ map_item.name }}" loop_var: map_item @@ -127,12 +127,10 @@ #- debug: # var: volume_map -################ -# Main Run - call cloud specific tasks thru {{ sap_storage_cloud_type }}_tasks/prep_storage.yml ################ - name: SAP Storage Setup - Configure Volume Groups and Logical Volumes - include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_local_filesystems.yml" + include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" when: - volume_map is defined - volume_map | length > 0 @@ -141,11 +139,15 @@ # NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) # Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map - name: SAP Storage Setup - Configure swap - include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_swap.yml" + include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_swap.yml" when: - - '"swap" in sap_storage_definition | map(attribute="filesystem_type", default="xfs")' + - '"swap" in sap_storage_setup_definition | map(attribute="filesystem_type", default=sap_storage_setup_local_filesystem_type)' - name: SAP Storage Setup - Configure NFS filesystems - include_tasks: "{{ sap_storage_cloud_type }}_tasks/configure_nfs_filesystems.yml" + include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_nfs_filesystems.yml" + loop: "{{ sap_storage_setup_definition }}" + loop_control: + loop_var: nfs_item + label: "{{ nfs_item.name }}" when: - - sap_storage_definition | selectattr("nfs_path", "defined") + - nfs_item.nfs_path is defined From 60837ad40834b93997a22fb9d990f6e6a81c878d Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 5 May 2023 20:54:51 +0100 Subject: [PATCH 017/128] sap_vm_preconfigure: experimental role rebase detect vars --- roles/sap_vm_preconfigure/defaults/main.yml | 1 + .../tasks/detect_platform/main.yml | 103 +++++++++++++----- roles/sap_vm_preconfigure/tasks/main.yml | 2 +- .../.gitkeep | 0 .../.gitkeep | 0 .../assert-set-tuned-profile.yml | 0 .../main.yml | 0 .../set-tuned-profile.yml | 0 .../.gitkeep | 0 9 files changed, 78 insertions(+), 28 deletions(-) rename roles/sap_vm_preconfigure/tasks/platform/{ibmpower_lpar => hyp_ibmpower_lpar}/.gitkeep (100%) rename roles/sap_vm_preconfigure/tasks/platform/{redhat_ocp_virt_vm => hyp_redhat_ocp_virt_vm}/.gitkeep (100%) rename roles/sap_vm_preconfigure/tasks/platform/{redhat_rhel_kvm_vm => hyp_redhat_rhel_kvm_vm}/assert-set-tuned-profile.yml (100%) rename roles/sap_vm_preconfigure/tasks/platform/{redhat_rhel_kvm_vm => hyp_redhat_rhel_kvm_vm}/main.yml (100%) rename roles/sap_vm_preconfigure/tasks/platform/{redhat_rhel_kvm_vm => hyp_redhat_rhel_kvm_vm}/set-tuned-profile.yml (100%) rename roles/sap_vm_preconfigure/tasks/platform/{vmware_vsphere_vm => hyp_vmware_vsphere_vm}/.gitkeep (100%) diff --git a/roles/sap_vm_preconfigure/defaults/main.yml b/roles/sap_vm_preconfigure/defaults/main.yml index 5fe1d5936..7835abe27 100644 --- a/roles/sap_vm_preconfigure/defaults/main.yml +++ b/roles/sap_vm_preconfigure/defaults/main.yml @@ -6,5 +6,6 @@ sap_vm_platform_detect: false # For re-use of this Ansible Role to establish which platform, without running any of the preconfigure Ansible Tasks for that platform sap_vm_platform_detect_only: false +# Static definition, required if detection boolean is set to false # cloud_aliyun_ecs_vm, cloud_aws_ec2_vs, cloud_gcp_ce_vm, cloud_ibmcloud_powervs, cloud_ibmcloud_vs, cloud_msazure_vm, hyp_ibmpower_lpar, hyp_redhat_ocp_virt_vm, hyp_redhat_rhel_kvm_vm, hyp_vmware_vsphere_vm sap_vm_platform: diff --git a/roles/sap_vm_preconfigure/tasks/detect_platform/main.yml b/roles/sap_vm_preconfigure/tasks/detect_platform/main.yml index 96fb74b74..095f22892 100644 --- a/roles/sap_vm_preconfigure/tasks/detect_platform/main.yml +++ b/roles/sap_vm_preconfigure/tasks/detect_platform/main.yml @@ -1,33 +1,81 @@ --- # Platform detection for cloud and other infrastructure platforms. -### AWS facts already available in Ansible +### Facts already available to Ansible # -# ansible_bios_vendor: "Amazon EC2" -# ansible_bios_version: "1.0" -# ansible_board_asset_tag: "i-043d3c1a889ed9016" -# ansible_board_name: "NA" -# ansible_board_serial: "NA" -# ansible_board_vendor: "Amazon EC2" -# ansible_board_version: "NA" -# ansible_chassis_asset_tag: "Amazon EC2" -# ansible_chassis_serial: "NA" +### Amazon Web Services EC2 Virtual Server. Not applicable for AWS Classic. +# ansible_chassis_asset_tag: "Amazon EC2" # SMBIOS Chassis Asset Tag +# ansible_board_asset_tag: "i-043d3c1a889ed9016" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform # ansible_chassis_vendor: "Amazon EC2" -# ansible_chassis_version: "NA" -# ansible_product_name: "r5.8xlarge" +# ansible_product_name: "r5.8xlarge" # IaaS profile name # ansible_system_vendor: "Amazon EC2" +# +### Google Cloud Compute Engine Virtual Machine. +# ansible_chassis_asset_tag: "NA" # SMBIOS Chassis Asset Tag +# ansible_board_asset_tag: "9EAF3038-7EF5-3F1E-6620-FB3BDA7A3709" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform +# ansible_chassis_vendor: "Google" +# ansible_product_name: "Google Compute Engine" +# ansible_system_vendor: "Google" +# +### IBM Cloud Virtual Server. Not applicable for IBM Cloud Classic Infrastructure. +# ansible_chassis_asset_tag: "ibmcloud" # SMBIOS Chassis Asset Tag +# ansible_board_asset_tag: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform +# ansible_chassis_vendor: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name +# ansible_product_name: "Standard PC (i440FX + PIIX, 1996)" +# ansible_system_vendor: "QEMU" +# +### Microsoft Azure Virtual Machine. Not applicable for MS Azure Classic/ASM. +# ansible_chassis_asset_tag: "7783-xxxx-yyyy-zzzz-aaaa-bbbb-cc" # SMBIOS Chassis Asset Tag +# ansible_board_asset_tag: "None" # SMBIOS Baseboard Asset Tag +# ansible_chassis_vendor: "Virtual Machine" +# ansible_product_name: "Microsoft Corporation" +# ansible_system_vendor: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # ID of virtual machine on platform +# +### VMware vSphere +# ansible_product_name: "VMware7,1", +# ansible_system_vendor: "VMware, Inc.", +# ansible_virtualization_type: "VMware" +# +### End of comment + # TODO: detection based on multiple facts and providing one standard # name for use as platform type in related include files +# cloud_aliyun_ecs_vm, cloud_aws_ec2_vs, cloud_gcp_ce_vm, cloud_ibmcloud_powervs, cloud_ibmcloud_vs, cloud_msazure_vm, hyp_ibmpower_lpar, hyp_redhat_ocp_virt_vm, hyp_redhat_rhel_kvm_vm, hyp_vmware_vsphere_vm + +- name: "SAP VM Preconfigure - Check if platform is Amazon Web Services EC2 Virtual Server" + when: + - ansible_system_vendor == 'Amazon EC2' + ansible.builtin.set_fact: + sap_vm_platform: cloud_aws_ec2_vs + +#- name: "SAP VM Preconfigure - Check if platform is Google Cloud Compute Engine Virtual Machine" +# when: +# - ansible_product_name == 'Google Compute Engine' +# ansible.builtin.set_fact: +# sap_vm_platform: cloud_gcp_ce_vm +- name: "SAP VM Preconfigure - Check if platform is IBM Cloud Virtual Server" + when: + - ansible_chassis_asset_tag == 'ibmcloud' + ansible.builtin.set_fact: + sap_vm_platform: cloud_ibmcloud_vs -- name: SAP virtual machine detect platform - decision set fact - set_fact: - sap_vm_platform: "{{ sap_vm_platform_detection_decision }}" - # cloud_aliyun_ecs_vm, cloud_aws_ec2_vs, cloud_gcp_ce_vm, cloud_ibmcloud_powervs, cloud_ibmcloud_vs, cloud_msazure_vm, hyp_ibmpower_lpar, hyp_redhat_ocp_virt_vm, hyp_redhat_rhel_kvm_vm, hyp_vmware_vsphere_vm +#- name: "SAP VM Preconfigure - Check if platform is Microsoft Azure Virtual Machine" +# when: +# - ansible_chassis_vendor == 'Virtual Machine' +# - ansible_product_name == 'Microsoft Corporation' +# ansible.builtin.set_fact: +# sap_vm_platform: cloud_msazure_vm +#- name: "SAP VM Preconfigure - Check if platform is VMware vSphere" +# when: +# - ansible_virtualization_type == 'VMware' +# ansible.builtin.set_fact: +# sap_vm_platform: hyp_vmware_vsphere_vm -- name: SAP virtual machine detect platform - confirm AWS EC2 Virtual Server + +- name: SAP VM Preconfigure - confirm AWS EC2 Virtual Server when: sap_vm_platform == cloud_aws_ec2_vs block: @@ -53,14 +101,14 @@ changed_when: false ignore_errors: true - - name: (AWS) Set detect_cloud_provider_cloud_provider - ansible.builtin.set_fact: - sap_detect_cloud_provider_cloud_provider: "aws" + - name: (AWS) Fail if cannot reach Instance Metadata Service + ansible.builtin.fail: + msg: Detected MS Azure, but could not confirm with the Instance Metadata Service when: - - not detect_cloud_provider_aws_ami_id.failed + - detect_cloud_provider_aws_ami_id.failed -- name: SAP virtual machine detect platform - confirm Microsoft Azure Virtual Machine +- name: SAP VM Preconfigure - confirm Microsoft Azure Virtual Machine when: sap_vm_platform == cloud_msazure_vm block: @@ -74,9 +122,10 @@ changed_when: false ignore_errors: true - - name: (Azure) Set detect_cloud_provider_cloud_provider - ansible.builtin.set_fact: - sap_detect_cloud_provider_cloud_provider: "azure" + - name: (Azure) Fail if cannot reach Instance Metadata Service + ansible.builtin.fail: + msg: Detected MS Azure, but could not confirm with the Instance Metadata Service when: - - detect_cloud_provider_azure_instance_metadata.json.azEnvironment is defined - - detect_cloud_provider_azure_instance_metadata.json.azEnvironment == "AzurePublicCloud" + - detect_cloud_provider_azure_instance_metadata.json.azEnvironment is not defined + - detect_cloud_provider_azure_instance_metadata.json.azEnvironment != "AzurePublicCloud" + diff --git a/roles/sap_vm_preconfigure/tasks/main.yml b/roles/sap_vm_preconfigure/tasks/main.yml index 30323e51e..3beaf778d 100644 --- a/roles/sap_vm_preconfigure/tasks/main.yml +++ b/roles/sap_vm_preconfigure/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: SAP virtual machine detect platform - ansible.builtin.include_tasks: "{{ role_path }}/tasks/platform/{{ sap_vm_platform }}/main.yml" + ansible.builtin.include_tasks: "{{ role_path }}/tasks/detect_platform/main.yml" when: sap_vm_platform_detect or sap_vm_platform_detect_only - name: SAP virtual machine preconfigure - Include Defaults Vars for {{ sap_vm_platform }} diff --git a/roles/sap_vm_preconfigure/tasks/platform/ibmpower_lpar/.gitkeep b/roles/sap_vm_preconfigure/tasks/platform/hyp_ibmpower_lpar/.gitkeep similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/ibmpower_lpar/.gitkeep rename to roles/sap_vm_preconfigure/tasks/platform/hyp_ibmpower_lpar/.gitkeep diff --git a/roles/sap_vm_preconfigure/tasks/platform/redhat_ocp_virt_vm/.gitkeep b/roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_ocp_virt_vm/.gitkeep similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/redhat_ocp_virt_vm/.gitkeep rename to roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_ocp_virt_vm/.gitkeep diff --git a/roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/assert-set-tuned-profile.yml b/roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/assert-set-tuned-profile.yml similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/assert-set-tuned-profile.yml rename to roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/assert-set-tuned-profile.yml diff --git a/roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/main.yml b/roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/main.yml similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/main.yml rename to roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/main.yml diff --git a/roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/set-tuned-profile.yml b/roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/set-tuned-profile.yml similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/redhat_rhel_kvm_vm/set-tuned-profile.yml rename to roles/sap_vm_preconfigure/tasks/platform/hyp_redhat_rhel_kvm_vm/set-tuned-profile.yml diff --git a/roles/sap_vm_preconfigure/tasks/platform/vmware_vsphere_vm/.gitkeep b/roles/sap_vm_preconfigure/tasks/platform/hyp_vmware_vsphere_vm/.gitkeep similarity index 100% rename from roles/sap_vm_preconfigure/tasks/platform/vmware_vsphere_vm/.gitkeep rename to roles/sap_vm_preconfigure/tasks/platform/hyp_vmware_vsphere_vm/.gitkeep From 659ba50a291b90c8358c2d71bc8e39443c0ea2d5 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 5 May 2023 20:57:07 +0100 Subject: [PATCH 018/128] sap_swpm: append umask to fix nfs 777 mount and nwas ers fixes --- roles/sap_swpm/tasks/pre_install.yml | 2 +- .../tasks/pre_install/install_type.yml | 10 ++- .../pre_install/install_type/ha_install.yml | 4 +- .../ha_maint_plan_stack_install.yml | 62 +++++++++++++++++++ roles/sap_swpm/tasks/swpm.yml | 12 ++-- roles/sap_swpm/templates/configfile.j2 | 6 +- 6 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml diff --git a/roles/sap_swpm/tasks/pre_install.yml b/roles/sap_swpm/tasks/pre_install.yml index bf08793ab..38c0e6478 100644 --- a/roles/sap_swpm/tasks/pre_install.yml +++ b/roles/sap_swpm/tasks/pre_install.yml @@ -19,7 +19,7 @@ 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 }}" + # IF SWPM is running a HA installation, Ansible Variable sap_swpm_swpm_command_virtual_hostname is set and contains "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true" # If SWPM is running a MP Stack XML installation, Ansible Variable sap_swpm_swpm_command_mp_stack is set and contains "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" sap_swpm_swpm_command_extra_args: "SAPINST_SKIP_DIALOGS=true SAPINST_START_GUISERVER=false {{ sap_swpm_swpm_command_virtual_hostname }} {{ sap_swpm_swpm_command_mp_stack }}" tags: sap_swpm_sapinst_commandline diff --git a/roles/sap_swpm/tasks/pre_install/install_type.yml b/roles/sap_swpm/tasks/pre_install/install_type.yml index 8cf428da2..e8d54f10e 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type.yml @@ -30,7 +30,6 @@ ansible.builtin.set_fact: sap_swpm_swpm_installation_type: "ha" sap_swpm_swpm_installation_header: "High Availability Installation using virtual hostname" - sap_swpm_swpm_command_virtual_hostname: "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }}" when: - "'.ABAPHA' in sap_swpm_product_catalog_id" @@ -38,10 +37,17 @@ ansible.builtin.set_fact: sap_swpm_swpm_installation_type: "maint_plan_stack" sap_swpm_swpm_installation_header: "Installing using SAP Maintenance Planner Stack XML" - sap_swpm_swpm_command_mp_stack: "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }}" when: - sap_swpm_mp_stack_path is defined and not sap_swpm_mp_stack_path is none +- name: SAP SWPM Pre Install - Check if SAP High Availability installation and using SAP Maintenance Planner + ansible.builtin.set_fact: + sap_swpm_swpm_installation_type: "ha_maint_plan_stack" + sap_swpm_swpm_installation_header: "High Availability Installation using virtual hostname and SAP Maintenance Planner Stack XML" + when: + - "'.ABAPHA' in sap_swpm_product_catalog_id" + - sap_swpm_mp_stack_path is defined and not sap_swpm_mp_stack_path is none + ################ # Run Installation Type Steps ################ diff --git a/roles/sap_swpm/tasks/pre_install/install_type/ha_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/ha_install.yml index f963e252a..91ce10f5a 100644 --- a/roles/sap_swpm/tasks/pre_install/install_type/ha_install.yml +++ b/roles/sap_swpm/tasks/pre_install/install_type/ha_install.yml @@ -2,9 +2,11 @@ # High Availability installation +# See virtual hostname information in SAP Note 2279110 and 962955 +# Avoid "host with the name is not a valid virtual host on the local host" by using SAP SWPM property IS_HOST_LOCAL_USING_STRING_COMPARE=true - name: SAP SWPM Pre Install - HA Installation - Add virtual hostname in sapinst command ansible.builtin.set_fact: - sap_swpm_swpm_command_virtual_hostname: "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }}" + sap_swpm_swpm_command_virtual_hostname: "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true" # Create sidadm and sapsys when HA setup - name: SAP SWPM Pre Install - HA Installation - Create User when ASCS (initial HA setup) diff --git a/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml new file mode 100644 index 000000000..c725e3bf8 --- /dev/null +++ b/roles/sap_swpm/tasks/pre_install/install_type/ha_maint_plan_stack_install.yml @@ -0,0 +1,62 @@ +--- + +# High Availability installation + +# See virtual hostname information in SAP Note 2279110 and 962955 +# Avoid "host with the name is not a valid virtual host on the local host" by using SAP SWPM property IS_HOST_LOCAL_USING_STRING_COMPARE=true +- name: SAP SWPM Pre Install - HA Installation - Add virtual hostname in sapinst command + ansible.builtin.set_fact: + sap_swpm_swpm_command_virtual_hostname: "SAPINST_USE_HOSTNAME={{ sap_swpm_virtual_hostname }} IS_HOST_LOCAL_USING_STRING_COMPARE=true" + +# Create sidadm and sapsys when HA setup +- name: SAP SWPM Pre Install - HA Installation - Create User when ASCS (initial HA setup) + ansible.builtin.include_tasks: ../create_os_user.yml + when: + - "'_ASCS' in sap_swpm_product_catalog_id" + + +# Install using SAP Maintenance Planner Stack XML + +# Check for MP Stack XML if filename not given +- name: SAP SWPM Pre Install - MP Stack XML - Get from {{ sap_swpm_mp_stack_path }} + ansible.builtin.shell: | + ls MP*.xml + args: + chdir: "{{ sap_swpm_mp_stack_path }}" + register: sap_swpm_mp_stack_file_get + # Test if variable string is not defined or None / blank + when: + (sap_swpm_mp_stack_file_name is not defined) or + (sap_swpm_mp_stack_file_name | type_debug == 'NoneType') or + (sap_swpm_mp_stack_file_name is none) or + (sap_swpm_mp_stack_file_name | length == 0) + +- name: SAP SWPM Pre Install - MP Stack XML - Set fact + ansible.builtin.set_fact: + sap_swpm_mp_stack_file_name: "{{ sap_swpm_mp_stack_file_get.stdout }}" + # Test if variable string is not defined or None / blank + when: + (sap_swpm_mp_stack_file_name is not defined) or + (sap_swpm_mp_stack_file_name | type_debug == 'NoneType') or + (sap_swpm_mp_stack_file_name is none) or + (sap_swpm_mp_stack_file_name | length == 0) + +- name: SAP SWPM Pre Install - MP Stack XML - Set fact + ansible.builtin.debug: + msg: "SAP Maintenance Planner Stack XML is {{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + +- name: SAP SWPM Pre Install - MP Stack XML - Set fact for SWPM injection + ansible.builtin.set_fact: + sap_swpm_swpm_command_mp_stack: "SAPINST_STACK_XML={{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + +- name: SAP SWPM Pre Install - MP Stack XML - Ensure (1 of 2) SAP System ID is correct inside SAP Maintenance Plan Stack XML + ansible.builtin.replace: + path: "{{ sap_swpm_mp_stack_path }}/{{ sap_swpm_mp_stack_file_name }}" + regexp: '([A-Z][0-9])\w' + replace: '{{ sap_swpm_sid | upper }}' diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index 62da3f757..d33f9edee 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -3,8 +3,11 @@ ### Deprecated standard method, can fail to detect process exit (e.g. hang errors with SAP SWPM 2.0 SP11) ### Detect changed when using 'SAPinst build information' from beginning of stdout ### Or detect changed when using instslana.xml at end of stdout (this is the Process XML file aka. SAPInst Software Logistics Toolset Analytics XML file, which records the installation information) +### Execute SAP SWPM, instead of command module use the shell module to allow use of umask according to SAP SWPM recommendations +### Use of umask will enforce permissions 755 in /usr/sap etc (thereby resolving any shared NFS mount points initially attached with permissions 777) #- name: SAP SWPM - {{ sap_swpm_swpm_installation_header }} -# command: >- +# ansible.builtin.shell: >- +# umask {{ sap_swpm_umask | default('022') }}; # ./sapinst \ # {{ sap_swpm_swpm_command_inifile }} \ # {{ sap_swpm_swpm_command_product_id }} \ @@ -36,7 +39,7 @@ - name: Set fact for the sapinst command line ansible.builtin.set_fact: - __sap_swpm_sapinst_command: "./sapinst {{ sap_swpm_swpm_command_inifile }} + __sap_swpm_sapinst_command: "umask {{ sap_swpm_umask | default('022') }} ; ./sapinst {{ sap_swpm_swpm_command_inifile }} {{ sap_swpm_swpm_command_product_id }} {{ sap_swpm_swpm_command_extra_args }}" tags: sap_swpm_sapinst_commandline @@ -54,10 +57,11 @@ # args: # chdir: "{{ sap_swpm_sapinst_path }}" -# Execute SAP SWPM +# Execute SAP SWPM, instead of command module use the shell module to allow use of umask according to SAP SWPM recommendations +# Use of umask will enforce permissions 755 in /usr/sap etc (thereby resolving any shared NFS mount points initially attached with permissions 777) # Reason for noqa: This command installs software, so it will change things - name: SAP SWPM - {{ sap_swpm_swpm_installation_header }} # noqa no-changed-when - ansible.builtin.command: "{{ __sap_swpm_sapinst_command }}" + ansible.builtin.shell: "{{ __sap_swpm_sapinst_command }}" register: __sap_swpm_register_sapinst_async_job args: chdir: "{{ sap_swpm_sapinst_path }}" diff --git a/roles/sap_swpm/templates/configfile.j2 b/roles/sap_swpm/templates/configfile.j2 index e58f36d34..bd15d3fb7 100644 --- a/roles/sap_swpm/templates/configfile.j2 +++ b/roles/sap_swpm/templates/configfile.j2 @@ -577,7 +577,11 @@ NW_DI_Instance.virtualHostname = {{ ansible_hostname }} ###### nw_instance_ers.ersVirtualHostname = {{ sap_swpm_ers_instance_hostname }} nw_instance_ers.ersInstanceNumber = {{ sap_swpm_ers_instance_nr }} -# nw_instance_ers.restartSCS = true + +# Disable 'Automatic Instance and Service Restart' for SAP SWPM Unattended Mode, +# 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 {% endif %} {% if 'nw_config_ports' in sap_swpm_inifile_list %} From 6e476410bd557758bcd205f69a213606ccac9528 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 5 May 2023 21:02:54 +0100 Subject: [PATCH 019/128] sap_ha_pacemaker_cluster: append future logic for nwas --- roles/sap_ha_pacemaker_cluster/README.md | 4 +- .../defaults/main.yml | 49 ++- .../meta/argument_specs.yml | 8 +- .../tasks/ascertain_platform_type.yml | 10 +- .../tasks/ascertain_sap_landscape.yml | 4 +- .../tasks/construct_vars_hana_common.yml | 30 +- ...construct_vars_netweaver_abap_ascs_ers.yml | 281 +++++++++++++++++ .../construct_vars_netweaver_abap_pas_aas.yml | 187 ++++++++++++ .../tasks/construct_vars_netweaver_common.yml | 136 +++++++++ .../construct_vars_netweaver_java_scs_ers.yml | 282 ++++++++++++++++++ .../tasks/include_vars_saphana.yml | 4 +- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 29 +- .../vars/platform_cloud_aws_ec2_vs.yml | 4 +- .../vars/sapnetweaver.yml | 7 + 14 files changed, 997 insertions(+), 38 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 88952e58f..3f442f587 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -259,10 +259,10 @@ sap_ha_pacemaker_cluster_resource_defaults: ### sap_ha_pacemaker_cluster_sap_type - _Type:_ `str` -- _Default:_ `scaleup` +- _Default:_ `saphana_scaleup` The SAP landscape to be installed.
-_Currently only scale-up is supported_
+_Currently only SAP HANA scale-up is supported_
### sap_ha_pacemaker_cluster_vip_client_interface diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 6d232b45a..087d545e7 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -20,6 +20,13 @@ sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluste sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes }}" sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid }}" sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr }}" +sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr }}" # Make sure that there is always the default fed into the included role sap_ha_pacemaker_cluster_fence_agent_packages: @@ -34,7 +41,8 @@ sap_ha_pacemaker_cluster_resource_defaults: # The type of SAP landscape and multi-node replication # TODO: Type definitions and feature support -sap_ha_pacemaker_cluster_sap_type: scaleup +# TODO: Implement all types - # saphana_scaleup, saphana_scaleout, sapnetweaver_abap_ascs_ers, sapnetweaver_abap_pas_aas, sapnetweaver_java_scs_ers +sap_ha_pacemaker_cluster_sap_type: saphana_scaleup sap_ha_pacemaker_cluster_replication_type: none # Optional parameters to customize HANA resources @@ -56,12 +64,49 @@ sap_ha_pacemaker_cluster_vip_address: "{{ sap_hana_vip }}" sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" -# Resource IDs (names) as convenience parameters. +# SAP HANA - Resource IDs (names) as convenience parameters. sap_ha_pacemaker_cluster_hana_resource_name: "SAPHana_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}-clone" sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" + +# SAP NetWeaver common - Resource IDs (names) as convenience parameters. +# - /sapmnt +# - /usr/sap/trans +# - /usr/sap/<>/SYS +sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesytem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesytem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesytem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" + +# SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. +# - /usr/sap/<>/ASCS<> +# - /usr/sap/<>/ERS<> +sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesytem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" +sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesytem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" + +# SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. +# - /usr/sap/<>/D<> +#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesytem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesytem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" + +# SAP NetWeaver JAVA SCS/ERS - Resource IDs (names) as convenience parameters. +# - /usr/sap/<>/SCS<> +# - /usr/sap/<>/ERS<> +#sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name: "Filesytem_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" +#sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name: "Filesytem_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" + + # TODO: network interface name used for client access sap_ha_pacemaker_cluster_vip_client_interface: eth0 sap_ha_pacemaker_cluster_vip_update_rt: [] diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 665579505..587a60567 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -232,12 +232,12 @@ argument_specs: sap_ha_pacemaker_cluster_sap_type: choices: - - scaleup - - scaleout - default: scaleup + - saphana_scaleup + - saphana_scaleout + default: saphana_scaleup description: - The SAP landscape to be installed. - - _Currently only scale-up is supported_ + - _Currently only SAP HANA scale-up is supported_ required: false type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml index 98f6ad958..ebf5315c0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml @@ -5,21 +5,21 @@ # ### Amazon Web Services EC2 Virtual Server. Not applicable for AWS Classic. # ansible_chassis_asset_tag: "Amazon EC2" # SMBIOS Chassis Asset Tag -# ansible_board_asset_tag: "i-043d3c1a889ed9016" # SMBIOS Baseboard Asset Tag +# ansible_board_asset_tag: "i-043d3c1a889ed9016" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform # ansible_chassis_vendor: "Amazon EC2" # ansible_product_name: "r5.8xlarge" # IaaS profile name # ansible_system_vendor: "Amazon EC2" # ### Google Cloud Compute Engine Virtual Machine. # ansible_chassis_asset_tag: "NA" # SMBIOS Chassis Asset Tag -# ansible_board_asset_tag: "9EAF3038-7EF5-3F1E-6620-FB3BDA7A3709" # SMBIOS Baseboard Asset Tag +# ansible_board_asset_tag: "9EAF3038-7EF5-3F1E-6620-FB3BDA7A3709" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform # ansible_chassis_vendor: "Google" # ansible_product_name: "Google Compute Engine" # ansible_system_vendor: "Google" # ### IBM Cloud Virtual Server. Not applicable for IBM Cloud Classic Infrastructure. # ansible_chassis_asset_tag: "ibmcloud" # SMBIOS Chassis Asset Tag -# ansible_board_asset_tag: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag +# ansible_board_asset_tag: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform # ansible_chassis_vendor: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name # ansible_product_name: "Standard PC (i440FX + PIIX, 1996)" # ansible_system_vendor: "QEMU" @@ -29,7 +29,7 @@ # ansible_board_asset_tag: "None" # SMBIOS Baseboard Asset Tag # ansible_chassis_vendor: "Virtual Machine" # ansible_product_name: "Microsoft Corporation" -# ansible_system_vendor: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # IaaS profile name +# ansible_system_vendor: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # ID of virtual machine on platform # ### VMware vSphere # ansible_product_name: "VMware7,1", @@ -73,7 +73,7 @@ # when: # - ansible_virtualization_type == 'VMware' # ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: vmware_vsphere_vm +# __sap_ha_pacemaker_cluster_platform: hyp_vmware_vsphere_vm # Call tasks to discover information that is needed as input for any further steps. # Run this before including the platform vars in order to build vars based on the diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index e386b1852..e85f0fada 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -10,12 +10,12 @@ # 2 nodes are also valid for other scenarios. # TODO: collect possible rules for target landscapes -# Currently only 2-node scale-up is supported. +# Currently only SAP HANA 2-node scale-up is supported. - name: "SAP HA Prepare Pacemaker - Set landscape to scale-up if target is 2 nodes" when: - ansible_play_hosts|length == 2 ansible.builtin.set_fact: - sap_ha_pacemaker_cluster_sap_type: scaleup + sap_ha_pacemaker_cluster_sap_type: saphana_scaleup - name: "SAP HA Prepare Pacemaker - Include HANA specific variables" ansible.builtin.import_tasks: include_vars_saphana.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index aff797867..9dfe2f54d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -11,9 +11,9 @@ - name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA Topology" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_topology] }}" + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_saphana_topology] }}" vars: - __resource_topology: + __resource_saphana_topology: id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}" agent: "ocf:heartbeat:SAPHanaTopology" instance_attrs: @@ -38,13 +38,13 @@ - name: timeout value: 600 when: - - __resource_topology.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_saphana_topology.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) - name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana] }}" + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_saphana] }}" vars: - __resource_hana: + __resource_saphana: id: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}" agent: "ocf:heartbeat:{{ sap_ha_pacemaker_cluster_ra_hana }}" instance_attrs: @@ -93,13 +93,13 @@ - name: timeout value: 3600 when: - - __resource_hana.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_saphana.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) - name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA Topology" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_topology] }}" + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_saphana_topology] }}" vars: - __clone_topology: + __clone_saphana_topology: resource_id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}" promotable: "no" meta_attrs: @@ -111,13 +111,13 @@ - name: interleave value: "true" when: - - __clone_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + - __clone_saphana_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana] }}" + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_saphana] }}" vars: - __clone_hana: + __clone_saphana: resource_id: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}" promotable: "yes" meta_attrs: @@ -129,14 +129,14 @@ - name: interleave value: "true" when: - - __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + - __clone_saphana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) # First start Topology, then HANA (automatically stops in reverse order) - name: "SAP HA Prepare Pacemaker - Add order constraint: Topology starts before DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_topology] }}" + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_saphana_topology] }}" vars: - __constraint_order_topology: + __constraint_order_saphana_topology: resource_first: id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_clone_name }}" action: start @@ -147,4 +147,4 @@ - name: symmetrical value: "false" when: - - __constraint_order_topology.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - __constraint_order_saphana_topology.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml new file mode 100644 index 000000000..4eee4650e --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -0,0 +1,281 @@ +--- +# Variables containing variables must be constructed with values +# to be fed into the included ha_cluster role + +# - put here all scale-up and scale-out common resources +# - certain differences like ra agent names are provided through +# type specific variables + +# TODO: add conditionals to verify that the same resource agent is not already +# defined in user input variables. Conflicting user input should take precedence. + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ASCS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ERS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Central Service (ABAP ASCS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" + vars: + __resource_sapinstance: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" + vars: + __resource_sapinstance_ers: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + + +- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ASCS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" + vars: + __clone_filesystem: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" + promotable: "no" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ERS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" + vars: + __clone_filesystem: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + promotable: "no" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + + +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Central Service (ABAP ASCS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance] }}" + vars: + __clone_sapinstance: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + promotable: "yes" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_sapinstance.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Enqueue Replication Service (ABAP ERS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance_ers] }}" + vars: + __clone_sapinstance_ers: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + promotable: "yes" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_sapinstance_ers.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +# First start SAPInstance for Central Service, then SAPInstance for Enqueue Replication Service (automatically stops in reverse order) +- name: "SAP HA Prepare Pacemaker - Add order constraint: Central Service starts before Enqueue Replication Service" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_sapinstance] }}" + vars: + __constraint_order_sapinstance: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name }}" + action: start + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name }}" + action: start + options: + - name: symmetrical + value: "false" + - name: kind + value: "Optional" + when: + - __constraint_order_sapinstance.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml new file mode 100644 index 000000000..02dfcbe98 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml @@ -0,0 +1,187 @@ +--- +# Variables containing variables must be constructed with values +# to be fed into the included ha_cluster role + +# - put here all scale-up and scale-out common resources +# - certain differences like ra agent names are provided through +# type specific variables + +# TODO: add conditionals to verify that the same resource agent is not already +# defined in user input variables. Conflicting user input should take precedence. + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/D<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/D<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Primary Application Server (ABAP PAS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" + vars: + __resource_sapinstance: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Additional Application Server (ABAP AAS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" + vars: + __resource_sapinstance_ers: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml new file mode 100644 index 000000000..5f79d511f --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -0,0 +1,136 @@ +--- +# Variables containing variables must be constructed with values +# to be fed into the included ha_cluster role + +# - put here all scale-up and scale-out common resources +# - certain differences like ra agent names are provided through +# type specific variables + +# TODO: add conditionals to verify that the same resource agent is not already +# defined in user input variables. Conflicting user input should take precedence. + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /sapmnt" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/trans" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/SYS" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml new file mode 100644 index 000000000..9a55f229d --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml @@ -0,0 +1,282 @@ +--- +# Variables containing variables must be constructed with values +# to be fed into the included ha_cluster role + +# - put here all scale-up and scale-out common resources +# - certain differences like ra agent names are provided through +# type specific variables + +# TODO: add conditionals to verify that the same resource agent is not already +# defined in user input variables. Conflicting user input should take precedence. + + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/SCS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ERS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" + vars: + __resource_filesystem: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name }}" + agent: "ocf:heartbeat:Filesystem" + instance_attrs: + - attrs: + - name: device + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_host_mount_path }}" + - name: directory + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_local_mount_path }}" + - name: fstype + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_fstype }}" + - name: options + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_options_string }}" + - name: force_unmount + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_force_unmount }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 60 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 120 + - action: monitor + attrs: + - name: interval + value: 200 + - name: timeout + value: 40 + when: + - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Central Service (JAVA SCS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" + vars: + __resource_sapinstance: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + +- name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (JAVA ERS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" + vars: + __resource_sapinstance_ers: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name }}" + agent: "ocf:heartbeat:SAPInstance" + instance_attrs: + - attrs: + - name: InstanceName + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_instance_name }}" + - name: START_PROFILE + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_start_profile_string }}" + - name: AUTOMATIC_RECOVER + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_automatic_recover_bool | string }}" + - name: meta + value: "" + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_stickiness }}" + - name: migration-threshold + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_migration_threshold }}" + - name: failure-timeout + value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_failure_timeout }}" + operations: + - action: start + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: stop + attrs: + - name: interval + value: 0 + - name: timeout + value: 600 + - action: monitor + attrs: + - name: interval + value: 20 + - name: on-fail + value: restart + - name: timeout + value: 60 + when: + - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + + +- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/SCS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" + vars: + __clone_filesystem: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name }}" + promotable: "no" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ERS<>" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" + vars: + __clone_filesystem: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name }}" + promotable: "no" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + + +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Central Service (JAVA SCS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance] }}" + vars: + __clone_sapinstance: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name }}" + promotable: "yes" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_sapinstance.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Enqueue Replication Service (JAVA ERS)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance_ers] }}" + vars: + __clone_sapinstance_ers: + resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name }}" + promotable: "yes" + meta_attrs: + - attrs: + - name: clone-max + value: 2 + - name: clone-node-max + value: 1 + - name: interleave + value: "true" + when: + - __clone_sapinstance_ers.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + +# First start SAPInstance for Central Service, then SAPInstance for Enqueue Replication Service (automatically stops in reverse order) +- name: "SAP HA Prepare Pacemaker - Add order constraint: Central Service starts before Enqueue Replication Service" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_sapinstance] }}" + vars: + __constraint_order_sapinstance: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_clone_name }}" + action: start + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name }}" + action: start + options: + - name: symmetrical + value: "false" + - name: kind + value: "Optional" + when: + - __constraint_order_sapinstance.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml index 3d0014df5..730bf774d 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml @@ -3,7 +3,7 @@ when: __sap_ha_pacemaker_cluster_vars_file is file ansible.builtin.include_vars: "{{ __sap_ha_pacemaker_cluster_vars_file }}" loop: - - "saphana_{{ sap_ha_pacemaker_cluster_sap_type }}.yml" - - "saphana_{{ sap_ha_pacemaker_cluster_replication_type }}.yml" + - "{{ sap_ha_pacemaker_cluster_sap_type }}.yml" + - "{{ sap_ha_pacemaker_cluster_replication_type }}.yml" vars: __sap_ha_pacemaker_cluster_vars_file: "{{ role_path }}/vars/{{ item }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index aeed1029e..dffe8eb6e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -45,17 +45,37 @@ ansible.builtin.import_tasks: include_construct_vip_resources.yml - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA common" + when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' or sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' ansible.builtin.import_tasks: construct_vars_hana_common.yml - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-up" - when: sap_ha_pacemaker_cluster_sap_type == 'scaleup' + when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' ansible.builtin.include_tasks: file: construct_vars_hana_scaleup.yml -- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-out" - when: sap_ha_pacemaker_cluster_sap_type == 'scaleout' +#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-out" +# when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' +# ansible.builtin.include_tasks: +# file: construct_vars_hana_scaleout.yml + +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver common" + when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_ascs_ers' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_pas_aas' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' + ansible.builtin.import_tasks: construct_vars_netweaver_common.yml + +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP ASCS/ERS" + when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_ascs_ers' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' ansible.builtin.include_tasks: - file: construct_vars_hana_scaleout.yml + file: construct_vars_netweaver_abap_ascs_ers.yml + +#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" +# when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_pas_aas' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' +# ansible.builtin.include_tasks: +# file: construct_vars_netweaver_abap_pas_aas.yml + +#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver JAVA SCS/ERS" +# when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_java_scs_ers' +# ansible.builtin.include_tasks: +# file: construct_vars_netweaver_java_scs_ers.yml - name: "SAP HA Install Pacemaker - Block with actual changes" block: @@ -151,6 +171,7 @@ run_once: true - name: "SAP HA Install Pacemaker - Include srHook configuration" + when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' or sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' ansible.builtin.include_tasks: file: configure_srhook.yml apply: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index 85e59f461..4165d3eb1 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -40,11 +40,11 @@ __sap_ha_pacemaker_cluster_available_vip_agents: ipaddr: agent: "ocf:heartbeat:IPAddr2" - # Testing only! Not officially supported for SAP on AWS. + # Testing only! Not officially supported for SAP on AWS. Updates VM Instance network interface (ENI) with Secondary Private IP. awsvip: agent: "ocf:heartbeat:awsvip" with: ipaddr - # Only officially supported agent to manage floating IPs. + # Supported agent to manage Virtual/Overlay IPs for SAP on AWS by updating VPC Routing Table. aws_vpc_move_ip: agent: "ocf:heartbeat:aws-vpc-move-ip" diff --git a/roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml b/roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml new file mode 100644 index 000000000..21dd17d20 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml @@ -0,0 +1,7 @@ +--- +# SAP NetWeaver ABAP specific parameter values +# +# TODO: make sure to first respect 'ha_cluster' native variables + +sap_ha_pacemaker_cluster_sap_extra_packages: + - resource-agents-sap From 2c6601f8f90d71e85f33e1539d048cb1a14fbf70 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 13:12:13 +0000 Subject: [PATCH 020/128] sap_storage_setup: add package installation and services by OS --- roles/sap_storage_setup/tasks/main.yml | 27 +++++++++++++++++++++++++ roles/sap_storage_setup/vars/RedHat.yml | 11 ++++++++++ roles/sap_storage_setup/vars/Suse.yml | 11 ++++++++++ 3 files changed, 49 insertions(+) create mode 100644 roles/sap_storage_setup/vars/RedHat.yml create mode 100644 roles/sap_storage_setup/vars/Suse.yml diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 37298f08d..2e3fa3e65 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -1,5 +1,32 @@ --- +- name: SAP Storage Setup - Get facts about the OS + ansible.builtin.setup: + gather_subset: + - "distribution" + +- name: SAP Storage Setup - Include OS specific vars + ansible.builtin.include_vars: + file: "{{ ansible_os_family }}.yml" + +- name: SAP Storage Setup - Install additional OS packages + ansible.builtin.package: + name: "{{ package_item }}" + state: present + loop: "{{ __sap_storage_setup_extra_packages }}" + loop_control: + loop_var: package_item + +- name: SAP Storage Setup - Make sure services are running + ansible.builtin.service: + name: "{{ service_item }}" + state: started + loop: "{{ __sap_storage_setup_extra_services }}" + loop_control: + loop_var: service_item + + + ################ # Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml ################ diff --git a/roles/sap_storage_setup/vars/RedHat.yml b/roles/sap_storage_setup/vars/RedHat.yml new file mode 100644 index 000000000..973dc4445 --- /dev/null +++ b/roles/sap_storage_setup/vars/RedHat.yml @@ -0,0 +1,11 @@ +--- +# RHEL specific variables + +__sap_storage_setup_extra_packages: + - device-mapper-multipath + - lvm2* + - nfs-utils + +__sap_storage_setup_extra_services: + - multipathd + - lvm2-lvmdbusd diff --git a/roles/sap_storage_setup/vars/Suse.yml b/roles/sap_storage_setup/vars/Suse.yml new file mode 100644 index 000000000..4c4d6a812 --- /dev/null +++ b/roles/sap_storage_setup/vars/Suse.yml @@ -0,0 +1,11 @@ +--- +# SLES specific variables + +__sap_storage_setup_extra_packages: + - multipath-tools + - lvm2* + - nfs-client + +__sap_storage_setup_extra_services: + - multipathd + - lvm2-lvmdbusd From e4dbcf9255b89383f612eb36584c9af1e7fddfa9 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 13:51:14 +0000 Subject: [PATCH 021/128] sap_storage_setup: more trailing / handling and removed run_once from nfs block --- .../configure_nfs_filesystems.yml | 45 +++++++++++++------ roles/sap_storage_setup/tasks/main.yml | 4 +- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index ff5a33949..4fc2cbfff 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -9,21 +9,38 @@ # Required parameters: # # Custom filesystem definition: sap_storage_setup_definition -# /sapmnt subdir list: sap_storage_setup_nfs_dirs_sapmnt (default/main.yml) # /usr/sap subdir list: sap_storage_setup_nfs_dirs_usr_sap (default/main.yml) # Host role: sap_storage_setup_host_role +# Make sure paths and mountpoints are stripped from trailing '/'. +# The '/' is added explicitly to the constructed paths. + +# Parameter: sap_storage_setup_related_directories +# Param Type: list of dictionaries +# +# Debug sample for a node of role 'nwas_abap_ascs': +# +# sap_storage_setup_related_directories: +# - dir_only: /DB1 +# mount_src: /my_dir/sapmnt +# mountpoint: /sapmnt +# +# sap_storage_setup_related_directories: +# - mount_src: /my_dir/usr/sap/DB1/SYS +# mountpoint: /usr/sap/DB1/SYS +# - mount_src: /my_dir/usr/sap/DB1/ASCS00 +# mountpoint: /usr/sap/DB1/ASCS00 - name: SAP Storage Setup - ({{ nfs_item.name }}) Set fact for directories ansible.builtin.set_fact: - related_directories: | + sap_storage_setup_related_directories: | {% set mount_list = [] %} {%- if nfs_item.mountpoint | regex_replace('/$', '') == '/sapmnt' -%} {%- set add_sapmnt = mount_list.extend([ { - 'mount_src': nfs_item.nfs_path, - 'mountpoint': nfs_item.mountpoint, + 'mount_src': nfs_item.nfs_path | regex_replace('/$', ''), + 'mountpoint': nfs_item.mountpoint | regex_replace('/$', ''), 'dir_only': '/' + sap_storage_setup_sid, } ]) %} @@ -32,8 +49,8 @@ {%- if nfs_item.mountpoint | regex_replace('/$', '') == '/usr/sap/trans' %} {%- set add_trans = mount_list.extend([ { - 'mount_src': nfs_item.nfs_path, - 'mountpoint': nfs_item.mountpoint, + 'mount_src': nfs_item.nfs_path | regex_replace('/$', ''), + 'mountpoint': nfs_item.mountpoint | regex_replace('/$', ''), } ]) %} {%- endif %} @@ -42,8 +59,8 @@ {%- for common in sap_storage_setup_nfs_dirs_usr_sap.all %} {%- set add_all_usrsap = mount_list.extend([ { - 'mount_src': nfs_item.nfs_path + '/' + common, - 'mountpoint': nfs_item.mountpoint + common, + 'mount_src': nfs_item.nfs_path | regex_replace('/$', '') + '/' + common, + 'mountpoint': nfs_item.mountpoint | regex_replace('/$', '') + '/' + common, } ]) %} {%- endfor %} @@ -52,8 +69,8 @@ {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[role] %} {%- set role_dirs = mount_list.extend([ { - 'mount_src': nfs_item.nfs_path + '/' + dir, - 'mountpoint': nfs_item.mountpoint + dir, + 'mount_src': nfs_item.nfs_path | regex_replace('/$', '') + '/' + dir, + 'mountpoint': nfs_item.mountpoint | regex_replace('/$', '') + '/' + dir, } ]) %} {%- endfor %} @@ -74,7 +91,7 @@ {%- endif %} -# Put temporary tasks inside a block which only runs once and will make sure +# Put temporary tasks inside a block which will make sure # that even in case of failure the temporary mountpoint will be removed - name: SAP Storage Setup - Temporary steps that only run once block: @@ -95,11 +112,12 @@ when: - sap_storage_setup_tmpnfs_register.path is defined + - name: SAP Storage Setup - ({{ nfs_item.name }}) Check if directories exist on NFS share ansible.builtin.stat: path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" register: sap_storage_setup_nfs_dir_register - loop: "{{ related_directories }}" + loop: "{{ sap_storage_setup_related_directories }}" loop_control: loop_var: stat_item label: "{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" @@ -134,7 +152,6 @@ - sap_storage_setup_tmpnfs_register.path is defined # Block global parameters - run_once: true vars: attach_item: "{{ sap_storage_setup_definition | selectattr('name', 'eq', nfs_item.name) }}" @@ -150,7 +167,7 @@ src: "{{ nfs_server }}/{{ mount_item.mount_src | regex_replace('^/', '') }}" fstype: "{{ nfs_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" state: mounted - loop: "{{ related_directories }}" + loop: "{{ sap_storage_setup_related_directories }}" loop_control: loop_var: mount_item label: "{{ mount_item.mountpoint }}" diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 2e3fa3e65..8cda58457 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -26,7 +26,6 @@ loop_var: service_item - ################ # Cloud Specific Pre-Tasks - call cloud specific pre tasks thru {{ sap_storage_cloud_type }}_main.yml ################ @@ -144,12 +143,15 @@ {% set addopt = lvopts.append('--stripesize ' + map_item.lvm_lv_stripe_size) %} {%- endif %} {{ lvopts | join(' ') }} + loop: "{{ sap_storage_setup_definition }}" loop_control: label: "{{ map_item.name }}" loop_var: map_item when: - map_item.nfs_path is not defined + - '"swap" not in map_item.filesystem_type' + - '"nfs" not in map_item.filesystem_type' #- debug: # var: volume_map From 3d67863e5c859901b952d6c11f47a0adfaba8cba Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 14:15:42 +0000 Subject: [PATCH 022/128] sap_storage_setup: adjusted instance number parameter defaults --- roles/sap_storage_setup/defaults/main.yml | 30 ++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index cdb3f4d9c..a1a62df63 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -3,13 +3,15 @@ ### not defaults, keeping these here for reference for now #sap_storage_setup_sid: -#sap_storage_setup_nwas_abap_ascs_instance_nr: -#sap_storage_setup_nwas_abap_ers_instance_nr: -#sap_storage_setup_nwas_abap_pas_instance_nr: -#sap_storage_setup_nwas_abap_aas_instance_nr: -#sap_storage_setup_nwas_java_scs_instance_nr: -#sap_storage_setup_nwas_java_ers_instance_nr: -#sap_storage_setup_nwas_java_as_instance_nr: +# +# The instance_nr parameters are required for references at the bottom. +sap_storage_setup_nwas_abap_ascs_instance_nr: '01' +sap_storage_setup_nwas_abap_ers_instance_nr: '02' +sap_storage_setup_nwas_abap_pas_instance_nr: '03' +sap_storage_setup_nwas_abap_aas_instance_nr: '04' +sap_storage_setup_nwas_java_scs_instance_nr: '05' +sap_storage_setup_nwas_java_ers_instance_nr: '06' +sap_storage_setup_nwas_java_as_instance_nr: '07' # Directories use static prefixes /SYS, /ASCS, /ERS, /D, /SCS, /J # Required File Systems and Directories - SAP Directories @@ -39,19 +41,19 @@ sap_storage_setup_nfs_dirs_usr_sap: all: - "{{ sap_storage_setup_sid }}/SYS" nwas_abap_aas: - - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_aas_instance_nr }}" nwas_abap_ascs: - - "{{ sap_storage_setup_sid }}/ASCS{{ sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/ASCS{{ sap_storage_setup_nwas_abap_ascs_instance_nr }}" nwas_abap_ers: - - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_abap_ers_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_abap_ers_instance_nr }}" nwas_abap_pas: - - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_pas_instance_nr }}" nwas_java_as: - - "{{ sap_storage_setup_sid }}/J{{ sap_storage_setup_nwas_java_as_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/J{{ sap_storage_setup_nwas_java_as_instance_nr }}" nwas_java_ers: - - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_java_ers_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_java_ers_instance_nr }}" nwas_java_scs: - - "{{ sap_storage_setup_sid }}/SCS{{ sap_storage_setup_nwas_java_scs_instance_nr | default('') }}" + - "{{ sap_storage_setup_sid }}/SCS{{ sap_storage_setup_nwas_java_scs_instance_nr }}" # Azure variables From 5a7c541df8250de671e6ed542470f066b39ce066 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 14:41:02 +0000 Subject: [PATCH 023/128] sap_storage_setup: instance number defaults changed --- roles/sap_storage_setup/defaults/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index a1a62df63..a02ddbd1b 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -5,13 +5,13 @@ #sap_storage_setup_sid: # # The instance_nr parameters are required for references at the bottom. -sap_storage_setup_nwas_abap_ascs_instance_nr: '01' -sap_storage_setup_nwas_abap_ers_instance_nr: '02' -sap_storage_setup_nwas_abap_pas_instance_nr: '03' -sap_storage_setup_nwas_abap_aas_instance_nr: '04' -sap_storage_setup_nwas_java_scs_instance_nr: '05' -sap_storage_setup_nwas_java_ers_instance_nr: '06' -sap_storage_setup_nwas_java_as_instance_nr: '07' +sap_storage_setup_nwas_abap_ascs_instance_nr: '00' +sap_storage_setup_nwas_abap_ers_instance_nr: '10' +sap_storage_setup_nwas_abap_pas_instance_nr: '01' +sap_storage_setup_nwas_abap_aas_instance_nr: '11' +sap_storage_setup_nwas_java_scs_instance_nr: '20' +sap_storage_setup_nwas_java_ers_instance_nr: '30' +sap_storage_setup_nwas_java_ci_instance_nr: '21' # Directories use static prefixes /SYS, /ASCS, /ERS, /D, /SCS, /J # Required File Systems and Directories - SAP Directories From d9caa2ae9fcc34388e4908ba78bb2df7476875c1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 15:13:13 +0000 Subject: [PATCH 024/128] sap_storage_setup: re-enable swap device to volume mapping --- roles/sap_storage_setup/tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 8cda58457..92286e6fc 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -150,7 +150,6 @@ loop_var: map_item when: - map_item.nfs_path is not defined - - '"swap" not in map_item.filesystem_type' - '"nfs" not in map_item.filesystem_type' #- debug: From 81e34f4552a4aa724bf267e00c5678b0e6b02e5f Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 16:03:33 +0000 Subject: [PATCH 025/128] sap_storage_setup: mountpoint parameter replaced by swap_path in swap definition --- .../tasks/generic_tasks/configure_swap.yml | 22 +++++++++---------- roles/sap_storage_setup/tasks/main.yml | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml index 49b4e5171..aecb334b7 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml @@ -4,31 +4,31 @@ - name: SAP Storage Setup - (swap file) Check if file exists ansible.builtin.stat: - path: "{{ swap_file.mountpoint }}" + path: "{{ swap_file.swap_path }}" register: check_swapfile - name: SAP Storage Setup - (swap file) Allocate space ansible.builtin.shell: | - fallocate -l {{ swap_file.disk_size | int * 1024 }}MB {{ swap_file.mountpoint }} + fallocate -l {{ swap_file.disk_size | int * 1024 }}MB {{ swap_file.swap_path }} when: - not check_swapfile.stat.exists - name: SAP Storage Setup - (swap file) Adjust file permissions ansible.builtin.file: - path: "{{ swap_file.mountpoint }}" + path: "{{ swap_file.swap_path }}" mode: 0600 - name: SAP Storage Setup - (swap file) Create and activate swap ansible.builtin.shell: | - mkswap {{ swap_file.mountpoint }} - swapon {{ swap_file.mountpoint }} + mkswap {{ swap_file.swap_path }} + swapon {{ swap_file.swap_path }} when: - not check_swapfile.stat.exists - name: SAP Storage Setup - (swap file) Add fstab entry ansible.posix.mount: path: swap - src: "{{ swap_file.mountpoint }}" + src: "{{ swap_file.swap_path }}" fstype: swap opts: defaults state: present @@ -40,7 +40,7 @@ {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") - | selectattr("mountpoint", "defined") + | selectattr("swap_path", "defined") | map('dict2items') | flatten | items2dict @@ -49,7 +49,7 @@ # Block conditional when: | sap_storage_setup_definition - | selectattr("mountpoint", "defined") + | selectattr("swap_path", "defined") | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") @@ -81,12 +81,12 @@ # Block parameters vars: # Select the swap volume entry from the storage definition. - # Difference to swapfile logic is the absence of a mountpoint definition in that entry. + # Difference to swapfile logic is the absence of the "swap_path" parameter in that entry. swap_volume: | {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") - | selectattr("mountpoint", "undefined") + | selectattr("swap_path", "undefined") | map('dict2items') | flatten | items2dict @@ -95,7 +95,7 @@ # Block conditional when: | sap_storage_setup_definition - | selectattr("mountpoint", "undefined") + | selectattr("swap_path", "undefined") | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") ### End of block: swap filesystem diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 92286e6fc..94dfda919 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -80,8 +80,7 @@ {%- if fs.disk_size is defined and ('nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type)) - and ('swap' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type) - or fs.mountpoint is not defined) -%} + and fs.swap_path is not defined) -%} {%- for dev in av_dev -%} {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) @@ -151,6 +150,7 @@ when: - map_item.nfs_path is not defined - '"nfs" not in map_item.filesystem_type' + - map_item.swap_path is not defined #- debug: # var: volume_map From deeec865a1ed54ea57525d315686a4eca393542d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 16:41:39 +0000 Subject: [PATCH 026/128] sap_storage_setup: new parameter swap_path for swap definition --- roles/sap_storage_setup/meta/argument_specs.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 845fa01a2..d9e7f2590 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -136,5 +136,14 @@ argument_specs: - Mount options to use for the NFS mount. - Generic default is `hard,acl`. - Defaults depend on the specific platform detected by the role or defined explicitly. + required: false + type: str + + swap_path: + description: + - The path to the swap file. + - When this option is defined for a swap filesystem definition, it will create a swap file on an existing filesytem. + required: false + type: str # TODO: adding all possible options, otherwise they will fail the argument validation when used From 5072ec385a5a068b778cb6c36d194d23efad7f92 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 16:49:52 +0000 Subject: [PATCH 027/128] sap_storage_setup: fixed syntax typo --- roles/sap_storage_setup/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 94dfda919..4e94bb89a 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -80,7 +80,7 @@ {%- if fs.disk_size is defined and ('nfs' not in fs.filesystem_type | default(sap_storage_setup_local_filesystem_type)) - and fs.swap_path is not defined) -%} + and fs.swap_path is not defined -%} {%- for dev in av_dev -%} {%- if (fs.disk_size | string + 'GB') in (dev.value.size | regex_replace('(\.\d+\s*)', '')) From 12d02310a23b444d0bd94f1be8156ec7a04f96ee Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 8 May 2023 17:19:36 +0000 Subject: [PATCH 028/128] sap_storage_role: fix java_as to java_ci --- roles/sap_storage_setup/defaults/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index a02ddbd1b..ad890e6ba 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -48,8 +48,8 @@ sap_storage_setup_nfs_dirs_usr_sap: - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_abap_ers_instance_nr }}" nwas_abap_pas: - "{{ sap_storage_setup_sid }}/D{{ sap_storage_setup_nwas_abap_pas_instance_nr }}" - nwas_java_as: - - "{{ sap_storage_setup_sid }}/J{{ sap_storage_setup_nwas_java_as_instance_nr }}" + nwas_java_ci: + - "{{ sap_storage_setup_sid }}/J{{ sap_storage_setup_nwas_java_ci_instance_nr }}" nwas_java_ers: - "{{ sap_storage_setup_sid }}/ERS{{ sap_storage_setup_nwas_java_ers_instance_nr }}" nwas_java_scs: From f68aef38b4867bfa6186a58fbe96d61093ac0d0a Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 9 May 2023 13:51:43 +0000 Subject: [PATCH 029/128] sap_storage_setup: fixed nfs task logic --- .../configure_nfs_filesystems.yml | 19 +++++++++++++++---- roles/sap_storage_setup/tasks/main.yml | 2 ++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 4fc2cbfff..2495b23fc 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -99,7 +99,7 @@ - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directory as temporary mountpoint ansible.builtin.tempfile: state: directory - prefix: sap_storage_setup_nfs + prefix: sap_storage_setup_nfs_ register: sap_storage_setup_tmpnfs_register - name: SAP Storage Setup - ({{ nfs_item.name }}) Attach NFS host root for subdirectory verification/creation @@ -112,7 +112,6 @@ when: - sap_storage_setup_tmpnfs_register.path is defined - - name: SAP Storage Setup - ({{ nfs_item.name }}) Check if directories exist on NFS share ansible.builtin.stat: path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" @@ -144,16 +143,28 @@ # Tasks that are even run when something failed always: - - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount and directory + - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount ansible.posix.mount: path: "{{ sap_storage_setup_tmpnfs_register.path }}" state: absent when: - sap_storage_setup_tmpnfs_register.path is defined + # If the mount failed, it will not clean up the temp directory through the mount module. + - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount directory + ansible.builtin.file: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + state: absent + when: + - sap_storage_setup_tmpnfs_register.path is defined + # Block global parameters vars: - attach_item: "{{ sap_storage_setup_definition | selectattr('name', 'eq', nfs_item.name) }}" + attach_item: | + {{ sap_storage_setup_definition + | selectattr('name', 'eq', nfs_item.name) + | join('') + }} # convert this single element list to a simple dict ### End of block: temporary NFS mount for subdirectory creation diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 4e94bb89a..d6d0e0124 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -179,3 +179,5 @@ label: "{{ nfs_item.name }}" when: - nfs_item.nfs_path is defined + - nfs_item.nfs_server is defined or + sap_storage_setup_nfs_server is defined From 7a001edf96408610c4efac5946f9b9f48e3a247e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 9 May 2023 15:28:59 +0000 Subject: [PATCH 030/128] sap_storage_setup: renamed host_role variable to ...host_purpose --- .../configure_nfs_filesystems.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 2495b23fc..e5d7c4c7b 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -3,14 +3,14 @@ # defined in sap_storage_setup_definition. -# First, build a list of target mountpoints, based on the defined node role +# First, build a list of target mountpoints, based on the defined node purpose # and filesystems. # # Required parameters: # # Custom filesystem definition: sap_storage_setup_definition # /usr/sap subdir list: sap_storage_setup_nfs_dirs_usr_sap (default/main.yml) -# Host role: sap_storage_setup_host_role +# Host purpose: sap_storage_setup_host_purpose # Make sure paths and mountpoints are stripped from trailing '/'. # The '/' is added explicitly to the constructed paths. @@ -18,7 +18,7 @@ # Parameter: sap_storage_setup_related_directories # Param Type: list of dictionaries # -# Debug sample for a node of role 'nwas_abap_ascs': +# Debug sample for a node of purpose 'nwas_abap_ascs': # # sap_storage_setup_related_directories: # - dir_only: /DB1 @@ -65,8 +65,8 @@ ]) %} {%- endfor %} - {%- for role in host_role %} - {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[role] %} + {%- for role in host_purpose %} + {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[purpose] %} {%- set role_dirs = mount_list.extend([ { 'mount_src': nfs_item.nfs_path | regex_replace('/$', '') + '/' + dir, @@ -83,11 +83,11 @@ # Convert the parameter to a list, if it is not one already. # Careful with the whitespace control, spaces in front of a list variable # convert it to a string. - host_role: | - {% if sap_storage_setup_host_role | type_debug != 'list' -%} - {{ sap_storage_setup_host_role | split(' ') }} + host_purpose: | + {% if sap_storage_setup_host_purpose | type_debug != 'list' -%} + {{ sap_storage_setup_host_purpose | split(' ') }} {%- else -%} - {{ sap_storage_setup_host_role }} + {{ sap_storage_setup_host_purpose }} {%- endif %} From 63308c9a24eb1f7e15f918443ed4cec7dde59199 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 07:46:16 +0000 Subject: [PATCH 031/128] sap_storage_role: fixed typo --- .../tasks/generic_tasks/configure_nfs_filesystems.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index e5d7c4c7b..2eeffe673 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -65,9 +65,9 @@ ]) %} {%- endfor %} - {%- for role in host_purpose %} + {%- for purpose in host_purpose %} {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[purpose] %} - {%- set role_dirs = mount_list.extend([ + {%- set dirs = mount_list.extend([ { 'mount_src': nfs_item.nfs_path | regex_replace('/$', '') + '/' + dir, 'mountpoint': nfs_item.mountpoint | regex_replace('/$', '') + '/' + dir, From 8a88b3414e79d4cf21fb4ed115d988c435de2e5b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 07:51:44 +0000 Subject: [PATCH 032/128] sap_storage_setup: added github workflow for ansible-lint --- .../ansible-lint-sap_storage_setup.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/ansible-lint-sap_storage_setup.yml diff --git a/.github/workflows/ansible-lint-sap_storage_setup.yml b/.github/workflows/ansible-lint-sap_storage_setup.yml new file mode 100644 index 000000000..b2d15645c --- /dev/null +++ b/.github/workflows/ansible-lint-sap_storage_setup.yml @@ -0,0 +1,41 @@ +--- + +# Workflow for ansible-lint of a role + +name: ansible-lint of the role sap_storage_setup + +on: + push: + branches: + - main + - dev + paths: + - 'roles/sap_storage_setup/**' + pull_request: + branches: + - main + - dev + paths: + - 'roles/sap_storage_setup/**' + +jobs: + ansible-lint: + runs-on: ubuntu-latest + + steps: + - name: Check out the code + uses: actions/checkout@main + + - name: Set up Python 3 + uses: actions/setup-python@main + with: + python-version: '3.9' + + - name: Install test dependencies + run: | + pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible-compat==3.0.2 + + - name: Run ansible-lint + working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_storage_setup + run: ansible-lint From 7cecaee335800ece6cecf3b3077b0b3e06883268 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 08:45:14 +0000 Subject: [PATCH 033/128] sap_storage_setup: ansible-lint fixes --- .ansible-lint | 3 +- roles/sap_storage_setup/tasks/aws_main.yml | 8 +- roles/sap_storage_setup/tasks/az_main.yml | 64 +++--- .../tasks/az_tasks/prepare_storage.yml | 187 +++++++++--------- .../tasks/az_tasks/remove_storage.yml | 50 ++--- .../az_tasks/vmsizes/Standard_E4as_v4.yml | 21 -- .../tasks/az_tasks/vmsizes/Standard_M32ls.yml | 37 ---- .../tasks/az_tasks/vmsizes/Standard_M32ts.yml | 45 ----- .../tasks/az_tasks/vmsizes/Standard_M64ls.yml | 45 ----- .../configure_nfs_filesystems.yml | 129 ++++++------ .../tasks/generic_tasks/configure_swap.yml | 57 +++--- .../tasks/generic_tasks/prepare_storage.yml | 44 ----- .../tasks/generic_tasks/remove_storage.yml | 68 +++---- roles/sap_storage_setup/tasks/main.yml | 16 +- 14 files changed, 293 insertions(+), 481 deletions(-) delete mode 100644 roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_E4as_v4.yml delete mode 100644 roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ls.yml delete mode 100644 roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ts.yml delete mode 100644 roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M64ls.yml delete mode 100644 roles/sap_storage_setup/tasks/generic_tasks/prepare_storage.yml diff --git a/.ansible-lint b/.ansible-lint index 802618231..40b321754 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -17,9 +17,8 @@ exclude_paths: - roles/sap_hypervisor_node_preconfigure - roles/sap_install_media_detect #- roles/sap_netweaver_preconfigure - - roles/sap_storage_setup + #- roles/sap_storage_setup #- roles/sap_swpm - - roles/sap_storage - roles/sap_vm_preconfigure enable_list: diff --git a/roles/sap_storage_setup/tasks/aws_main.yml b/roles/sap_storage_setup/tasks/aws_main.yml index 559caa97f..43482cb7b 100644 --- a/roles/sap_storage_setup/tasks/aws_main.yml +++ b/roles/sap_storage_setup/tasks/aws_main.yml @@ -1,7 +1,7 @@ --- # AWS -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - AWS - shell: | - some AWS shit here - register: aws_imds_reg +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - AWS +# shell: | +# some AWS shit here +# register: aws_imds_reg diff --git a/roles/sap_storage_setup/tasks/az_main.yml b/roles/sap_storage_setup/tasks/az_main.yml index 6384ab07b..a33eccdd7 100644 --- a/roles/sap_storage_setup/tasks/az_main.yml +++ b/roles/sap_storage_setup/tasks/az_main.yml @@ -4,35 +4,35 @@ # Azure Specific Pre-Tasks ################ -# Create json format of IMDS -# Todo: Ansibilize this -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Create json format of IMDS - shell: | - curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_imds_url }}" | python3 -mjson.tool - register: az_imds_reg - args: - executable: /bin/bash -# If this fails, that means this VM is not Azure? - -- set_fact: - sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}" - -# Pull VMSize -# Todo: Ansibilize this -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Pull VMSize - shell: | - curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_vmsize_url }}" - register: az_vmsize_reg - args: - executable: /bin/bash - -- debug: - msg: - - "{{ az_vmsize_reg.stdout }}" - -- set_fact: - sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}" - -# Include vars depending on VM Size -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Load Variables for {{ sap_storage_az_vmsize }} - include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml" +## Create json format of IMDS +## Todo: Ansibilize this +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Create json format of IMDS +# shell: | +# curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_imds_url }}" | python3 -mjson.tool +# register: az_imds_reg +# args: +# executable: /bin/bash +## If this fails, that means this VM is not Azure? +# +#- set_fact: +# sap_storage_az_imds_json: "{{ az_imds_reg.stdout }}" +# +## Pull VMSize +## Todo: Ansibilize this +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Pull VMSize +# shell: | +# curl -H Metadata:true --noproxy "*" "{{ sap_storage_az_vmsize_url }}" +# register: az_vmsize_reg +# args: +# executable: /bin/bash +# +#- debug: +# msg: +# - "{{ az_vmsize_reg.stdout }}" +# +#- set_fact: +# sap_storage_az_vmsize: "{{ az_vmsize_reg.stdout }}" +# +## Include vars depending on VM Size +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - Load Variables for {{ sap_storage_az_vmsize }} +# include_vars: "{{ sap_storage_cloud_type }}_tasks/vmsizes/{{ sap_storage_az_vmsize }}.yml" diff --git a/roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml b/roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml index 524ffbe3e..f9c3d61b8 100644 --- a/roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml +++ b/roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml @@ -1,95 +1,94 @@ --- - -# Striped volume -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Striped - block: - - # Get LUNs from metadata - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata - shell: | - for i in {1..{{ item.value.numluns }}} - do - {{ item.value.vg }}${i}lun="{{ sap_storage_az_lun }} \ - `awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \ - /writeAcceleratorEnabled/ \ - { if (f && r ~ /{{ item.value.name }}${i}/) print r; f=0 }' \ - {{ sap_storage_az_imds_json }} \ - | grep lun | sed 's/[^0-9]*//g'`" - echo ${{ item.value.vg }}${i}lun - done - args: - executable: /bin/bash - register: pvs_reg - - - set_fact: - pvs_list: "{{ pvs_reg.stdout.split() }}" - - # Create Volume Group - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group Striped - lvg: - vg: "{{ item.value.vg }}" - pvs: "{{ pvs_list | join(',') }}" - force: yes - - # Create Logical Group - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - Striped - lvol: - vg: "{{ item.value.vg }}" - lv: "{{ item.value.lv }}" - size: 100%VG - opts: "-i{{ item.value.numluns }} -I{{ item.value.stripesize }}" - - when: - - "item.value.numluns != '1'" - -# Single volume -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Single Volume - block: - - # Get LUNs from metadata - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata - shell: | - {{ item.value.vg }}lun="{{ sap_storage_az_lun }} \ - `awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \ - /writeAcceleratorEnabled/ \ - { if (f && r ~ /{{ item.value.name }}/) print r; f=0 }' \ - {{ sap_storage_az_imds_json }} \ - | grep lun | sed 's/[^0-9]*//g'`" - echo ${{ item.value.vg }}lun - args: - executable: /bin/bash - register: pvs_reg - - - set_fact: - pvs_one: "{{ pvs_reg.stdout }}" - - # Create Volume Group - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group One - lvg: - vg: "{{ item.value.vg }}" - pvs: "{{ pvs_one }}" - force: yes - - # Create Logical Group - - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - One - lvol: - vg: "{{ item.value.vg }}" - lv: "{{ item.value.lv }}" - size: 100%VG - - when: - - "item.value.numluns == '1'" - -# Create Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Filesystem - filesystem: - fstype: xfs - dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}" - -# Mount Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Mount - mount: - path: "{{ item.value.directory }}" - fstype: xfs - src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}" - state: mounted +## Striped volume +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Striped +# block: +# +# # Get LUNs from metadata +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata +# shell: | +# for i in {1..{{ item.value.numluns }}} +# do +# {{ item.value.vg }}${i}lun="{{ sap_storage_az_lun }} \ +# `awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \ +# /writeAcceleratorEnabled/ \ +# { if (f && r ~ /{{ item.value.name }}${i}/) print r; f=0 }' \ +# {{ sap_storage_az_imds_json }} \ +# | grep lun | sed 's/[^0-9]*//g'`" +# echo ${{ item.value.vg }}${i}lun +# done +# args: +# executable: /bin/bash +# register: pvs_reg +# +# - set_fact: +# pvs_list: "{{ pvs_reg.stdout.split() }}" +# +# # Create Volume Group +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group Striped +# lvg: +# vg: "{{ item.value.vg }}" +# pvs: "{{ pvs_list | join(',') }}" +# force: yes +# +# # Create Logical Group +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - Striped +# lvol: +# vg: "{{ item.value.vg }}" +# lv: "{{ item.value.lv }}" +# size: 100%VG +# opts: "-i{{ item.value.numluns }} -I{{ item.value.stripesize }}" +# +# when: +# - "item.value.numluns != '1'" +# +## Single volume +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} - Single Volume +# block: +# +# # Get LUNs from metadata +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Get LUNs from metadata +# shell: | +# {{ item.value.vg }}lun="{{ sap_storage_az_lun }} \ +# `awk '/caching/ { r=""; f=1 } f { r = (r ? r ORS : "") $0 } \ +# /writeAcceleratorEnabled/ \ +# { if (f && r ~ /{{ item.value.name }}/) print r; f=0 }' \ +# {{ sap_storage_az_imds_json }} \ +# | grep lun | sed 's/[^0-9]*//g'`" +# echo ${{ item.value.vg }}lun +# args: +# executable: /bin/bash +# register: pvs_reg +# +# - set_fact: +# pvs_one: "{{ pvs_reg.stdout }}" +# +# # Create Volume Group +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Volume Group One +# lvg: +# vg: "{{ item.value.vg }}" +# pvs: "{{ pvs_one }}" +# force: yes +# +# # Create Logical Group +# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Logical Volume - One +# lvol: +# vg: "{{ item.value.vg }}" +# lv: "{{ item.value.lv }}" +# size: 100%VG +# +# when: +# - "item.value.numluns == '1'" +# +## Create Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Filesystem +# filesystem: +# fstype: xfs +# dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}" +# +## Mount Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ sap_storage_az_vmsize }} - {{ item.value.name }} Mount +# mount: +# path: "{{ item.value.directory }}" +# fstype: xfs +# src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}" +# state: mounted diff --git a/roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml b/roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml index 4c65c9a5e..3468ebb58 100644 --- a/roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml +++ b/roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml @@ -1,27 +1,27 @@ --- -# Unmount Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem - mount: - path: "{{ item.value.directory }}" - state: absent - -# Remove Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem - shell: | - /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} - -# Remove Logical Volume -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume - lvol: - lv: "{{ item.value.lv }}" - vg: "{{ item.value.vg }}" - state: absent - force: yes - -# Remove Volume Group -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group - lvg: - vg: "{{ item.value.vg }}" - state: absent - force: yes +## Unmount Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem +# mount: +# path: "{{ item.value.directory }}" +# state: absent +# +## Remove Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem +# shell: | +# /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} +# +## Remove Logical Volume +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume +# lvol: +# lv: "{{ item.value.lv }}" +# vg: "{{ item.value.vg }}" +# state: absent +# force: yes +# +## Remove Volume Group +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group +# lvg: +# vg: "{{ item.value.vg }}" +# state: absent +# force: yes diff --git a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_E4as_v4.yml b/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_E4as_v4.yml deleted file mode 100644 index 9573b7e13..000000000 --- a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_E4as_v4.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- - -# For Azure, the physical volumes are fetched dynamically thru metadata, so pv: '' - -sap_storage_dict: - usrsap: - name: 'usrsap' - directory: '/usr/sap' - vg: 'usrsapvg' - lv: 'usrsaplv' - pv: '' - numluns: '1' - stripesize: '' - sapmnt: - name: 'sapmnt' - directory: '/sapmnt' - vg: 'sapmntvg' - lv: 'sapmntlv' - pv: '' - numluns: '1' - stripesize: '' diff --git a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ls.yml b/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ls.yml deleted file mode 100644 index 8a7301cef..000000000 --- a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ls.yml +++ /dev/null @@ -1,37 +0,0 @@ ---- - -# For Azure, the physical volumes are fetched dynamically thru metadata, so pv: '' - -sap_storage_dict: - hanadata: - name: 'hanadata' - directory: '/hana/data' - vg: 'hanadatavg' - lv: 'hanadatalv' - pv: '' - numluns: '4' - stripesize: '256' - hanalog: - name: 'hanalog' - directory: '/hana/log' - vg: 'hanalogvg' - lv: 'hanaloglv' - pv: '' - numluns: '3' - stripesize: '64' - hanashared: - name: 'hanashared' - directory: '/hana/shared' - vg: 'hanasharedvg' - lv: 'hanasharedlv' - pv: '' - numluns: '1' - stripesize: '' - sapmnt: - name: 'sapmnt' - directory: '/sapmnt' - vg: 'sapmntvg' - lv: 'sapmntlv' - pv: '' - numluns: '1' - stripesize: '' diff --git a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ts.yml b/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ts.yml deleted file mode 100644 index 771db5061..000000000 --- a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M32ts.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- - -# For Azure, the physical volumes are fetched dynamically thru metadata, so pv: '' - -sap_storage_dict: - hanadata: - name: 'hanadata' - directory: '/hana/data' - vg: 'hanadatavg' - lv: 'hanadatalv' - pv: '' - numluns: '4' - stripesize: '256' - hanalog: - name: 'hanalog' - directory: '/hana/log' - vg: 'hanalogvg' - lv: 'hanaloglv' - pv: '' - numluns: '3' - stripesize: '64' - hanashared: - name: 'hanashared' - directory: '/hana/shared' - vg: 'hanasharedvg' - lv: 'hanasharedlv' - pv: '' - numluns: '1' - stripesize: '' - usrsap: - name: 'usrsap' - directory: '/usr/sap' - vg: 'usrsapvg' - lv: 'usrsaplv' - pv: '' - numluns: '1' - stripesize: '' - sapmnt: - name: 'sapmnt' - directory: '/sapmnt' - vg: 'sapmntvg' - lv: 'sapmntlv' - pv: '' - numluns: '1' - stripesize: '' diff --git a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M64ls.yml b/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M64ls.yml deleted file mode 100644 index 771db5061..000000000 --- a/roles/sap_storage_setup/tasks/az_tasks/vmsizes/Standard_M64ls.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- - -# For Azure, the physical volumes are fetched dynamically thru metadata, so pv: '' - -sap_storage_dict: - hanadata: - name: 'hanadata' - directory: '/hana/data' - vg: 'hanadatavg' - lv: 'hanadatalv' - pv: '' - numluns: '4' - stripesize: '256' - hanalog: - name: 'hanalog' - directory: '/hana/log' - vg: 'hanalogvg' - lv: 'hanaloglv' - pv: '' - numluns: '3' - stripesize: '64' - hanashared: - name: 'hanashared' - directory: '/hana/shared' - vg: 'hanasharedvg' - lv: 'hanasharedlv' - pv: '' - numluns: '1' - stripesize: '' - usrsap: - name: 'usrsap' - directory: '/usr/sap' - vg: 'usrsapvg' - lv: 'usrsaplv' - pv: '' - numluns: '1' - stripesize: '' - sapmnt: - name: 'sapmnt' - directory: '/sapmnt' - vg: 'sapmntvg' - lv: 'sapmntlv' - pv: '' - numluns: '1' - stripesize: '' diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 2eeffe673..7e1b22cf0 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -93,71 +93,7 @@ # Put temporary tasks inside a block which will make sure # that even in case of failure the temporary mountpoint will be removed -- name: SAP Storage Setup - Temporary steps that only run once - block: - - - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directory as temporary mountpoint - ansible.builtin.tempfile: - state: directory - prefix: sap_storage_setup_nfs_ - register: sap_storage_setup_tmpnfs_register - - - name: SAP Storage Setup - ({{ nfs_item.name }}) Attach NFS host root for subdirectory verification/creation - ansible.posix.mount: - path: "{{ sap_storage_setup_tmpnfs_register.path }}" - src: "{{ attach_item.nfs_server | default(sap_storage_setup_nfs_server) }}" - fstype: "{{ attach_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" - opts: "{{ attach_item.nfs_mount_options | default(sap_storage_setup_nfs_mount_options) }}" - state: mounted - when: - - sap_storage_setup_tmpnfs_register.path is defined - - - name: SAP Storage Setup - ({{ nfs_item.name }}) Check if directories exist on NFS share - ansible.builtin.stat: - path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" - register: sap_storage_setup_nfs_dir_register - loop: "{{ sap_storage_setup_related_directories }}" - loop_control: - loop_var: stat_item - label: "{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" - when: - - sap_storage_setup_tmpnfs_register.path is defined - - - - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directories if missing - ansible.builtin.file: - path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ dir_item.stat_item.mount_src }}{{ dir_item.stat_item.dir_only | default('') }}" - mode: '0777' - recurse: true - state: directory - loop: "{{ sap_storage_setup_nfs_dir_register.results }}" - loop_control: - loop_var: dir_item - label: "{{ dir_item.stat_item.mount_src }}{{ stat_item.dir_only | default('') }}" - when: - - sap_storage_setup_tmpnfs_register.path is defined - - dir_item.stat is defined - - not dir_item.stat.exists - - - # Tasks that are even run when something failed - always: - - - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount - ansible.posix.mount: - path: "{{ sap_storage_setup_tmpnfs_register.path }}" - state: absent - when: - - sap_storage_setup_tmpnfs_register.path is defined - - # If the mount failed, it will not clean up the temp directory through the mount module. - - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount directory - ansible.builtin.file: - path: "{{ sap_storage_setup_tmpnfs_register.path }}" - state: absent - when: - - sap_storage_setup_tmpnfs_register.path is defined - +- name: SAP Storage Setup - Temporary steps for NFS directory structure # Block global parameters vars: attach_item: | @@ -165,6 +101,69 @@ | selectattr('name', 'eq', nfs_item.name) | join('') }} # convert this single element list to a simple dict + block: + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directory as temporary mountpoint + ansible.builtin.tempfile: + state: directory + prefix: sap_storage_setup_nfs_ + register: sap_storage_setup_tmpnfs_register + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Attach NFS host root for subdirectory verification/creation + ansible.posix.mount: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + src: "{{ attach_item.nfs_server | default(sap_storage_setup_nfs_server) }}" + fstype: "{{ attach_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" + opts: "{{ attach_item.nfs_mount_options | default(sap_storage_setup_nfs_mount_options) }}" + state: mounted + when: + - sap_storage_setup_tmpnfs_register.path is defined + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Check if directories exist on NFS share + ansible.builtin.stat: + path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" + register: sap_storage_setup_nfs_dir_register + loop: "{{ sap_storage_setup_related_directories }}" + loop_control: + loop_var: stat_item + label: "{{ stat_item.mountpoint }}{{ stat_item.dir_only | default('') }}" + when: + - sap_storage_setup_tmpnfs_register.path is defined + + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Create directories if missing + ansible.builtin.file: + path: "{{ sap_storage_setup_tmpnfs_register.path }}{{ dir_item.stat_item.mount_src }}{{ dir_item.stat_item.dir_only | default('') }}" + mode: '0777' + recurse: true + state: directory + loop: "{{ sap_storage_setup_nfs_dir_register.results }}" + loop_control: + loop_var: dir_item + label: "{{ dir_item.stat_item.mount_src }}{{ stat_item.dir_only | default('') }}" + when: + - sap_storage_setup_tmpnfs_register.path is defined + - dir_item.stat is defined + - not dir_item.stat.exists + + + # Tasks that are even run when something failed + always: + + - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount + ansible.posix.mount: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + state: absent + when: + - sap_storage_setup_tmpnfs_register.path is defined + + # If the mount failed, it will not clean up the temp directory through the mount module. + - name: SAP Storage Setup - ({{ nfs_item.name }}) Remove temporary NFS mount directory + ansible.builtin.file: + path: "{{ sap_storage_setup_tmpnfs_register.path }}" + state: absent + when: + - sap_storage_setup_tmpnfs_register.path is defined ### End of block: temporary NFS mount for subdirectory creation diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml index aecb334b7..7fcf36df8 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml @@ -1,5 +1,25 @@ --- - name: SAP Storage Setup - Block handling the swap file + # Block parameters + vars: + # Select the swap_file entry from the storage definition + swap_file: | + {{- sap_storage_setup_definition + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") + | selectattr("swap_path", "defined") + | map('dict2items') + | flatten + | items2dict + -}} + + # Block conditional + when: | + sap_storage_setup_definition + | selectattr("swap_path", "defined") + | selectattr("filesystem_type", "defined") + | selectattr("filesystem_type", "==", "swap") + block: - name: SAP Storage Setup - (swap file) Check if file exists @@ -33,14 +53,19 @@ opts: defaults state: present + +### End of swapfile block + +- name: SAP Storage Setup - Block handling a swap partition filesystem # Block parameters vars: - # Select the swap_file entry from the storage definition - swap_file: | + # Select the swap volume entry from the storage definition. + # Difference to swapfile logic is the absence of the "swap_path" parameter in that entry. + swap_volume: | {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") - | selectattr("swap_path", "defined") + | selectattr("swap_path", "undefined") | map('dict2items') | flatten | items2dict @@ -49,19 +74,17 @@ # Block conditional when: | sap_storage_setup_definition - | selectattr("swap_path", "defined") + | selectattr("swap_path", "undefined") | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") -### End of swapfile block - -- name: SAP Storage Setup - Block handling a swap partition filesystem block: - name: SAP Storage Setup - Check if swap partition exists ansible.builtin.shell: | lsblk | grep SWAP || echo "no active swap" register: check_swap_partition + changed_when: false - name: SAP Storage Setup - Add fstab entry for swap ansible.posix.mount: @@ -78,24 +101,4 @@ - not ansible_check_mode - swap_volume.lvm_lv_name | default("lv_swap") not in check_swap_partition.stdout - # Block parameters - vars: - # Select the swap volume entry from the storage definition. - # Difference to swapfile logic is the absence of the "swap_path" parameter in that entry. - swap_volume: | - {{- sap_storage_setup_definition - | selectattr("filesystem_type", "defined") - | selectattr("filesystem_type", "==", "swap") - | selectattr("swap_path", "undefined") - | map('dict2items') - | flatten - | items2dict - -}} - - # Block conditional - when: | - sap_storage_setup_definition - | selectattr("swap_path", "undefined") - | selectattr("filesystem_type", "defined") - | selectattr("filesystem_type", "==", "swap") ### End of block: swap filesystem diff --git a/roles/sap_storage_setup/tasks/generic_tasks/prepare_storage.yml b/roles/sap_storage_setup/tasks/generic_tasks/prepare_storage.yml deleted file mode 100644 index 3c53959fc..000000000 --- a/roles/sap_storage_setup/tasks/generic_tasks/prepare_storage.yml +++ /dev/null @@ -1,44 +0,0 @@ ---- - -- debug: - msg: "{{ item }} " - -# Create Volume Group -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Volume Group One - lvg: - vg: "{{ item.value.vg }}" - pvs: "{{ item.value.pv }}" - force: yes - -# Create Logical Group - One -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - One - lvol: - vg: "{{ item.value.vg }}" - lv: "{{ item.value.lv }}" - size: 100%VG - when: - - "item.value.numluns == '1'" - -# Create Logical Group - Striped -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Logical Volume - Striped - lvol: - vg: "{{ item.value.vg }}" - lv: "{{ item.value.lv }}" - size: 100%VG - opts: "-i {{ item.value.numluns }} -I {{ item.value.stripesize }}" - when: - - "item.value.numluns != '1'" - -# Create Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Filesystem - filesystem: - fstype: xfs - dev: "/dev/{{ item.value.vg }}/{{ item.value.lv }}" - -# Mount Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Mount - mount: - path: "{{ item.value.directory }}" - fstype: xfs - src: "/dev/mapper/{{ item.value.vg }}-{{ item.value.lv }}" - state: mounted diff --git a/roles/sap_storage_setup/tasks/generic_tasks/remove_storage.yml b/roles/sap_storage_setup/tasks/generic_tasks/remove_storage.yml index a493213f8..571eb89f0 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/remove_storage.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/remove_storage.yml @@ -1,36 +1,36 @@ --- -# Unmount Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem - mount: - path: "{{ item.value.directory }}" - state: absent - -# INFO: -# this only works right using community Ansible Galaxy filesystem module -# only interested with native Ansible modules for now -# - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Filesystem -# filesystem: -# dev: "/dev/mapper/{{ item.value.vg }}/{{ item.value.lv }}" -# state: absent - -# Remove Filesystem -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem - shell: | - /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} - ignore_errors: yes - -# Remove Logical Volume -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume - lvol: - lv: "{{ item.value.lv }}" - vg: "{{ item.value.vg }}" - state: absent - force: yes - -# Remove Volume Group -- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group - lvg: - vg: "{{ item.value.vg }}" - state: absent - force: yes +## Unmount Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Unmount Filesystem +# mount: +# path: "{{ item.value.directory }}" +# state: absent +# +## INFO: +## this only works right using community Ansible Galaxy filesystem module +## only interested with native Ansible modules for now +## - name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Filesystem +## filesystem: +## dev: "/dev/mapper/{{ item.value.vg }}/{{ item.value.lv }}" +## state: absent +# +## Remove Filesystem +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Filesystem +# shell: | +# /sbin/wipefs --all -f /dev/mapper/{{ item.value.vg }}-{{ item.value.lv }} +# ignore_errors: yes +# +## Remove Logical Volume +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Logical Volume +# lvol: +# lv: "{{ item.value.lv }}" +# vg: "{{ item.value.vg }}" +# state: absent +# force: yes +# +## Remove Volume Group +#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - {{ item.value.name }} Remove Volume Group +# lvg: +# vg: "{{ item.value.vg }}" +# state: absent +# force: yes diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index d6d0e0124..6742da5f5 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -124,9 +124,9 @@ volume_name: "{{ map_item.lvm_lv_name | default('lv_' + map_item.name) }}" device: |- {% for entry in filesystem_device_map %} - {%- if map_item.name == entry.name -%} + {%- if map_item.name == entry.name -%} {{ entry.device }} - {%- endif %} + {%- endif %} {%- endfor %} pesize: "{{ map_item.lvm_vg_physical_extent_size | default('4') }}" pv_opts: "{{ map_item.lvm_pv_options | default('') }}" @@ -158,7 +158,8 @@ ################ - name: SAP Storage Setup - Configure Volume Groups and Logical Volumes - include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_local_filesystems.yml" when: - volume_map is defined - volume_map | length > 0 @@ -167,12 +168,15 @@ # NOTE: The conditional of this task requires Jinja2 version >= 2.11.0 (released January 2020) # Reference: https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.map - name: SAP Storage Setup - Configure swap - include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_swap.yml" + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_swap.yml" when: - - '"swap" in sap_storage_setup_definition | map(attribute="filesystem_type", default=sap_storage_setup_local_filesystem_type)' + - '"swap" in sap_storage_setup_definition + | map(attribute="filesystem_type", default=sap_storage_setup_local_filesystem_type)' - name: SAP Storage Setup - Configure NFS filesystems - include_tasks: "{{ sap_storage_setup_cloud_type }}_tasks/configure_nfs_filesystems.yml" + ansible.builtin.include_tasks: + file: "{{ sap_storage_setup_cloud_type }}_tasks/configure_nfs_filesystems.yml" loop: "{{ sap_storage_setup_definition }}" loop_control: loop_var: nfs_item From 57472f919bc806c156ea80aa512e28a2df3b2967 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 10:18:28 +0000 Subject: [PATCH 034/128] sap_storage_setup: file cleanup --- roles/sap_storage_setup/tasks/aws_main.yml | 7 ------- roles/sap_storage_setup/tasks/generic_main.yml | 2 -- roles/sap_storage_setup/tasks/platform_tasks/aws_main.yml | 2 ++ .../tasks/{ => platform_tasks}/az_main.yml | 2 ++ .../prepare_storage_az.yml} | 0 .../remove_storage_az.yml} | 0 6 files changed, 4 insertions(+), 9 deletions(-) delete mode 100644 roles/sap_storage_setup/tasks/aws_main.yml delete mode 100644 roles/sap_storage_setup/tasks/generic_main.yml create mode 100644 roles/sap_storage_setup/tasks/platform_tasks/aws_main.yml rename roles/sap_storage_setup/tasks/{ => platform_tasks}/az_main.yml (96%) rename roles/sap_storage_setup/tasks/{az_tasks/prepare_storage.yml => platform_tasks/prepare_storage_az.yml} (100%) rename roles/sap_storage_setup/tasks/{az_tasks/remove_storage.yml => platform_tasks/remove_storage_az.yml} (100%) diff --git a/roles/sap_storage_setup/tasks/aws_main.yml b/roles/sap_storage_setup/tasks/aws_main.yml deleted file mode 100644 index 43482cb7b..000000000 --- a/roles/sap_storage_setup/tasks/aws_main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- - -# AWS -#- name: SAP Storage Preparation - {{ sap_storage_cloud_type | upper }} - AWS -# shell: | -# some AWS shit here -# register: aws_imds_reg diff --git a/roles/sap_storage_setup/tasks/generic_main.yml b/roles/sap_storage_setup/tasks/generic_main.yml deleted file mode 100644 index 6f805d254..000000000 --- a/roles/sap_storage_setup/tasks/generic_main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# placeholder, if needed? diff --git a/roles/sap_storage_setup/tasks/platform_tasks/aws_main.yml b/roles/sap_storage_setup/tasks/platform_tasks/aws_main.yml new file mode 100644 index 000000000..4fe7915fb --- /dev/null +++ b/roles/sap_storage_setup/tasks/platform_tasks/aws_main.yml @@ -0,0 +1,2 @@ +--- +# Placeholder for AWS platform tasks diff --git a/roles/sap_storage_setup/tasks/az_main.yml b/roles/sap_storage_setup/tasks/platform_tasks/az_main.yml similarity index 96% rename from roles/sap_storage_setup/tasks/az_main.yml rename to roles/sap_storage_setup/tasks/platform_tasks/az_main.yml index a33eccdd7..e8ea809e2 100644 --- a/roles/sap_storage_setup/tasks/az_main.yml +++ b/roles/sap_storage_setup/tasks/platform_tasks/az_main.yml @@ -1,4 +1,6 @@ --- +# TODO: review and adjust for Azure platform + ################ # Azure Specific Pre-Tasks diff --git a/roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml b/roles/sap_storage_setup/tasks/platform_tasks/prepare_storage_az.yml similarity index 100% rename from roles/sap_storage_setup/tasks/az_tasks/prepare_storage.yml rename to roles/sap_storage_setup/tasks/platform_tasks/prepare_storage_az.yml diff --git a/roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml b/roles/sap_storage_setup/tasks/platform_tasks/remove_storage_az.yml similarity index 100% rename from roles/sap_storage_setup/tasks/az_tasks/remove_storage.yml rename to roles/sap_storage_setup/tasks/platform_tasks/remove_storage_az.yml From b278c69acca0776c834ea92373390af9337eb043 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 10:53:06 +0000 Subject: [PATCH 035/128] sap_storage_setup: consistent list conversion in nfs and swap logic --- .../tasks/generic_tasks/configure_swap.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml index 7fcf36df8..14bfe9293 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_swap.yml @@ -3,14 +3,13 @@ # Block parameters vars: # Select the swap_file entry from the storage definition + # and convert the single element list to a dict swap_file: | {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") | selectattr("swap_path", "defined") - | map('dict2items') - | flatten - | items2dict + | join('') -}} # Block conditional @@ -59,16 +58,15 @@ - name: SAP Storage Setup - Block handling a swap partition filesystem # Block parameters vars: - # Select the swap volume entry from the storage definition. + # Select the swap volume entry from the storage definition + # and convert the single element list to a dict. # Difference to swapfile logic is the absence of the "swap_path" parameter in that entry. swap_volume: | {{- sap_storage_setup_definition | selectattr("filesystem_type", "defined") | selectattr("filesystem_type", "==", "swap") | selectattr("swap_path", "undefined") - | map('dict2items') - | flatten - | items2dict + | join('') -}} # Block conditional From 4de1cffc128bb20e3961dac9f197e603e24d1f0b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 10:53:26 +0000 Subject: [PATCH 036/128] sap_swpm: ansible-lint fixes --- roles/sap_swpm/tasks/swpm.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/tasks/swpm.yml b/roles/sap_swpm/tasks/swpm.yml index d33f9edee..84d05ca44 100644 --- a/roles/sap_swpm/tasks/swpm.yml +++ b/roles/sap_swpm/tasks/swpm.yml @@ -7,7 +7,7 @@ ### Use of umask will enforce permissions 755 in /usr/sap etc (thereby resolving any shared NFS mount points initially attached with permissions 777) #- name: SAP SWPM - {{ sap_swpm_swpm_installation_header }} # ansible.builtin.shell: >- -# umask {{ sap_swpm_umask | default('022') }}; +# umask {{ sap_swpm_umask | default('022') }}; # ./sapinst \ # {{ sap_swpm_swpm_command_inifile }} \ # {{ sap_swpm_swpm_command_product_id }} \ @@ -61,7 +61,8 @@ # Use of umask will enforce permissions 755 in /usr/sap etc (thereby resolving any shared NFS mount points initially attached with permissions 777) # Reason for noqa: This command installs software, so it will change things - name: SAP SWPM - {{ sap_swpm_swpm_installation_header }} # noqa no-changed-when - ansible.builtin.shell: "{{ __sap_swpm_sapinst_command }}" + ansible.builtin.shell: | + {{ __sap_swpm_sapinst_command }} register: __sap_swpm_register_sapinst_async_job args: chdir: "{{ sap_swpm_sapinst_path }}" From 5f38719f1230a4409fc14ba8c5d5f82eb8f39b92 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 16:53:49 +0000 Subject: [PATCH 037/128] sap_storage_setup: changed purpose to type and added args --- roles/sap_storage_setup/defaults/main.yml | 6 +++--- .../sap_storage_setup/meta/argument_specs.yml | 16 +++++++++++++++- .../configure_nfs_filesystems.yml | 18 +++++++++--------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index ad890e6ba..90099feb3 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -1,9 +1,9 @@ --- -### not defaults, keeping these here for reference for now +# Inherit from global parameters, if they exist +sap_storage_setup_host_type: "{{ sap_host_type }}" +sap_storage_setup_sid: "{{ sap_system_sid }}" -#sap_storage_setup_sid: -# # The instance_nr parameters are required for references at the bottom. sap_storage_setup_nwas_abap_ascs_instance_nr: '00' sap_storage_setup_nwas_abap_ers_instance_nr: '10' diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index d9e7f2590..b2ab69241 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -146,4 +146,18 @@ argument_specs: required: false type: str -# TODO: adding all possible options, otherwise they will fail the argument validation when used + + sap_storage_setup_host_type: + description: + - The type of service the target system is going to be configured for. + - This can be a list of multiple types which apply to a single host. + - If not defined, the default will be inherited from the global parameter `sap_host_type`. + required: true + # type can be list or string, the code will convert it to a list + + sap_storage_setup_sid: + description: + - SID of the SAP service. + - If not defined, the default will be inherited from the global parameter `sap_system_sid`. + required: true + type: str diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 7e1b22cf0..0b07c257f 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -3,14 +3,14 @@ # defined in sap_storage_setup_definition. -# First, build a list of target mountpoints, based on the defined node purpose +# First, build a list of target mountpoints, based on the defined host type # and filesystems. # # Required parameters: # # Custom filesystem definition: sap_storage_setup_definition # /usr/sap subdir list: sap_storage_setup_nfs_dirs_usr_sap (default/main.yml) -# Host purpose: sap_storage_setup_host_purpose +# Host type: sap_storage_setup_host_type # Make sure paths and mountpoints are stripped from trailing '/'. # The '/' is added explicitly to the constructed paths. @@ -18,7 +18,7 @@ # Parameter: sap_storage_setup_related_directories # Param Type: list of dictionaries # -# Debug sample for a node of purpose 'nwas_abap_ascs': +# Debug sample for a node of host type 'nwas_abap_ascs': # # sap_storage_setup_related_directories: # - dir_only: /DB1 @@ -65,8 +65,8 @@ ]) %} {%- endfor %} - {%- for purpose in host_purpose %} - {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[purpose] %} + {%- for type in host_type %} + {%- for dir in sap_storage_setup_nfs_dirs_usr_sap[type] %} {%- set dirs = mount_list.extend([ { 'mount_src': nfs_item.nfs_path | regex_replace('/$', '') + '/' + dir, @@ -83,11 +83,11 @@ # Convert the parameter to a list, if it is not one already. # Careful with the whitespace control, spaces in front of a list variable # convert it to a string. - host_purpose: | - {% if sap_storage_setup_host_purpose | type_debug != 'list' -%} - {{ sap_storage_setup_host_purpose | split(' ') }} + host_type: | + {% if sap_storage_setup_host_type | type_debug != 'list' -%} + {{ sap_storage_setup_host_type | split(' ') }} {%- else -%} - {{ sap_storage_setup_host_purpose }} + {{ sap_storage_setup_host_type }} {%- endif %} From ed672297b1e6339b8dad22dcd8eda049271de3a1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 21:18:23 +0000 Subject: [PATCH 038/128] sap_ha_pacemaker_cluster: adjusted host type logic and vars include --- .../defaults/main.yml | 17 ++++++--- .../meta/argument_specs.yml | 28 ++++++++++----- .../tasks/ascertain_sap_landscape.yml | 35 +++++++++++++++---- .../tasks/include_vars_netweaver.yml | 13 +++++++ .../tasks/include_vars_saphana.yml | 18 ++++++---- .../tasks/validate_input_parameters.yml | 27 ++++++++++++-- ..._scaleout.yml => hana_scaleout_common.yml} | 0 ...na_scaleup.yml => hana_scaleup_common.yml} | 0 .../{sapnetweaver.yml => nwas_common.yml} | 0 9 files changed, 108 insertions(+), 30 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml rename roles/sap_ha_pacemaker_cluster/vars/{saphana_scaleout.yml => hana_scaleout_common.yml} (100%) rename roles/sap_ha_pacemaker_cluster/vars/{saphana_scaleup.yml => hana_scaleup_common.yml} (100%) rename roles/sap_ha_pacemaker_cluster/vars/{sapnetweaver.yml => nwas_common.yml} (100%) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 087d545e7..d20bcd55c 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -18,9 +18,9 @@ sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluste # Inherit SAP common parameters sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes }}" -sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid }}" -sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid }}" +sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" +sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('00') }}" +sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number: "{{ sap_swpm_pas_instance_nr }}" @@ -41,8 +41,15 @@ sap_ha_pacemaker_cluster_resource_defaults: # The type of SAP landscape and multi-node replication # TODO: Type definitions and feature support -# TODO: Implement all types - # saphana_scaleup, saphana_scaleout, sapnetweaver_abap_ascs_ers, sapnetweaver_abap_pas_aas, sapnetweaver_java_scs_ers -sap_ha_pacemaker_cluster_sap_type: saphana_scaleup +# TODO: Implement all types +# hana_scaleup_costopt (not yet) +# hana_scaleup_perf (default) +# hana_scaleup_per_dr (not yet) +# hana_scaleout (not yet) +# nwas_abap_ascs_ers +# nwas_abap_pas_aas +# nwas_java_scs_ers (maybe) +sap_ha_pacemaker_cluster_sap_host_type: "{{ sap_host_type | default('hana_scaleup_perf') }}" sap_ha_pacemaker_cluster_replication_type: none # Optional parameters to customize HANA resources diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 793a009ac..1b5b33336 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -207,14 +207,18 @@ argument_specs: required: false type: dict - sap_ha_pacemaker_cluster_sap_type: + sap_ha_pacemaker_cluster_sap_host_type: choices: - - saphana_scaleup - - saphana_scaleout - default: saphana_scaleup +# - hana_scaleup_costopt + - hana_scaleup_perf +# - hana_scaleup_perf_dr +# - hana_scaleout + - nwas_abap_ascs_ers + - nwas_abap_pas_aas +# - nwas_java_scs_ers + default: hana_scaleup_perf description: - The SAP landscape to be installed. - - _Currently only SAP HANA scale-up is supported_ required: false type: str @@ -291,9 +295,9 @@ argument_specs: sap_hana_sid: description: - - The SAP System ID of the instance that will be configured in the cluster. - - The SAP SID must follow SAP specifications - see SAP Note 1979280. - required: true + - The SAP HANA SID of the instance that will be configured in the cluster. + - The SID must follow SAP specifications - see SAP Note 1979280. + required: false type: str sap_hana_vip: @@ -308,3 +312,11 @@ argument_specs: required: true type: dict required_one_of: [{ primary, main, rw, promoted }] + +# TODO: review the global parameter vs. role parameter logic and compatibility of combination of HANA + NW +# sap_system_sid: +# description: +# - The SID of the SAP Netweaver system that will be configured in the cluster. +# - The SID must follow SAP specifications - see SAP Note 1979280. +# required: false +# type: str diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index e85f0fada..7dad7c790 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -10,12 +10,33 @@ # 2 nodes are also valid for other scenarios. # TODO: collect possible rules for target landscapes -# Currently only SAP HANA 2-node scale-up is supported. -- name: "SAP HA Prepare Pacemaker - Set landscape to scale-up if target is 2 nodes" - when: - - ansible_play_hosts|length == 2 +- name: SAP HA Prepare Pacemaker - Fail if there is only 1 target host + ansible.builtin.assert: + that: + - ansible_play_hosts | length > 1 + +- name: SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list ansible.builtin.set_fact: - sap_ha_pacemaker_cluster_sap_type: saphana_scaleup + sap_ha_pacemaker_cluster_sap_host_type: | + {% if sap_ha_pacemaker_cluster_sap_host_type | type_debug != 'list' -%} + {{ sap_ha_pacemaker_cluster_sap_host_type | split(' ') }} + {%- else -%} + {{ sap_ha_pacemaker_cluster_sap_host_type }} + {%- endif %} + +- name: SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used + ansible.builtin.assert: + that: + - ansible_play_hosts | length == 2 + when: + - "'hana_scaleup' in sap_ha_pacemaker_cluster_sap_host_type[0]" -- name: "SAP HA Prepare Pacemaker - Include HANA specific variables" - ansible.builtin.import_tasks: include_vars_saphana.yml +- name: SAP HA Prepare Pacemaker - Include HANA specific variables + ansible.builtin.include_tasks: include_vars_saphana.yml + when: + - "'hana' in sap_ha_pacemaker_cluster_sap_host_type[0]" + +- name: SAP HA Prepare Pacemaker - Include NETWEAVER specific variables + ansible.builtin.include_tasks: include_vars_netweaver.yml + when: + - "'nwas' in sap_ha_pacemaker_cluster_sap_host_type[0]" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml new file mode 100644 index 000000000..644b28b8f --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml @@ -0,0 +1,13 @@ +--- +- name: SAP HA Prepare Pacemaker - Include NETWEAVER landscape specific variables + ansible.builtin.include_vars: "{{ role_path }}/vars/{{ include_item }}.yml" + loop: "{{ __sap_host_type_list | flatten }}" + loop_control: + loop_var: include_item + label: "{{ include_item }}.yml" + vars: + __sap_host_type_list: + - nwas_common + - "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + when: + - "(role_path + '/vars/' + include_item + '.yml') is file" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml index 730bf774d..cef3489d3 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml @@ -1,9 +1,13 @@ --- -- name: "SAP HA Prepare Pacemaker - Include HANA landscape specific variables" - when: __sap_ha_pacemaker_cluster_vars_file is file - ansible.builtin.include_vars: "{{ __sap_ha_pacemaker_cluster_vars_file }}" - loop: - - "{{ sap_ha_pacemaker_cluster_sap_type }}.yml" - - "{{ sap_ha_pacemaker_cluster_replication_type }}.yml" +- name: SAP HA Prepare Pacemaker - Include HANA landscape specific variables + ansible.builtin.include_vars: "{{ role_path }}/vars/{{ include_item }}.yml" + loop: "{{ __sap_host_type_list | flatten }}" + loop_control: + loop_var: include_item + label: "{{ include_item }}.yml" vars: - __sap_ha_pacemaker_cluster_vars_file: "{{ role_path }}/vars/{{ item }}" + __sap_host_type_list: + - hana_scaleup_common + - "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + when: + - "(role_path + '/vars/' + include_item + '.yml') is file" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index 4c5cce2a8..bdf95d870 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -1,9 +1,30 @@ --- # The SAP ID must follow a strict format and not use reserved special values # TODO: This check may be better placed in a SAP role earlier in the chain... -- name: "SAP HA Prepare Pacemaker - Validate SAP System ID" +- name: "SAP HA Prepare Pacemaker - Validate SAP System ID (SAP HANA)" ansible.builtin.assert: that: - - sap_ha_pacemaker_cluster_hana_sid is defined - - sap_ha_pacemaker_cluster_hana_sid|length == 3 + - sap_ha_pacemaker_cluster_hana_sid | length == 3 - sap_ha_pacemaker_cluster_hana_sid not in __sap_sid_prohibited + when: + - "'hana' in sap_ha_pacemaker_cluster_sap_host_type" + - sap_ha_pacemaker_cluster_hana_sid is defined + - sap_ha_pacemaker_cluster_hana_sid | length > 0 + +- name: "SAP HA Prepare Pacemaker - Validate SAP System ID (SAP Netweaver)" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_netweaver_sid | length == 3 + - sap_ha_pacemaker_cluster_netweaver_sid not in __sap_sid_prohibited + when: + - "'nwas' in sap_ha_pacemaker_cluster_sap_host_type" + - sap_ha_pacemaker_cluster_netweaver_sid is defined + - sap_ha_pacemaker_cluster_netweaver_sid | length > 0 + +- name: "SAP HA Prepare Pacemaker - Verify that a SID is defined" + ansible.builtin.assert: + that: + - sap_ha_pacemaker_cluster_hana_sid is defined + or sap_ha_pacemaker_cluster_netweaver_sid is defined + - sap_ha_pacemaker_cluster_hana_sid | length > 0 + or sap_ha_pacemaker_cluster_netweaver_sid | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/vars/saphana_scaleout.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml similarity index 100% rename from roles/sap_ha_pacemaker_cluster/vars/saphana_scaleout.yml rename to roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml diff --git a/roles/sap_ha_pacemaker_cluster/vars/saphana_scaleup.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml similarity index 100% rename from roles/sap_ha_pacemaker_cluster/vars/saphana_scaleup.yml rename to roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml diff --git a/roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml similarity index 100% rename from roles/sap_ha_pacemaker_cluster/vars/sapnetweaver.yml rename to roles/sap_ha_pacemaker_cluster/vars/nwas_common.yml From 342708f3cc6416960f3474d82ad159112cc83283 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 10 May 2023 21:54:34 +0000 Subject: [PATCH 039/128] sap_ha_pacemaker_cluster: adjusted separation logic of different host types --- .../tasks/ascertain_sap_landscape.yml | 6 ++-- .../tasks/construct_vars_hana_common.yml | 30 +++++++++---------- ...vars_saphana.yml => include_vars_hana.yml} | 0 roles/sap_ha_pacemaker_cluster/tasks/main.yml | 29 +++++++++++------- 4 files changed, 37 insertions(+), 28 deletions(-) rename roles/sap_ha_pacemaker_cluster/tasks/{include_vars_saphana.yml => include_vars_hana.yml} (100%) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index 7dad7c790..179545b7b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -32,11 +32,13 @@ - "'hana_scaleup' in sap_ha_pacemaker_cluster_sap_host_type[0]" - name: SAP HA Prepare Pacemaker - Include HANA specific variables - ansible.builtin.include_tasks: include_vars_saphana.yml + ansible.builtin.include_tasks: + file: include_vars_hana.yml when: - "'hana' in sap_ha_pacemaker_cluster_sap_host_type[0]" - name: SAP HA Prepare Pacemaker - Include NETWEAVER specific variables - ansible.builtin.include_tasks: include_vars_netweaver.yml + ansible.builtin.include_tasks: + file: include_vars_netweaver.yml when: - "'nwas' in sap_ha_pacemaker_cluster_sap_host_type[0]" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index 1d6fbc339..feb558a7a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -11,9 +11,9 @@ - name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA Topology" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_saphana_topology] }}" + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana_topology] }}" vars: - __resource_saphana_topology: + __resource_hana_topology: id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}" agent: "ocf:heartbeat:SAPHanaTopology" instance_attrs: @@ -38,13 +38,13 @@ - name: timeout value: 600 when: - - __resource_saphana_topology.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_hana_topology.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) - name: "SAP HA Prepare Pacemaker - Add resource: SAP HANA DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_saphana] }}" + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_hana] }}" vars: - __resource_saphana: + __resource_hana: id: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}" agent: "ocf:heartbeat:{{ sap_ha_pacemaker_cluster_ra_hana }}" instance_attrs: @@ -93,13 +93,13 @@ - name: timeout value: 3600 when: - - __resource_saphana.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_hana.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) - name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA Topology" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_saphana_topology] }}" + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana_topology] }}" vars: - __clone_saphana_topology: + __clone_hana_topology: resource_id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}" meta_attrs: - attrs: @@ -110,13 +110,13 @@ - name: interleave value: "true" when: - - __clone_saphana_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + - __clone_hana_topology.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - name: "SAP HA Prepare Pacemaker - Add resource clone: SAP HANA DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_saphana] }}" + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_hana] }}" vars: - __clone_saphana: + __clone_hana: resource_id: "{{ sap_ha_pacemaker_cluster_hana_resource_name }}" meta_attrs: - attrs: @@ -129,14 +129,14 @@ - name: promotable value: "true" when: - - __clone_saphana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) + - __clone_hana.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) # First start Topology, then HANA (automatically stops in reverse order) - name: "SAP HA Prepare Pacemaker - Add order constraint: Topology starts before DB" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_saphana_topology] }}" + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_hana_topology] }}" vars: - __constraint_order_saphana_topology: + __constraint_order_hana_topology: resource_first: id: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_clone_name }}" action: start @@ -147,4 +147,4 @@ - name: symmetrical value: "false" when: - - __constraint_order_saphana_topology.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - __constraint_order_hana_topology.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml similarity index 100% rename from roles/sap_ha_pacemaker_cluster/tasks/include_vars_saphana.yml rename to roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index dffe8eb6e..88dbc7a42 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -44,28 +44,35 @@ - name: "SAP HA Prepare Pacemaker - Include variable construction for VIP resources" ansible.builtin.import_tasks: include_construct_vip_resources.yml +# Include construction task files for different scenarios. + - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA common" - when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' or sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' - ansible.builtin.import_tasks: construct_vars_hana_common.yml + ansible.builtin.include_tasks: + file: construct_vars_hana_common.yml + when: + - "'hana' in sap_ha_pacemaker_cluster_sap_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-up" - when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' ansible.builtin.include_tasks: file: construct_vars_hana_scaleup.yml - -#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-out" -# when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' -# ansible.builtin.include_tasks: -# file: construct_vars_hana_scaleout.yml + when: + - "'hana_scaleup' in sap_ha_pacemaker_cluster_sap_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver common" - when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_ascs_ers' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_pas_aas' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' - ansible.builtin.import_tasks: construct_vars_netweaver_common.yml + ansible.builtin.include_tasks: + file: construct_vars_netweaver_common.yml + when: + - "'nwas_abap' in sap_ha_pacemaker_cluster_sap_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP ASCS/ERS" - when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_ascs_ers' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' ansible.builtin.include_tasks: file: construct_vars_netweaver_abap_ascs_ers.yml + loop: "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + loop_control: + loop_var: nwas_constr_item + when: + - "'nwas_abap_ascs' in nwas_constr_item" + #- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" # when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_pas_aas' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' From 4cc6791754fac1625805890d60a3e5d4c1e622e1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 07:18:38 +0000 Subject: [PATCH 040/128] sap_ha_pacemaker_cluster: correct host_type variable name to by consistent with the storage role --- roles/sap_ha_pacemaker_cluster/defaults/main.yml | 2 +- .../meta/argument_specs.yml | 2 +- .../tasks/ascertain_sap_landscape.yml | 14 +++++++------- .../tasks/include_vars_hana.yml | 6 +++--- .../tasks/include_vars_netweaver.yml | 6 +++--- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 8 ++++---- .../tasks/validate_input_parameters.yml | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index d20bcd55c..875008152 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -49,7 +49,7 @@ sap_ha_pacemaker_cluster_resource_defaults: # nwas_abap_ascs_ers # nwas_abap_pas_aas # nwas_java_scs_ers (maybe) -sap_ha_pacemaker_cluster_sap_host_type: "{{ sap_host_type | default('hana_scaleup_perf') }}" +sap_ha_pacemaker_cluster_host_type: "{{ sap_host_type | default('hana_scaleup_perf') }}" sap_ha_pacemaker_cluster_replication_type: none # Optional parameters to customize HANA resources diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 1b5b33336..941e9e933 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -207,7 +207,7 @@ argument_specs: required: false type: dict - sap_ha_pacemaker_cluster_sap_host_type: + sap_ha_pacemaker_cluster_host_type: choices: # - hana_scaleup_costopt - hana_scaleup_perf diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml index 179545b7b..aa4afc90b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/ascertain_sap_landscape.yml @@ -17,11 +17,11 @@ - name: SAP HA Prepare Pacemaker - Make sure the 'type' parameter is a list ansible.builtin.set_fact: - sap_ha_pacemaker_cluster_sap_host_type: | - {% if sap_ha_pacemaker_cluster_sap_host_type | type_debug != 'list' -%} - {{ sap_ha_pacemaker_cluster_sap_host_type | split(' ') }} + sap_ha_pacemaker_cluster_host_type: | + {% if sap_ha_pacemaker_cluster_host_type | type_debug != 'list' -%} + {{ sap_ha_pacemaker_cluster_host_type | split(' ') }} {%- else -%} - {{ sap_ha_pacemaker_cluster_sap_host_type }} + {{ sap_ha_pacemaker_cluster_host_type }} {%- endif %} - name: SAP HA Prepare Pacemaker - Verify that for 'hana_scaleup' types 2 nodes are used @@ -29,16 +29,16 @@ that: - ansible_play_hosts | length == 2 when: - - "'hana_scaleup' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" - name: SAP HA Prepare Pacemaker - Include HANA specific variables ansible.builtin.include_tasks: file: include_vars_hana.yml when: - - "'hana' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'hana' in sap_ha_pacemaker_cluster_host_type[0]" - name: SAP HA Prepare Pacemaker - Include NETWEAVER specific variables ansible.builtin.include_tasks: file: include_vars_netweaver.yml when: - - "'nwas' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'nwas' in sap_ha_pacemaker_cluster_host_type[0]" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml index cef3489d3..ed2f2f41b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_hana.yml @@ -1,13 +1,13 @@ --- - name: SAP HA Prepare Pacemaker - Include HANA landscape specific variables ansible.builtin.include_vars: "{{ role_path }}/vars/{{ include_item }}.yml" - loop: "{{ __sap_host_type_list | flatten }}" + loop: "{{ __host_type_list | flatten }}" loop_control: loop_var: include_item label: "{{ include_item }}.yml" vars: - __sap_host_type_list: + __host_type_list: - hana_scaleup_common - - "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + - "{{ sap_ha_pacemaker_cluster_host_type }}" when: - "(role_path + '/vars/' + include_item + '.yml') is file" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml index 644b28b8f..7ffa92e8b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_vars_netweaver.yml @@ -1,13 +1,13 @@ --- - name: SAP HA Prepare Pacemaker - Include NETWEAVER landscape specific variables ansible.builtin.include_vars: "{{ role_path }}/vars/{{ include_item }}.yml" - loop: "{{ __sap_host_type_list | flatten }}" + loop: "{{ __host_type_list | flatten }}" loop_control: loop_var: include_item label: "{{ include_item }}.yml" vars: - __sap_host_type_list: + __host_type_list: - nwas_common - - "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + - "{{ sap_ha_pacemaker_cluster_host_type }}" when: - "(role_path + '/vars/' + include_item + '.yml') is file" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 88dbc7a42..4e34c50a0 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -50,24 +50,24 @@ ansible.builtin.include_tasks: file: construct_vars_hana_common.yml when: - - "'hana' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'hana' in sap_ha_pacemaker_cluster_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP HANA Scale-up" ansible.builtin.include_tasks: file: construct_vars_hana_scaleup.yml when: - - "'hana_scaleup' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver common" ansible.builtin.include_tasks: file: construct_vars_netweaver_common.yml when: - - "'nwas_abap' in sap_ha_pacemaker_cluster_sap_host_type[0]" + - "'nwas_abap' in sap_ha_pacemaker_cluster_host_type[0]" - name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP ASCS/ERS" ansible.builtin.include_tasks: file: construct_vars_netweaver_abap_ascs_ers.yml - loop: "{{ sap_ha_pacemaker_cluster_sap_host_type }}" + loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: loop_var: nwas_constr_item when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml index bdf95d870..2ae0ed659 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/validate_input_parameters.yml @@ -7,7 +7,7 @@ - sap_ha_pacemaker_cluster_hana_sid | length == 3 - sap_ha_pacemaker_cluster_hana_sid not in __sap_sid_prohibited when: - - "'hana' in sap_ha_pacemaker_cluster_sap_host_type" + - "'hana' in sap_ha_pacemaker_cluster_host_type" - sap_ha_pacemaker_cluster_hana_sid is defined - sap_ha_pacemaker_cluster_hana_sid | length > 0 @@ -17,7 +17,7 @@ - sap_ha_pacemaker_cluster_netweaver_sid | length == 3 - sap_ha_pacemaker_cluster_netweaver_sid not in __sap_sid_prohibited when: - - "'nwas' in sap_ha_pacemaker_cluster_sap_host_type" + - "'nwas' in sap_ha_pacemaker_cluster_host_type" - sap_ha_pacemaker_cluster_netweaver_sid is defined - sap_ha_pacemaker_cluster_netweaver_sid | length > 0 From f56cab5149a1d99e28ce1116ca9e0f25a5c9b56c Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 15:11:15 +0000 Subject: [PATCH 041/128] sap_ha_pacemaker_cluster: nwas common and ascs/ers filesystem resource tasks made flexible --- .../defaults/main.yml | 39 ++++-- ...construct_vars_netweaver_abap_ascs_ers.yml | 116 +++++++++------- .../tasks/construct_vars_netweaver_common.yml | 129 ++++++------------ roles/sap_ha_pacemaker_cluster/tasks/main.yml | 4 +- 4 files changed, 138 insertions(+), 150 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 875008152..d604e7507 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -16,10 +16,16 @@ sap_ha_pacemaker_cluster_cluster_name: "{{ ha_cluster_cluster_name | default('my sap_ha_pacemaker_cluster_create_config_varfile: false sap_ha_pacemaker_cluster_create_config_dest: "{{ sap_ha_pacemaker_cluster_cluster_name }}_resource_config.yml" -# Inherit SAP common parameters -sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_hana_cluster_nodes }}" +# Inherit SAP common (global synonyms) parameters +sap_ha_pacemaker_cluster_cluster_nodes: "{{ sap_ha_cluster_nodes | default(sap_hana_cluster_nodes) }}" sap_ha_pacemaker_cluster_hana_sid: "{{ sap_hana_sid | default('') }}" sap_ha_pacemaker_cluster_hana_instance_number: "{{ sap_hana_instance_number | default('00') }}" + +sap_ha_pacemaker_cluster_storage_definition: "{{ sap_storage_definition | default([]) }}" +sap_ha_pacemaker_cluster_storage_nfs_filesytem_type: nfs4 +sap_ha_pacemaker_cluster_storage_nfs_mount_options: hard,acl +sap_ha_pacemaker_cluster_storage_nfs_server: "{{ sap_storage_nfs_server | default('') }}" + sap_ha_pacemaker_cluster_netweaver_sid: "{{ sap_swpm_sid | default('') }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number: "{{ sap_swpm_ascs_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number: "{{ sap_swpm_ers_instance_nr }}" @@ -28,6 +34,18 @@ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number: "{{ sap_swpm_aas_in sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number: "{{ sap_swpm_java_scs_instance_nr }}" sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number: "{{ sap_swpm_java_ers_instance_nr }}" +#sap_ha_pacemaker_cluster_netweaver_common_filesystems: +# - /sapmnt +# - /usr/sap/trans +# - "/usr/sap/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS" + +# The following directories are appended to the 'nfs_path' of the '/usr/sap' storage +# definition. +# Therefore, the /usr/sap prefix must be left out of the listed path items. +sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems: + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ASCS{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_sid }}/ERS{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" + # Make sure that there is always the default fed into the included role sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-all @@ -78,29 +96,32 @@ sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" +sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: true + # SAP NetWeaver common - Resource IDs (names) as convenience parameters. # - /sapmnt # - /usr/sap/trans # - /usr/sap/<>/SYS -sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesytem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesytem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesytem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" + +sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" # SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/ASCS<> # - /usr/sap/<>/ERS<> -sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesytem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" -sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesytem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/D<> -#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesytem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesytem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" # SAP NetWeaver JAVA SCS/ERS - Resource IDs (names) as convenience parameters. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 4eee4650e..ccb1220d5 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -10,25 +10,31 @@ # defined in user input variables. Conflicting user input should take precedence. -- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ASCS<>" +- name: "SAP HA Prepare Pacemaker - Add filesystem resources for ASCS/ERS to resource definition" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" + id: |- + {%- if '/ASCS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name %} + {%- elif '/ERS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name %} + {%- endif -%} + {{ idname }} agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_host_mount_path }}" + value: "{{ __nfs_server }}/{{ __nfs_path }}/{{ __mountpoint }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_local_mount_path }}" + value: "/usr/sap/{{ __mountpoint }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_fstype }}" + value: "{{ __fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_options_string }}" + value: "{{ __mount_opts }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_resource_filesystem_force_unmount }}" operations: - action: start attrs: @@ -48,49 +54,59 @@ value: 200 - name: timeout value: 40 - when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) -- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ERS<>" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" - vars: - __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - agent: "ocf:heartbeat:Filesystem" - instance_attrs: - - attrs: - - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_host_mount_path }}" - - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_local_mount_path }}" - - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_fstype }}" - - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_options_string }}" - - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_force_unmount }}" - operations: - - action: start - attrs: - - name: interval - value: 0 - - name: timeout - value: 60 - - action: stop - attrs: - - name: interval - value: 0 - - name: timeout - value: 120 - - action: monitor - attrs: - - name: interval - value: 200 - - name: timeout - value: 40 + # Format input variables to make above construction code more readable. + # Method: + # - parse sap_ha_pacemaker_cluster_storage_definition + # - check if a mounpoint is defined (filters out swap) + # - if the needed parameter is defined, take it + # - otherwise, take the value from a default parameter + + __fstype: |- + {% for def in sap_ha_pacemaker_cluster_storage_definition -%} + {% if def.mountpoint is defined and '/usr/sap' == def.mountpoint | regex_replace('/$', '') -%} + {% if def.nfs_filesystem_type is defined -%} + {{ def.nfs_filesystem_type }} + {%- else -%} + {{ sap_ha_pacemaker_cluster_storage_nfs_filesytem_type }} + {%- endif %} + {%- endif %} + {%- endfor %} + __mount_opts: |- + {% for def in sap_ha_pacemaker_cluster_storage_definition -%} + {% if def.mountpoint is defined and '/usr/sap' == def.mountpoint | regex_replace('/$', '') -%} + {% if def.nfs_mount_options is defined -%} + {{ def.nfs_mount_options }} + {%- else -%} + {{ sap_ha_pacemaker_cluster_storage_nfs_mount_options }} + {%- endif %} + {%- endif %} + {%- endfor %} + __nfs_path: |- + {% for def in sap_ha_pacemaker_cluster_storage_definition -%} + {% if def.mountpoint is defined and '/usr/sap' == def.mountpoint | regex_replace('/$', '') -%} + {{ def.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }} + {%- endif %} + {%- endfor %} + __nfs_server: |- + {% for def in sap_ha_pacemaker_cluster_storage_definition -%} + {% if def.mountpoint is defined and '/usr/sap' == def.mountpoint | regex_replace('/$', '') -%} + {% if def.nfs_server is defined -%} + {{ def.nfs_server | regex_replace('/$', '') }} + {%- else -%} + {{ sap_ha_pacemaker_cluster_storage_nfs_server | regex_replace('/$', '') }} + {%- endif %} + {%- endif %} + {%- endfor %} + __mountpoint: "{{ fsres_item }}" + + loop: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_ers_filesystems }}" + loop_control: + loop_var: fsres_item + label: "{{ fsres_item }}" when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Central Service (ABAP ASCS)" ansible.builtin.set_fact: @@ -137,7 +153,7 @@ - name: timeout value: 60 when: - - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" ansible.builtin.set_fact: @@ -184,7 +200,7 @@ - name: timeout value: 60 when: - - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ASCS<>" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index 5f79d511f..405f09a9f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -10,67 +10,34 @@ # defined in user input variables. Conflicting user input should take precedence. -- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /sapmnt" +- name: "SAP HA Prepare Pacemaker - Add common filesystem resources to resource definition" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name }}" - agent: "ocf:heartbeat:Filesystem" - instance_attrs: - - attrs: - - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_host_mount_path }}" - - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_local_mount_path }}" - - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_fstype }}" - - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_options_string }}" - - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_force_unmount }}" - operations: - - action: start - attrs: - - name: interval - value: 0 - - name: timeout - value: 60 - - action: stop - attrs: - - name: interval - value: 0 - - name: timeout - value: 120 - - action: monitor - attrs: - - name: interval - value: 200 - - name: timeout - value: 40 - when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) - + id: |- + {%- if '/sapmnt' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name %} + {% elif '/usr/sap/trans' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name %} + {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_netweaver_sid + '/SYS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name %} + {% endif %} + {{ idname }} -- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/trans" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" - vars: - __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name }}" agent: "ocf:heartbeat:Filesystem" instance_attrs: - attrs: - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_host_mount_path }}" + value: "{{ __nfs_server }}/{{ __nfs_path }}" - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_local_mount_path }}" + value: "{{ __mountpoint }}" - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_fstype }}" + value: "{{ __fstype }}" - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_options_string }}" + value: "{{ __mount_opts }}" - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_transports_filesystem_force_unmount }}" + value: "{{ sap_ha_pacemaker_cluster_resource_filesystem_force_unmount }}" operations: - action: start attrs: @@ -90,47 +57,31 @@ value: 200 - name: timeout value: 40 - when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + # Format input variables to make above construction code more readable. + __fstype: "{{ commonfs_item.nfs_filesystem_type | default(sap_ha_pacemaker_cluster_storage_nfs_filesytem_type) }}" + __mount_opts: "{{ commonfs_item.nfs_mount_options | default(sap_ha_pacemaker_cluster_storage_nfs_mount_options) }}" + __nfs_server: "{{ commonfs_item.nfs_server | default(sap_ha_pacemaker_cluster_storage_nfs_server) | regex_replace('/$', '') }}" + __nfs_path: |- + {%- if '/usr/sap' in commonfs_item.nfs_path and '/usr/sap/trans' not in commonfs_item.nfs_path -%} + {{ commonfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {%- else -%} + {{ commonfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }} + {%- endif %} + __mountpoint: |- + {%- if commonfs_item.mountpoint | regex_replace('/$', '') == '/usr/sap' -%} + {{ commonfs_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {%- else -%} + {{ commonfs_item.mountpoint | regex_replace('/$', '') }} + {%- endif %} -- name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/SYS" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" - vars: - __resource_filesystem: - id: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name }}" - agent: "ocf:heartbeat:Filesystem" - instance_attrs: - - attrs: - - name: device - value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_host_mount_path }}" - - name: directory - value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_local_mount_path }}" - - name: fstype - value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_fstype }}" - - name: options - value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_options_string }}" - - name: force_unmount - value: "{{ sap_ha_pacemaker_cluster_netweaver_sys_filesystem_force_unmount }}" - operations: - - action: start - attrs: - - name: interval - value: 0 - - name: timeout - value: 60 - - action: stop - attrs: - - name: interval - value: 0 - - name: timeout - value: 120 - - action: monitor - attrs: - - name: interval - value: 200 - - name: timeout - value: 40 + loop: "{{ sap_ha_pacemaker_cluster_storage_definition }}" + loop_control: + loop_var: commonfs_item + label: "{{ commonfs_item.name }}" when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - commonfs_item.mountpoint is defined + - commonfs_item.nfs_path is defined + - "'/usr/sap' in commonfs_item.mountpoint + or '/sapmnt' in commonfs_item.mountpoint" + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 4e34c50a0..5e366bf5e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -69,9 +69,9 @@ file: construct_vars_netweaver_abap_ascs_ers.yml loop: "{{ sap_ha_pacemaker_cluster_host_type }}" loop_control: - loop_var: nwas_constr_item + loop_var: nwas_build_item when: - - "'nwas_abap_ascs' in nwas_constr_item" + - "'nwas_abap_ascs' in nwas_build_item" #- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" From 638f0834685af8ef4f8a4d97c5e49137fe616609 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 15:39:24 +0000 Subject: [PATCH 042/128] sap_ha_pacemaker_cluster: replaced check for same agent with check for same id --- .../tasks/construct_vars_netweaver_abap_pas_aas.yml | 8 ++++---- .../tasks/construct_vars_netweaver_java_scs_ers.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml index 02dfcbe98..ecb58bc40 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml @@ -49,7 +49,7 @@ - name: timeout value: 40 when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/D<>" ansible.builtin.set_fact: @@ -90,7 +90,7 @@ - name: timeout value: 40 when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Primary Application Server (ABAP PAS)" ansible.builtin.set_fact: @@ -137,7 +137,7 @@ - name: timeout value: 60 when: - - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Additional Application Server (ABAP AAS)" ansible.builtin.set_fact: @@ -184,4 +184,4 @@ - name: timeout value: 60 when: - - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml index 9a55f229d..b8707ab02 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml @@ -49,7 +49,7 @@ - name: timeout value: 40 when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: Filesystem /usr/sap/<>/ERS<>" ansible.builtin.set_fact: @@ -90,7 +90,7 @@ - name: timeout value: 40 when: - - __resource_filesystem.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Central Service (JAVA SCS)" @@ -138,7 +138,7 @@ - name: timeout value: 60 when: - - __resource_sapinstance.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (JAVA ERS)" ansible.builtin.set_fact: @@ -185,7 +185,7 @@ - name: timeout value: 60 when: - - __resource_sapinstance_ers.agent not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='agent')) + - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/SCS<>" From d7139086365e82c2f031e4faef65267a0c9e823a Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 15:43:51 +0000 Subject: [PATCH 043/128] sap_ha_pacemaker_cluster: include pas/aas and java task files --- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 5e366bf5e..507d8925e 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -73,16 +73,23 @@ when: - "'nwas_abap_ascs' in nwas_build_item" +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" + ansible.builtin.include_tasks: + file: construct_vars_netweaver_abap_pas_aas.yml + loop: "{{ sap_ha_pacemaker_cluster_host_type }}" + loop_control: + loop_var: nwas_build_item + when: + - "'nwas_abap_pas' in nwas_build_item" -#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver ABAP PAS/AAS" -# when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_pas_aas' or sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_abap_all' -# ansible.builtin.include_tasks: -# file: construct_vars_netweaver_abap_pas_aas.yml - -#- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver JAVA SCS/ERS" -# when: sap_ha_pacemaker_cluster_sap_type == 'sapnetweaver_java_scs_ers' -# ansible.builtin.include_tasks: -# file: construct_vars_netweaver_java_scs_ers.yml +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver Java SCS/ERS" + ansible.builtin.include_tasks: + file: construct_vars_netweaver_java_scs_ers.yml + loop: "{{ sap_ha_pacemaker_cluster_host_type }}" + loop_control: + loop_var: nwas_build_item + when: + - "'nwas_java' in nwas_build_item" - name: "SAP HA Install Pacemaker - Block with actual changes" block: From 0acf6148e268ccd03b72d51e419af4c2d9e717cb Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 16:30:30 +0000 Subject: [PATCH 044/128] sap_ha_pacemaker_cluster: downgraded required params in arg specs that are not needed for nwas clusters --- roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 941e9e933..532eda12b 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -261,7 +261,7 @@ argument_specs: node_ip: 192.168.5.2 elements: dict - required: true + required: false type: list options: node_ip: @@ -309,7 +309,7 @@ argument_specs: sap_hana_vip: primary: 192.168.10.100 - required: true + required: false type: dict required_one_of: [{ primary, main, rw, promoted }] From 4f4d175ab4e9e8c00b500d36e4c26bbb7b296bd5 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 16:49:04 +0000 Subject: [PATCH 045/128] sap_ha_pacemaker_cluster: disabled a parameter that could be a list or string and is not compatible with arg specs --- .../meta/argument_specs.yml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml index 532eda12b..e7495ee9d 100644 --- a/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml +++ b/roles/sap_ha_pacemaker_cluster/meta/argument_specs.yml @@ -207,20 +207,20 @@ argument_specs: required: false type: dict - sap_ha_pacemaker_cluster_host_type: - choices: -# - hana_scaleup_costopt - - hana_scaleup_perf -# - hana_scaleup_perf_dr -# - hana_scaleout - - nwas_abap_ascs_ers - - nwas_abap_pas_aas -# - nwas_java_scs_ers - default: hana_scaleup_perf - description: - - The SAP landscape to be installed. - required: false - type: str +# sap_ha_pacemaker_cluster_host_type: +# choices: +## - hana_scaleup_costopt +# - hana_scaleup_perf +## - hana_scaleup_perf_dr +## - hana_scaleout +# - nwas_abap_ascs_ers +# - nwas_abap_pas_aas +## - nwas_java_scs_ers +# default: hana_scaleup_perf +# description: +# - The SAP landscape to be installed. +# required: false +# type: str sap_ha_pacemaker_cluster_vip_client_interface: default: eth0 From d055ce4d13850796fefc697ee7c08f622a604d35 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 17:43:35 +0000 Subject: [PATCH 046/128] sap_ha_pacemaker_cluster: fixed meta_attrs --- .../construct_vars_netweaver_abap_ascs_ers.yml | 16 ++++++++-------- .../construct_vars_netweaver_abap_pas_aas.yml | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index ccb1220d5..cdc0f2647 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -123,8 +123,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_stickiness }}" - name: migration-threshold @@ -170,8 +170,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_stickiness }}" - name: migration-threshold @@ -216,8 +216,8 @@ value: 2 - name: clone-node-max value: 1 - - name: interleave - value: "true" + - name: interleave + value: "true" when: - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) @@ -234,8 +234,8 @@ value: 2 - name: clone-node-max value: 1 - - name: interleave - value: "true" + - name: interleave + value: "true" when: - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml index ecb58bc40..54b2d7834 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_pas_aas.yml @@ -107,8 +107,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_stickiness }}" - name: migration-threshold @@ -154,8 +154,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_stickiness }}" - name: migration-threshold From 0e8a0fa8337265e7057006f8fbd81b54dc45b0a1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 11 May 2023 17:50:22 +0000 Subject: [PATCH 047/128] sap_ha_pacemaker_cluster: fixed meta_attrs in java file --- .../tasks/construct_vars_netweaver_java_scs_ers.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml index b8707ab02..67e66aabb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_java_scs_ers.yml @@ -108,8 +108,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_stickiness }}" - name: migration-threshold @@ -155,8 +155,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_automatic_recover_bool | string }}" - - name: meta - value: "" + meta_attrs: + - attrs: - name: resource-stickiness value: "{{ sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_stickiness }}" - name: migration-threshold From 45aaeb1d7c49f1a1cbbd6ec27a565b66a3fe7007 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 07:14:26 +0000 Subject: [PATCH 048/128] sap_ha_pacemaker_cluster: moved conditionals below tasks for consistency --- .../construct_vars_vip_resources_default.yml | 16 +++--- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 52 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 1bd4f6d42..37ff5f91f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -3,8 +3,6 @@ # VIP resource definition itself - name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" - when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: @@ -15,12 +13,11 @@ - attrs: - name: ip value: "{{ vip_list_item.value | quote }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) # Start the VIP(s) only after the HANA resource has been promoted - name: "SAP HA Prepare Pacemaker - Add order constraint: Primary VIP starts after DB is promoted" - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -31,12 +28,12 @@ resource_then: id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms # The VIP only runs where HANA is promoted - name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" vars: @@ -49,3 +46,6 @@ options: - name: score value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index ea1dd239d..9a93757e1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -2,11 +2,6 @@ # Reminder: This file is included in a loop over a dictionary. - name: "SAP HA Prepare Pacemaker - Add resource: OS floating IP (dev/test only)" - when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or - (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and - 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" @@ -18,11 +13,13 @@ - attrs: - name: ip value: "{{ vip_list_item.value }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or + (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and + 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) - name: "SAP HA Prepare Pacemaker - Add resource: AWS floating IP (dev/test only)" - when: - - ('pri' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - sap_ha_pacemaker_cluster_vip_method == 'awsvip' ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: @@ -33,11 +30,11 @@ - attrs: - name: secondary_private_ip value: "{{ vip_list_item.value }}" + when: + - ('pri' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method == 'awsvip' - name: "SAP HA Prepare Pacemaker - Add resource group for VIP resources" - when: - - __vip_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) - - sap_ha_pacemaker_cluster_vip_method in ['awsvip'] ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__vip_group] }}" __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" @@ -47,11 +44,11 @@ resource_ids: - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - "pri{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + when: + - __vip_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method in ['awsvip'] - name: "SAP HA Prepare Pacemaker - Add resource: AWS VIP routing" - when: - - (sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" @@ -67,12 +64,12 @@ value: "{{ sap_ha_pacemaker_cluster_vip_client_interface }}" - name: routing_table value: "{{ sap_ha_pacemaker_cluster_vip_update_rt | join(',') }}" + when: + - (sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' # Start the VIP(s) only after the HANA resource has been promoted - name: "SAP HA Prepare Pacemaker - Add order constraint: Primary VIP starts after DB is promoted" - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -83,12 +80,12 @@ resource_then: id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms # The VIP only runs where HANA is promoted - name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" vars: @@ -101,12 +98,12 @@ options: - name: score value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms # Start the secondary VIP after the HANA resource has been promoted - name: "SAP HA Prepare Pacemaker - Add order constraint: Read-only VIP starts after DB is promoted" - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -117,12 +114,12 @@ resource_then: id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms # The secondary VIP only runs where HANA is UNpromoted - name: "SAP HA Prepare Pacemaker - Add colocation constraint: Read-only VIP runs where HANA is not promoted" - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" vars: @@ -135,3 +132,6 @@ options: - name: score value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms From 20e2533e0f18affdae54eb1bcbadf58d26f12548 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 08:35:35 +0000 Subject: [PATCH 049/128] sap_ha_pacemaker_cluster: vip constraints handling for NetWeaver ASCS and ERS --- .../defaults/main.yml | 2 +- ...construct_vars_netweaver_abap_ascs_ers.yml | 73 ----------------- .../construct_vars_vip_constraints_hana.yml | 54 +++++++++++++ ...nstruct_vars_vip_constraints_netweaver.yml | 78 +++++++++++++++++++ .../construct_vars_vip_resources_default.yml | 37 +-------- .../tasks/include_construct_vip_resources.yml | 30 ++++++- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 68 ---------------- roles/sap_ha_pacemaker_cluster/vars/main.yml | 22 +++++- 8 files changed, 180 insertions(+), 184 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index d604e7507..f3ade606c 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -85,7 +85,7 @@ sap_ha_pacemaker_cluster_fence_options: power_timeout: 240 ### Resource default patterns -sap_ha_pacemaker_cluster_vip_address: "{{ sap_hana_vip }}" +sap_ha_pacemaker_cluster_vip_address: "{{ sap_hana_vip | default(sap_cluster_vip) }}" sap_ha_pacemaker_cluster_vip_resource_agent: "ocf:heartbeat:IPaddr2" sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_hana_sid }}_{{ sap_ha_pacemaker_cluster_hana_instance_number }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index cdc0f2647..597e6acda 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -203,79 +203,6 @@ - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) -- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ASCS<>" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" - vars: - __clone_filesystem: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" - promotable: "no" - meta_attrs: - - attrs: - - name: clone-max - value: 2 - - name: clone-node-max - value: 1 - - name: interleave - value: "true" - when: - - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - -- name: "SAP HA Prepare Pacemaker - Add resource clone: Filesystem /usr/sap/<>/ERS<>" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_filesystem] }}" - vars: - __clone_filesystem: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - promotable: "no" - meta_attrs: - - attrs: - - name: clone-max - value: 2 - - name: clone-node-max - value: 1 - - name: interleave - value: "true" - when: - - __clone_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - - -- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Central Service (ABAP ASCS)" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance] }}" - vars: - __clone_sapinstance: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - promotable: "yes" - meta_attrs: - - attrs: - - name: clone-max - value: 2 - - name: clone-node-max - value: 1 - - name: interleave - value: "true" - when: - - __clone_sapinstance.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - -- name: "SAP HA Prepare Pacemaker - Add resource clone: SAPInstance for Enqueue Replication Service (ABAP ERS)" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_sapinstance_ers] }}" - vars: - __clone_sapinstance_ers: - resource_id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" - promotable: "yes" - meta_attrs: - - attrs: - - name: clone-max - value: 2 - - name: clone-node-max - value: 1 - - name: interleave - value: "true" - when: - - __clone_sapinstance_ers.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) - # First start SAPInstance for Central Service, then SAPInstance for Enqueue Replication Service (automatically stops in reverse order) - name: "SAP HA Prepare Pacemaker - Add order constraint: Central Service starts before Enqueue Replication Service" ansible.builtin.set_fact: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml new file mode 100644 index 000000000..fa3de1dd7 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -0,0 +1,54 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +# Start the VIP(s) only after the HANA resource has been promoted +- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after DB is promoted" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" + vars: + __constraint_order_vip: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + action: promote + resource_then: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_primary_synonyms + +# The primary VIP only runs where HANA is promoted +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" + vars: + __constraint_colo_vip: + resource_leader: + id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + role: promoted + resource_follower: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + options: + - name: score + value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_primary_synonyms + +# The secondary VIP only runs where HANA is UNpromoted +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: Read-only VIP runs where HANA is not promoted" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" + vars: + __constraint_colo_vip: + resource_leader: + id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" + role: unpromoted + resource_follower: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + options: + - name: score + value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_hana_secondary_synonyms diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml new file mode 100644 index 000000000..79dc0bc0d --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml @@ -0,0 +1,78 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +################################################## +# NetWeaver ASCS +################################################## + +# Start the VIP only after the ASCS resource has been started +- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after NetWeaver ASCS is started" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" + vars: + __constraint_order_vip: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + action: start + resource_then: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms + +# The VIP only runs where the ASCS resource is running +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ASCS is running" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" + vars: + __constraint_colo_vip: + resource_leader: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + role: started + resource_follower: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + options: + - name: score + value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms + +################################################## +# NetWeaver ERS +################################################## + +# Start the VIP only after the ERS resource has been started +- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after NetWeaver ERS is started" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" + vars: + __constraint_order_vip: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" + action: start + resource_then: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + action: start + when: + - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms + +# The VIP only runs where the ERS resource is running +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ERS is running" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" + vars: + __constraint_colo_vip: + resource_leader: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" + role: started + resource_follower: + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + options: + - name: score + value: 2000 + when: + - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) + - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 37ff5f91f..bc561339b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -5,6 +5,7 @@ - name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" + __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" @@ -14,38 +15,4 @@ - name: ip value: "{{ vip_list_item.value | quote }}" when: - - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - -# Start the VIP(s) only after the HANA resource has been promoted -- name: "SAP HA Prepare Pacemaker - Add order constraint: Primary VIP starts after DB is promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" - vars: - __constraint_order_vip: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - action: promote - resource_then: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - action: start - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms - -# The VIP only runs where HANA is promoted -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" - vars: - __constraint_colo_vip: - resource_leader: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - role: promoted - resource_follower: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - options: - - name: score - value: 2000 - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms + - __sap_ha_pacemaker_cluster_vip_contraint_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 9fabe905f..1eb90663f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -3,21 +3,43 @@ # for multiple IPs to be configured in cluster resources - name: "SAP HA Prepare Pacemaker - Include variable construction for standard VIP resources" - when: - - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - - (vip_list_item.value is defined) and (vip_list_item.value != '') ansible.builtin.include_tasks: construct_vars_vip_resources_default.yml loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" loop_control: index_var: loop_index loop_var: vip_list_item + when: + - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms + - (vip_list_item.value is defined) and (vip_list_item.value != '') - name: "SAP HA Prepare Pacemaker - Include variable construction for platform VIP resources" + ansible.builtin.include_tasks: "platform/construct_vars_vip_resources_{{ __sap_ha_pacemaker_cluster_platform }}.yml" + loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" + loop_control: + index_var: loop_index + loop_var: vip_list_item when: - __sap_ha_pacemaker_cluster_platform in __sap_ha_pacemaker_cluster_supported_platforms - (vip_list_item.value is defined) and (vip_list_item.value != '') - ansible.builtin.include_tasks: "platform/construct_vars_vip_resources_{{ __sap_ha_pacemaker_cluster_platform }}.yml" + +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP Hana VIP constraints" + ansible.builtin.include_tasks: + file: construct_vars_vip_constraints_hana.yml loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" loop_control: index_var: loop_index loop_var: vip_list_item + when: + - (vip_list_item.value is defined) and (vip_list_item.value != '') + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + +- name: "SAP HA Prepare Pacemaker - Include variable construction for SAP NetWeaver VIP constraints" + ansible.builtin.include_tasks: + file: construct_vars_vip_constraints_netweaver.yml + loop: "{{ query('dict', sap_ha_pacemaker_cluster_vip_address) }}" + loop_control: + index_var: loop_index + loop_var: vip_list_item + when: + - (vip_list_item.value is defined) and (vip_list_item.value != '') + - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 9a93757e1..1637ab822 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -67,71 +67,3 @@ when: - (sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'aws_vpc_move_ip' - -# Start the VIP(s) only after the HANA resource has been promoted -- name: "SAP HA Prepare Pacemaker - Add order constraint: Primary VIP starts after DB is promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" - vars: - __constraint_order_vip: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - action: promote - resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" - action: start - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms - -# The VIP only runs where HANA is promoted -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: Primary VIP runs where HANA is promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" - vars: - __constraint_colo_vip: - resource_leader: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - role: promoted - resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" - options: - - name: score - value: 2000 - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_primary_synonyms - -# Start the secondary VIP after the HANA resource has been promoted -- name: "SAP HA Prepare Pacemaker - Add order constraint: Read-only VIP starts after DB is promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" - vars: - __constraint_order_vip: - resource_first: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - action: promote - resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" - action: start - when: - - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms - -# The secondary VIP only runs where HANA is UNpromoted -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: Read-only VIP runs where HANA is not promoted" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" - vars: - __constraint_colo_vip: - resource_leader: - id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" - role: promoted - resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" - options: - - name: score - value: 2000 - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_secondary_synonyms diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index cc3f505d3..0b90249ba 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -31,17 +31,33 @@ __sap_ha_pacemaker_cluster_required_facts: # The arguments_spec check complains. # The actual values must be empty, they are set by various tasks! -__sap_ha_pacemaker_cluster_primary_synonyms: +__sap_ha_pacemaker_cluster_hana_primary_synonyms: - primary - - main + - hana_primary - promoted - rw -__sap_ha_pacemaker_cluster_secondary_synonyms: +__sap_ha_pacemaker_cluster_hana_secondary_synonyms: - secondary + - hana_secondary - unpromoted - ro +__sap_ha_pacemaker_cluster_nwas_ascs_synonyms: + - ascs + - nwas_ascs + - nwas_abap_ascs + +__sap_ha_pacemaker_cluster_nwas_ers_synonyms: + - ers + - nwas_ers + - nwas_abap_ers + +__sap_ha_pacemaker_cluster_nwas_pas_synonyms: + - pas + - nwas_pas + - nwas_abap_pas + # (cloud) platform helper variable - leave empty for default = not cloud __sap_ha_pacemaker_cluster_platform: '' __sap_ha_pacemaker_cluster_supported_platforms: From dc81341c6ed4da64213b941a0388bbefb02f7dca Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 08:56:07 +0000 Subject: [PATCH 050/128] sap_ha_pacemaker_cluster: fixes in vip id fact and srhook include conditional --- .../tasks/construct_vars_vip_resources_default.yml | 5 ++++- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index bc561339b..f0538d686 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -1,11 +1,14 @@ --- # Reminder: This file is included in a loop over a dictionary. +- name: "SAP HA Prepare Pacemaker - Set fact for VIP resource name" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + # VIP resource definition itself - name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 507d8925e..dfb2bdc53 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -185,12 +185,13 @@ run_once: true - name: "SAP HA Install Pacemaker - Include srHook configuration" - when: sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleup' or sap_ha_pacemaker_cluster_sap_type == 'saphana_scaleout' ansible.builtin.include_tasks: file: configure_srhook.yml apply: tags: srhook tags: srhook + when: + - sap_ha_pacemaker_cluster_sap_type | select('search', 'hana') | length > 0 ### END OF BLOCK: prerequisite changes and cluster setup From 0b445bd625e80940893b17fc123eb43ca7a3e165 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 09:31:58 +0000 Subject: [PATCH 051/128] sap_ha_pacemaker_cluster: fixes --- .../tasks/construct_vars_netweaver_abap_ascs_ers.yml | 6 +++--- .../tasks/construct_vars_vip_resources_default.yml | 2 +- roles/sap_ha_pacemaker_cluster/tasks/main.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 597e6acda..71d6021a9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -160,7 +160,7 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" vars: __resource_sapinstance_ers: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" agent: "ocf:heartbeat:SAPInstance" instance_attrs: - attrs: @@ -210,10 +210,10 @@ vars: __constraint_order_sapinstance: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" action: start resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name }}" + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" action: start options: - name: symmetrical diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index f0538d686..d3ab6e9d1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -11,7 +11,7 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: __resource_vip: - id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" agent: "{{ sap_ha_pacemaker_cluster_vip_resource_agent }}" instance_attrs: - attrs: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index dfb2bdc53..59e6bd9b2 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -191,7 +191,7 @@ tags: srhook tags: srhook when: - - sap_ha_pacemaker_cluster_sap_type | select('search', 'hana') | length > 0 + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 ### END OF BLOCK: prerequisite changes and cluster setup From 4ba45e6a5268072f63db12d991d89b7891e9215a Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 09:56:00 +0000 Subject: [PATCH 052/128] sap_ha_pacemaker_cluster: fixed multi-vip resource constraints --- .../tasks/construct_vars_vip_resources_default.yml | 4 ---- .../tasks/include_construct_vip_resources.yml | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index d3ab6e9d1..96303ac58 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -1,10 +1,6 @@ --- # Reminder: This file is included in a loop over a dictionary. -- name: "SAP HA Prepare Pacemaker - Set fact for VIP resource name" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" - # VIP resource definition itself - name: "SAP HA Prepare Pacemaker - Add resource: VIP {{ vip_list_item.key }}" ansible.builtin.set_fact: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 1eb90663f..716c86386 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -8,6 +8,8 @@ loop_control: index_var: loop_index loop_var: vip_list_item + vars: + __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - (vip_list_item.value is defined) and (vip_list_item.value != '') @@ -29,6 +31,8 @@ loop_control: index_var: loop_index loop_var: vip_list_item + vars: + __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - (vip_list_item.value is defined) and (vip_list_item.value != '') - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 @@ -40,6 +44,8 @@ loop_control: index_var: loop_index loop_var: vip_list_item + vars: + __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - (vip_list_item.value is defined) and (vip_list_item.value != '') - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 From 430de33ca41a0f5ee576182fd3b79f7608dd399b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Fri, 12 May 2023 10:33:53 +0000 Subject: [PATCH 053/128] sap_ha_pacemaker_cluster: vip resource name now uses the correct SID per host type --- .../tasks/construct_vars_vip_constraints_hana.yml | 6 +++--- .../tasks/construct_vars_vip_constraints_netweaver.yml | 8 ++++---- .../tasks/construct_vars_vip_resources_default.yml | 4 ++-- .../tasks/include_construct_vip_resources.yml | 6 +++--- .../construct_vars_vip_resources_cloud_aws_ec2_vs.yml | 6 +++--- .../sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml | 2 ++ 6 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml index fa3de1dd7..e632bbaec 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_hana.yml @@ -11,7 +11,7 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" action: promote resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" action: start when: - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) @@ -27,7 +27,7 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" role: promoted resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" options: - name: score value: 2000 @@ -45,7 +45,7 @@ id: "{{ sap_ha_pacemaker_cluster_hana_resource_clone_name }}" role: unpromoted resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" options: - name: score value: 2000 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml index 79dc0bc0d..aa22b688c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml @@ -15,7 +15,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" action: start resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" action: start when: - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) @@ -31,7 +31,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" role: started resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" options: - name: score value: 2000 @@ -53,7 +53,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" action: start resource_then: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" action: start when: - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) @@ -69,7 +69,7 @@ id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" role: started resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" options: - name: score value: 2000 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml index 96303ac58..3e2b16235 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_resources_default.yml @@ -7,11 +7,11 @@ __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: __resource_vip: - id: "{{ __sap_ha_pacemaker_cluster_vip_contraint_id }}" + id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" agent: "{{ sap_ha_pacemaker_cluster_vip_resource_agent }}" instance_attrs: - attrs: - name: ip value: "{{ vip_list_item.value | quote }}" when: - - __sap_ha_pacemaker_cluster_vip_contraint_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - __sap_ha_pacemaker_cluster_vip_resource_id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml index 716c86386..bb768bdd4 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/include_construct_vip_resources.yml @@ -9,7 +9,7 @@ index_var: loop_index loop_var: vip_list_item vars: - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - __sap_ha_pacemaker_cluster_platform not in __sap_ha_pacemaker_cluster_supported_platforms - (vip_list_item.value is defined) and (vip_list_item.value != '') @@ -32,7 +32,7 @@ index_var: loop_index loop_var: vip_list_item vars: - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - (vip_list_item.value is defined) and (vip_list_item.value != '') - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 @@ -45,7 +45,7 @@ index_var: loop_index loop_var: vip_list_item vars: - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" when: - (vip_list_item.value is defined) and (vip_list_item.value != '') - sap_ha_pacemaker_cluster_host_type | select('search', 'nwas') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 1637ab822..7fd309b71 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -4,7 +4,7 @@ - name: "SAP HA Prepare Pacemaker - Add resource: OS floating IP (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" @@ -37,7 +37,7 @@ - name: "SAP HA Prepare Pacemaker - Add resource group for VIP resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__vip_group] }}" - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" vars: __vip_group: id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" @@ -51,7 +51,7 @@ - name: "SAP HA Prepare Pacemaker - Add resource: AWS VIP routing" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" - __sap_ha_pacemaker_cluster_vip_contraint_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" vars: __resource_vip: id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml new file mode 100644 index 000000000..a4118f6f7 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/nwas_abap_ascs_ers.yml @@ -0,0 +1,2 @@ +--- +sap_ha_pacemaker_cluster_vip_resource_name: "vip_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" From 18f45bcac915dba6cf5e10ba0df92e9f57bab974 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Sun, 14 May 2023 15:38:47 +0000 Subject: [PATCH 054/128] sap_ha_pacemaker_cluster: added shared fs clones, app groups and constraints --- .../defaults/main.yml | 2 +- ...construct_vars_netweaver_abap_ascs_ers.yml | 87 ++++++++++++++++--- .../tasks/construct_vars_netweaver_common.yml | 39 +++++++++ ...nstruct_vars_vip_constraints_netweaver.yml | 70 +++++++-------- 4 files changed, 152 insertions(+), 46 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index f3ade606c..375d74288 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -96,7 +96,7 @@ sap_ha_pacemaker_cluster_hana_topology_resource_name: "SAPHanaTopology_{{ sap_ha sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker_cluster_hana_topology_resource_name }}-clone" -sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: true +sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe # SAP NetWeaver common - Resource IDs (names) as convenience parameters. # - /sapmnt diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 71d6021a9..f57e3789a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -107,7 +107,10 @@ when: - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) +# End of filesystem resource task + +# ASCS instance resource definition - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Central Service (ABAP ASCS)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance] }}" @@ -155,6 +158,8 @@ when: - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + +# ERS instance resource definition - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_sapinstance_ers] }}" @@ -202,23 +207,85 @@ when: - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) +################################################# +# Group resources that belong together +# ############################################### + +# ASCS group consists of resources for +# - ASCS filesystem +# - ASCS instance +# - ASCS VIP +- name: "SAP HA Prepare Pacemaker - Add resource group for ASCS resources" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ascs_group] }}" + vars: + __ascs_group: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + resource_ids: + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ sap_ha_pacemaker_cluster_vip_address | select('search', 'ascs') | join('') }}" + meta_attrs: + - attrs: + - name: resource-stickiness + value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_stickiness }}" + when: + - __ascs_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) + +# ERS group consists of resources for +# - ERS filesystem +# - ERS instance +# - ERS VIP +- name: "SAP HA Prepare Pacemaker - Add resource group for ERS resources" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__ers_group] }}" + vars: + __ers_group: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + resource_ids: + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" + - "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ sap_ha_pacemaker_cluster_vip_address | select('search', 'ers') | join('') }}" + when: + - __ers_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) + + +################################################# +# Constraints between the groups +################################################# + +# ERS and ASCS resource groups should try to avoid running on the same node +- name: "SAP HA Prepare Pacemaker - Add colocation constraint: NetWeaver ERS and ASCS avoid on the same node" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_ers] }}" + vars: + __constraint_colo_ers: + resource_leader: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + role: started + resource_follower: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + options: + - name: score + value: -5000 + when: + - __constraint_colo_ers.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) -# First start SAPInstance for Central Service, then SAPInstance for Enqueue Replication Service (automatically stops in reverse order) -- name: "SAP HA Prepare Pacemaker - Add order constraint: Central Service starts before Enqueue Replication Service" +# Optional: ASCS should be started before ERS +- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ASCS group, then ERS group" ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_sapinstance] }}" + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ascs_ers] }}" vars: - __constraint_order_sapinstance: + __constraint_order_ascs_ers: resource_first: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - action: start + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + role: started resource_then: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - action: start + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" options: - name: symmetrical value: "false" - name: kind - value: "Optional" + value: Optional when: - - __constraint_order_sapinstance.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) + - __constraint_order_ascs_ers.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index 405f09a9f..3785d916f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -85,3 +85,42 @@ - "'/usr/sap' in commonfs_item.mountpoint or '/sapmnt' in commonfs_item.mountpoint" - __resource_filesystem.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + + +# The shared/common filesystems are clones. +- name: "SAP HA Prepare Pacemaker - Add resource clones for common shared filesystems" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_common_filesystem] }}" + vars: + __clone_common_filesystem: + resource_id: |- + {%- if '/sapmnt' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name %} + {% elif '/usr/sap/trans' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name %} + {% elif '/usr/sap/' + sap_ha_pacemaker_cluster_netweaver_sid + '/SYS' in __mountpoint -%} + {% set idname = sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name %} + {% endif %} + {{ idname }} + meta_attrs: + - attrs: + - name: interleave + value: "true" + + __mountpoint: |- + {%- if commonfsclone_item.mountpoint | regex_replace('/$', '') == '/usr/sap' -%} + {{ commonfsclone_item.mountpoint | regex_replace('/$', '') }}/{{ sap_ha_pacemaker_cluster_netweaver_sid }}/SYS + {%- else -%} + {{ commonfsclone_item.mountpoint | regex_replace('/$', '') }} + {%- endif %} + + loop: "{{ sap_ha_pacemaker_cluster_storage_definition }}" + loop_control: + loop_var: commonfsclone_item + label: "{{ commonfsclone_item.name }}" + when: + - commonfsclone_item.mountpoint is defined + - commonfsclone_item.nfs_path is defined + - "'/usr/sap' in commonfsclone_item.mountpoint + or '/sapmnt' in commonfsclone_item.mountpoint" + - __clone_common_filesystem.resource_id not in (__sap_ha_pacemaker_cluster_resource_clones | map(attribute='resource_id')) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml index aa22b688c..4a0636797 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_vip_constraints_netweaver.yml @@ -6,7 +6,7 @@ ################################################## # Start the VIP only after the ASCS resource has been started -- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after NetWeaver ASCS is started" +- name: "SAP HA Prepare Pacemaker - Add order constraint: ASCS VIP starts after NetWeaver ASCS is started" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -21,30 +21,30 @@ - __constraint_order_vip.resource_then not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_then')) - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms -# The VIP only runs where the ASCS resource is running -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ASCS is running" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" - vars: - __constraint_colo_vip: - resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" - role: started - resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" - options: - - name: score - value: 2000 - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms +# The VIP only runs where the ASCS resource is running -- the VIP in the the group +#- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ASCS is running" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" +# vars: +# __constraint_colo_vip: +# resource_leader: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}" +# role: started +# resource_follower: +# id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" +# options: +# - name: score +# value: 2000 +# when: +# - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) +# - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ascs_synonyms ################################################## # NetWeaver ERS ################################################## # Start the VIP only after the ERS resource has been started -- name: "SAP HA Prepare Pacemaker - Add order constraint: VIP starts after NetWeaver ERS is started" +- name: "SAP HA Prepare Pacemaker - Add order constraint: ERS VIP starts after NetWeaver ERS is started" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_vip] }}" vars: @@ -60,19 +60,19 @@ - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms # The VIP only runs where the ERS resource is running -- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ERS is running" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" - vars: - __constraint_colo_vip: - resource_leader: - id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" - role: started - resource_follower: - id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" - options: - - name: score - value: 2000 - when: - - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) - - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms +#- name: "SAP HA Prepare Pacemaker - Add colocation constraint: VIP runs where NetWeaver ERS is running" +# ansible.builtin.set_fact: +# __sap_ha_pacemaker_cluster_constraints_colocation: "{{ __sap_ha_pacemaker_cluster_constraints_colocation + [__constraint_colo_vip] }}" +# vars: +# __constraint_colo_vip: +# resource_leader: +# id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}" +# role: started +# resource_follower: +# id: "{{ __sap_ha_pacemaker_cluster_vip_resource_id }}" +# options: +# - name: score +# value: 2000 +# when: +# - __constraint_colo_vip.resource_follower not in (__sap_ha_pacemaker_cluster_constraints_colocation | map(attribute='resource_follower')) +# - vip_list_item.key in __sap_ha_pacemaker_cluster_nwas_ers_synonyms From b2f2f6c967246686f5ba1ad8e4858dd7c9275e68 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 15 May 2023 16:45:14 +0000 Subject: [PATCH 055/128] sap_ha_pacemaker_cluster: add order constraint between instance and instance filesystem --- ...construct_vars_netweaver_abap_ascs_ers.yml | 33 +++++++++++++++++++ .../tasks/construct_vars_netweaver_common.yml | 6 ++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index f57e3789a..70c19dbf9 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -158,6 +158,22 @@ when: - __resource_sapinstance.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) +# Order Constraint: ASCS filesystem should start before instance +- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ASCS filesystem, then ASCS instance" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ascs_fs] }}" + vars: + __constraint_order_ascs_fs: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name }}" + role: started + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ASCS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + options: + - name: symmetrical + value: "false" + when: + - __constraint_order_ascs_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) # ERS instance resource definition - name: "SAP HA Prepare Pacemaker - Add resource: SAPInstance for Enqueue Replication Service (ABAP ERS)" @@ -207,6 +223,23 @@ when: - __resource_sapinstance_ers.id not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) +# Order Constraint: ERS filesystem should start before instance +- name: "SAP HA Prepare Pacemaker - Add order constraint: first start ERS filesystem, then ERS instance" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_constraints_order: "{{ __sap_ha_pacemaker_cluster_constraints_order + [__constraint_order_ers_fs] }}" + vars: + __constraint_order_ers_fs: + resource_first: + id: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name }}" + role: started + resource_then: + id: "{{ sap_ha_pacemaker_cluster_netweaver_sid }}_ERS{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}_group" + options: + - name: symmetrical + value: "false" + when: + - __constraint_order_ers_fs.resource_first not in (__sap_ha_pacemaker_cluster_constraints_order | map(attribute='resource_first')) + ################################################# # Group resources that belong together # ############################################### diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml index 3785d916f..b1d41f4fb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_common.yml @@ -2,7 +2,7 @@ # Variables containing variables must be constructed with values # to be fed into the included ha_cluster role -# - put here all scale-up and scale-out common resources +# - put here all NetWeaver common resources # - certain differences like ra agent names are provided through # type specific variables @@ -10,7 +10,7 @@ # defined in user input variables. Conflicting user input should take precedence. -- name: "SAP HA Prepare Pacemaker - Add common filesystem resources to resource definition" +- name: "SAP HA Prepare Pacemaker - Add NetWeaver common filesystem resources to resource definition" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_filesystem] }}" vars: @@ -88,7 +88,7 @@ # The shared/common filesystems are clones. -- name: "SAP HA Prepare Pacemaker - Add resource clones for common shared filesystems" +- name: "SAP HA Prepare Pacemaker - Add resource clones for NetWeaver common shared filesystems" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_clones: "{{ __sap_ha_pacemaker_cluster_resource_clones + [__clone_common_filesystem] }}" vars: From bf1dadab87f9c2102789497406fd9d122edf8f42 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 15 May 2023 17:20:46 +0000 Subject: [PATCH 056/128] sap_ha_pacemaker_cluster: added option IS_ERS to ERS resource definition --- .../tasks/construct_vars_netweaver_abap_ascs_ers.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml index 70c19dbf9..714ba306a 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_netweaver_abap_ascs_ers.yml @@ -191,6 +191,8 @@ value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_start_profile_string }}" - name: AUTOMATIC_RECOVER value: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_automatic_recover_bool | string }}" + - name: IS_ERS + value: "true" meta_attrs: - attrs: - name: resource-stickiness From c6427e79055ae3a51b7ddbdf1b6dfb48960a6695 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Mon, 15 May 2023 17:26:28 +0000 Subject: [PATCH 057/128] sap_ha_pacemaker_cluster: defaults update for NetWeaver parameters --- .../defaults/main.yml | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index 375d74288..fb0d35a67 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -98,40 +98,40 @@ sap_ha_pacemaker_cluster_hana_topology_resource_clone_name: "{{ sap_ha_pacemaker sap_ha_pacemaker_cluster_resource_filesystem_force_unmount: safe + # SAP NetWeaver common - Resource IDs (names) as convenience parameters. # - /sapmnt # - /usr/sap/trans # - /usr/sap/<>/SYS -sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" - -sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_sapmnt_filesystem_resource_name: "Filesystem_NWAS_SAPMNT_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +sap_ha_pacemaker_cluster_netweaver_transports_filesystem_resource_name: "Filesystem_NWAS_TRANS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" +sap_ha_pacemaker_cluster_netweaver_sys_filesystem_resource_name: "Filesystem_NWAS_SYS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}" # SAP NetWeaver ABAP ASCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/ASCS<> # - /usr/sap/<>/ERS<> -sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_filesystem_resource_name: "Filesystem_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ASCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" -sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_filesystem_resource_name: "Filesystem_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" +sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}" sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" # SAP NetWeaver ABAP PAS/AAS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/D<> -#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_pas_filesystem_resource_name: "Filesystem_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_pas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_PAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_pas_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_aas_filesystem_resource_name: "Filesystem_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_abap_aas_sapinstance_resource_name: "SAPInstance_NWAS_ABAP_AAS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_abap_aas_instance_number }}" # SAP NetWeaver JAVA SCS/ERS - Resource IDs (names) as convenience parameters. # - /usr/sap/<>/SCS<> # - /usr/sap/<>/ERS<> -#sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name: "Filesytem_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_scs_filesystem_resource_name: "Filesytem_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_SCS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_scs_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_java_scs_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_sapinstance_resource_name }}-clone" -#sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name: "Filesytem_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" -#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_filesystem_resource_name: "Filesytem_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number }}" +#sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_name: "SAPInstance_NWAS_JAVA_ERS_{{ sap_ha_pacemaker_cluster_netweaver_sid }}_{{ sap_ha_pacemaker_cluster_netweaver_java_ers_instance_number }}" #sap_ha_pacemaker_cluster_netweaver_java_ers_sapinstance_resource_clone_name: "{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_sapinstance_resource_name }}-clone" From f7dce5065ed35fc6701b883843eea86fcb56915a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 22 May 2023 13:28:56 +0200 Subject: [PATCH 058/128] sap_general_preconfigure: Further tweaks to README.md --- roles/sap_general_preconfigure/README.md | 12 ++++++++---- .../sap_general_preconfigure/meta/argument_specs.yml | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index e65d9f582..097ceb8d9 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -145,9 +145,10 @@ If you set the RHEL minor release, then you must also use the `eus` or `e4s` rep ### sap_general_preconfigure_packagegroups - _Type:_ `str` -- _Default:_ `"{{ __sap_general_preconfigure_packagegroups }}"` +- _Default:_ (set in vars file) The name of the software package group to install.
+The default for this parameter is set in the vars file which corresponds to the detected OS version.
Example: @@ -157,9 +158,10 @@ Example: ### sap_general_preconfigure_envgroups - _Type:_ `str` -- _Default:_ `"{{ __sap_general_preconfigure_envgroups }}"` +- _Default:_ (set in vars file) The name of the software environment group to check.
+The default for this parameter is set in the vars file which corresponds to the detected OS version.
Example: @@ -169,9 +171,10 @@ Example: ### sap_general_preconfigure_packages - _Type:_ `list` with elements of type `str` -- _Default:_ `"{{ __sap_general_preconfigure_packages }}"` +- _Default:_ (set in vars file) The list of packages to install.
+The default for this variable is set in the vars file which corresponds to the detected OS version.
### sap_general_preconfigure_min_package_check - _Type:_ `bool` @@ -239,9 +242,10 @@ The file name of the sysctl config file to be used
### sap_general_preconfigure_kernel_parameters - _Type:_ `list` with elements of type `dict` -- _Default:_ `"{{ __sap_general_preconfigure_kernel_parameters_default }}"` +- _Default:_ (set in vars file) The Linux kernel parameters to use. By default, these are taken from the vars file.
+The default for this parameter is set in the vars file which corresponds to the detected OS version.
Example: diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index 83fa80a04..29eea49d9 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -146,6 +146,7 @@ argument_specs: default: "{{ __sap_general_preconfigure_packagegroups }}" description: - The name of the software package group to install. + - The default for this parameter is set in the vars file which corresponds to the detected OS version. example: '@minimal-environment' required: false @@ -155,6 +156,7 @@ argument_specs: default: "{{ __sap_general_preconfigure_envgroups }}" description: - The name of the software environment group to check. + - The default for this parameter is set in the vars file which corresponds to the detected OS version. example: '@minimal-environment' required: false @@ -164,6 +166,7 @@ argument_specs: default: "{{ __sap_general_preconfigure_packages }}" description: - The list of packages to install. + - The default for this variable is set in the vars file which corresponds to the detected OS version. required: false type: list elements: str @@ -245,6 +248,7 @@ argument_specs: default: "{{ __sap_general_preconfigure_kernel_parameters_default }}" description: - The Linux kernel parameters to use. By default, these are taken from the vars file. + - The default for this parameter is set in the vars file which corresponds to the detected OS version. example: sap_general_preconfigure_kernel_parameters: - name: vm.max_map_count From 676fe42d2d91988a726231c36c5e3e02cd0b7c51 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 24 May 2023 16:22:29 +0200 Subject: [PATCH 059/128] sap_general_preconfigure: Improve the default message for variables which are set in vars files --- roles/sap_general_preconfigure/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index 097ceb8d9..e5eea553a 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -145,7 +145,7 @@ If you set the RHEL minor release, then you must also use the `eus` or `e4s` rep ### sap_general_preconfigure_packagegroups - _Type:_ `str` -- _Default:_ (set in vars file) +- _Default:_ (set by platform/environment specific variables) The name of the software package group to install.
The default for this parameter is set in the vars file which corresponds to the detected OS version.
@@ -158,7 +158,7 @@ Example: ### sap_general_preconfigure_envgroups - _Type:_ `str` -- _Default:_ (set in vars file) +- _Default:_ (set by platform/environment specific variables) The name of the software environment group to check.
The default for this parameter is set in the vars file which corresponds to the detected OS version.
@@ -171,7 +171,7 @@ Example: ### sap_general_preconfigure_packages - _Type:_ `list` with elements of type `str` -- _Default:_ (set in vars file) +- _Default:_ (set by platform/environment specific variables) The list of packages to install.
The default for this variable is set in the vars file which corresponds to the detected OS version.
@@ -242,7 +242,7 @@ The file name of the sysctl config file to be used
### sap_general_preconfigure_kernel_parameters - _Type:_ `list` with elements of type `dict` -- _Default:_ (set in vars file) +- _Default:_ (set by platform/environment specific variables) The Linux kernel parameters to use. By default, these are taken from the vars file.
The default for this parameter is set in the vars file which corresponds to the detected OS version.
From c4ab22c354b4239133e4ca834271576ad21b9ff9 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 24 May 2023 19:34:40 +0200 Subject: [PATCH 060/128] sap_general_preconfigure: Further improvements to README.md and defaults/main.yml --- roles/sap_general_preconfigure/README.md | 4 ++-- roles/sap_general_preconfigure/defaults/main.yml | 8 ++++++-- roles/sap_general_preconfigure/meta/argument_specs.yml | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index e5eea553a..5ddf95e2b 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -140,7 +140,7 @@ sap_general_preconfigure_req_repos: - _Type:_ `bool` - _Default:_ `false` -Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`.
+Set to `true` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `false`.
If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos.
### sap_general_preconfigure_packagegroups @@ -232,7 +232,7 @@ The size of the tmpfs in GB. The formula used here is mentioned in SAP note 9417 - _Type:_ `bool` - _Default:_ `true` -Set to `no` if you do not want the role to modify the `/etc/hosts` file.
+Set to `false` if you do not want the role to modify the `/etc/hosts` file.
### sap_general_preconfigure_etc_sysctl_sap_conf - _Type:_ `str` diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index 25b67d31d..d2c70a552 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -61,19 +61,22 @@ sap_general_preconfigure_disable_all_other_repos: true # Example: See README.md sap_general_preconfigure_set_minor_release: false -# Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. +# Set to `true` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `false`. # If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos. sap_general_preconfigure_packagegroups: "{{ __sap_general_preconfigure_packagegroups }}" # The name of the software package group to install. +# The default for this parameter is set in the vars file which corresponds to the detected OS version. # Example: See README.md sap_general_preconfigure_envgroups: "{{ __sap_general_preconfigure_envgroups }}" # The name of the software environment group to check. +# The default for this parameter is set in the vars file which corresponds to the detected OS version. # Example: See README.md sap_general_preconfigure_packages: "{{ __sap_general_preconfigure_packages }}" # The list of packages to install. +# The default for this variable is set in the vars file which corresponds to the detected OS version. sap_general_preconfigure_min_package_check: true # The default is to install or check if the minimum package versions are installed as defined in the vars files. @@ -107,13 +110,14 @@ sap_general_preconfigure_size_of_tmpfs_gb: "{{ ((0.75 * (ansible_memtotal_mb + a # The size of the tmpfs in GB. The formula used here is mentioned in SAP note 941735. sap_general_preconfigure_modify_etc_hosts: true -# Set to `no` if you do not want the role to modify the `/etc/hosts` file. +# Set to `false` if you do not want the role to modify the `/etc/hosts` file. sap_general_preconfigure_etc_sysctl_sap_conf: '/etc/sysctl.d/sap.conf' # The file name of the sysctl config file to be used sap_general_preconfigure_kernel_parameters: "{{ __sap_general_preconfigure_kernel_parameters_default }}" # The Linux kernel parameters to use. By default, these are taken from the vars file. +# The default for this parameter is set in the vars file which corresponds to the detected OS version. # Example: See README.md sap_general_preconfigure_max_hostname_length: '13' diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index 29eea49d9..86ed14dd9 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -137,7 +137,7 @@ argument_specs: sap_general_preconfigure_set_minor_release: default: false description: - - Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. + - Set to `true` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `false`. - If you set the RHEL minor release, then you must also use the `eus` or `e4s` repos. required: false type: bool @@ -233,7 +233,7 @@ argument_specs: sap_general_preconfigure_modify_etc_hosts: default: true description: - - Set to `no` if you do not want the role to modify the `/etc/hosts` file. + - Set to `false` if you do not want the role to modify the `/etc/hosts` file. required: false type: bool From 195cb2050bddc863ed3d626cd57d717b8da5ba57 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Fri, 26 May 2023 21:34:55 +0100 Subject: [PATCH 061/128] sap_swpm: append var for aas --- roles/sap_swpm/defaults/main.yml | 2 ++ roles/sap_swpm/templates/configfile.j2 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/sap_swpm/defaults/main.yml b/roles/sap_swpm/defaults/main.yml index b205b6a4e..1ed9f0143 100644 --- a/roles/sap_swpm/defaults/main.yml +++ b/roles/sap_swpm/defaults/main.yml @@ -179,6 +179,8 @@ sap_swpm_ers_instance_nr: "" sap_swpm_ers_instance_hostname: "" sap_swpm_pas_instance_nr: "" sap_swpm_pas_instance_hostname: "" +sap_swpm_aas_instance_nr: "" +sap_swpm_aas_instance_hostname: "" sap_swpm_java_scs_instance_nr: "" diff --git a/roles/sap_swpm/templates/configfile.j2 b/roles/sap_swpm/templates/configfile.j2 index bd15d3fb7..a4148526e 100644 --- a/roles/sap_swpm/templates/configfile.j2 +++ b/roles/sap_swpm/templates/configfile.j2 @@ -559,7 +559,7 @@ NW_CI_Instance.ciInstanceNumber = {{ sap_swpm_pas_instance_nr }} # Formerly called the Dialog Instance (DI). ###### # Instance number of SAP NetWeaver Application Server. Leave empty for default. -NW_AS.instanceNumber = {{ sap_swpm_pas_instance_nr }} +NW_AS.instanceNumber = {{ sap_swpm_aas_instance_nr }} # Do not skip unpacking archives if adding the SAP NetWeaver Application Server to another operating system / host. Default is 'false'. # NW_AS.skipUnpacking = false @@ -568,7 +568,7 @@ NW_AS.instanceNumber = {{ sap_swpm_pas_instance_nr }} # NW_AS.start = true # Virtual host name of the SAP NetWeaver Application Server instance. Leave empty to use the existing host name -NW_DI_Instance.virtualHostname = {{ ansible_hostname }} +NW_DI_Instance.virtualHostname = {{ sap_swpm_aas_instance_hostname }} {% endif %} {% if 'nw_config_ers' in sap_swpm_inifile_list %} From 597328dfe481ee42fd186e6c08e7c895c5a34a7d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 31 May 2023 12:54:29 +0000 Subject: [PATCH 062/128] sap_storage_setup: adjusted arg specs order and fixed requires --- .../sap_storage_setup/meta/argument_specs.yml | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index b2ab69241..27fbb8458 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -44,25 +44,12 @@ argument_specs: required: true type: list options: - name: - description: - - A name of the filesystem definition entry. - - This name is used to generate volume group name and logical volume name. - required: true - type: str - - mountpoint: - description: - - The path to where the filesystem will be mounted. - - This can be left out for the definition of a swap volume. - required: false - type: str disk_size: description: - Size of the disk device that is used for the filesystem. - For filesystems with no LVM logical volume striping, this is the end size of the filesystem. - - For filesystems with LVM lv striping defined, this the size of each disk. Filesystem size will result in disk_size multiplied by amount of stripes (=disks). + - For filesystems with LVM lv striping defined, this the size of each disk. Filesystem size will result in disk_size multiplied by amount of `lvm_lv_stripes` (=disks). required: false type: str @@ -110,18 +97,18 @@ argument_specs: required: false type: str - nfs_path: + mountpoint: description: - - When defining an NFS filesystem, this is the directory path of the filesystem to be mounted. + - The path to where the filesystem will be mounted. + - This can be left out for the definition of a swap volume. required: false type: str - nfs_server: + name: description: - - When defining an NFS filesystem, this is the address of the NFS server. - - The address must contain the root path, in which the mount directories exist or will be created. - - For example, `192.168.1.100:/`. - required: false + - A name of the filesystem definition entry. + - This name is used to generate volume group name and logical volume name. + required: true type: str nfs_filesystem_type: @@ -139,6 +126,20 @@ argument_specs: required: false type: str + nfs_path: + description: + - When defining an NFS filesystem, this is the directory path of the filesystem to be mounted. + required: false + type: str + + nfs_server: + description: + - When defining an NFS filesystem, this is the address of the NFS server. + - The address must contain the root path, in which the mount directories exist or will be created. + - For example, `192.168.1.100:/`. + required: false + type: str + swap_path: description: - The path to the swap file. @@ -152,7 +153,7 @@ argument_specs: - The type of service the target system is going to be configured for. - This can be a list of multiple types which apply to a single host. - If not defined, the default will be inherited from the global parameter `sap_host_type`. - required: true + required: false # type can be list or string, the code will convert it to a list sap_storage_setup_sid: From 553f3b94672fce51335e9214b171dfca435e53d2 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 31 May 2023 17:40:43 +0200 Subject: [PATCH 063/128] sap_hana_preconfigure: Initial version of meta/argument_specs.yml --- roles/sap_hana_preconfigure/defaults/main.yml | 66 +-- .../meta/argument_specs.yml | 377 ++++++++++++++++++ roles/sap_hana_preconfigure/vars/main.yml | 22 +- 3 files changed, 424 insertions(+), 41 deletions(-) create mode 100644 roles/sap_hana_preconfigure/meta/argument_specs.yml diff --git a/roles/sap_hana_preconfigure/defaults/main.yml b/roles/sap_hana_preconfigure/defaults/main.yml index 64f2b172c..a7456446b 100644 --- a/roles/sap_hana_preconfigure/defaults/main.yml +++ b/roles/sap_hana_preconfigure/defaults/main.yml @@ -10,31 +10,31 @@ # 1 - set sap_hana_preconfigure_config_all to `no` (default is `yes`), # 2 - set sap_hana_preconfigure_installation or sap_hana_preconfigure_configuration, or both, to `yes` (default for both is `no`) # 3 - and set one or more of the SAP notes related variables to `yes`: -#sap_hana_preconfigure_config_all: no -#sap_hana_preconfigure_installation: yes -#sap_hana_preconfigure_configuration: yes +#sap_hana_preconfigure_config_all: false +#sap_hana_preconfigure_installation: true +#sap_hana_preconfigure_configuration: true ## examples for RHEL7: -#sap_hana_preconfigure_2292690_02: yes -#sap_hana_preconfigure_2292690_05: yes -#sap_hana_preconfigure_2009879_3_9: yes -#sap_hana_preconfigure_2009879_3_14_1: yes -#sap_hana_preconfigure_2009879_3_14_2: yes -#sap_hana_preconfigure_2009879_3_14_3: yes -#sap_hana_preconfigure_2009879_3_14_4: yes +#sap_hana_preconfigure_2292690_02: true +#sap_hana_preconfigure_2292690_05: true +#sap_hana_preconfigure_2009879_3_9: true +#sap_hana_preconfigure_2009879_3_14_1: true +#sap_hana_preconfigure_2009879_3_14_2: true +#sap_hana_preconfigure_2009879_3_14_3: true +#sap_hana_preconfigure_2009879_3_14_4: true ## examples for RHEL8: -#sap_hana_preconfigure_2777782_03: yes -#sap_hana_preconfigure_2777782_10: yes +#sap_hana_preconfigure_2777782_03: true +#sap_hana_preconfigure_2777782_10: true ## both: -#sap_hana_preconfigure_2382421: yes +#sap_hana_preconfigure_2382421: true # Perform an assertion run: -sap_hana_preconfigure_assert: no +sap_hana_preconfigure_assert: false # In case of an assertion run, if set to `yes`, the role will abort for any assertion error: -sap_hana_preconfigure_assert_ignore_errors: no +sap_hana_preconfigure_assert_ignore_errors: false # In case of an assertion run, if set to `yes`, check all configuration steps no matter if tuned or static configuration has been selected: -sap_hana_preconfigure_assert_all_config: no +sap_hana_preconfigure_assert_all_config: false # Set which Ansible Collection to use for the Linux System Roles. # For community/upstream, use 'fedora.linux_system_roles' @@ -42,13 +42,13 @@ sap_hana_preconfigure_assert_all_config: no sap_hana_preconfigure_system_roles_collection: 'fedora.linux_system_roles' # Perform a RHEL minor release check for SAP HANA: -sap_hana_preconfigure_min_rhel_release_check: yes +sap_hana_preconfigure_min_rhel_release_check: true # supported RHEL minor releases for SAP HANA: sap_hana_preconfigure_supported_rhel_minor_releases: "{{ __sap_hana_preconfigure_supported_rhel_minor_releases }}" # Set to `yes` if you want the role to enable SAP HANA repos. The default is `no`. -sap_hana_preconfigure_enable_sap_hana_repos: no +sap_hana_preconfigure_enable_sap_hana_repos: false # Change one or more of the following in case you want different repos to be enabled than defined in vars. sap_hana_preconfigure_req_repos_redhat_7_x86_64: "{{ __sap_hana_preconfigure_req_repos_redhat_7_x86_64 }}" @@ -59,12 +59,12 @@ sap_hana_preconfigure_req_repos_redhat_9_x86_64: "{{ __sap_hana_preconfigure_req sap_hana_preconfigure_req_repos_redhat_9_ppc64le: "{{ __sap_hana_preconfigure_req_repos_redhat_9_ppc64le }}" # Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. -sap_hana_preconfigure_set_minor_release: no +sap_hana_preconfigure_set_minor_release: false # Set to 'no' if you do not want the SAP HANA directories to be created by the role. Default is 'yes'. # Note: The SAP HANA directories will always be created if 'sap_hana_preconfigure_modify_selinux_labels' # (see below) is set to 'yes', no matter how 'sap_hana_preconfigure_create_directories' is set. -sap_hana_preconfigure_create_directories: yes +sap_hana_preconfigure_create_directories: true # HANA directories to be created sap_hana_preconfigure_hana_directories: @@ -79,7 +79,7 @@ sap_hana_preconfigure_hana_directories: # If relabeling not desired, set the following variable to `no`. # Note: If the variable is set to 'yes', which is the default, the SAP HANA directories will be created # no matter how the variable 'sap_hana_preconfigure_create_directories' (see above) is set. -sap_hana_preconfigure_modify_selinux_labels: yes +sap_hana_preconfigure_modify_selinux_labels: true # HANA Major and minor version # These variables are used in other SAP HANA related roles, e.g. sap-hana-mediacheck. @@ -93,16 +93,16 @@ sap_hana_preconfigure_packages: "{{ __sap_hana_preconfigure_packages }}" # SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581. # Set to no if you want to ignore these requirements. -sap_hana_preconfigure_min_package_check: yes +sap_hana_preconfigure_min_package_check: true # Set the following variable to `yes` if you want to run "yum update" during the installation part: -sap_hana_preconfigure_update: no +sap_hana_preconfigure_update: false # Set the following variable to `yes` if you want the role to reboot the server if necessary: -sap_hana_preconfigure_reboot_ok: no +sap_hana_preconfigure_reboot_ok: false # Set the following variable to `no` if you want the role to not fail if a reboot is required: -sap_hana_preconfigure_fail_if_reboot_required: yes +sap_hana_preconfigure_fail_if_reboot_required: true ### # @@ -126,17 +126,17 @@ sap_hana_preconfigure_kernel_parameters: "{{ __sap_hana_preconfigure_kernel_para sap_hana_preconfigure_kernel_parameters_ppc64le: "{{ __sap_hana_preconfigure_kernel_parameters_default_ppc64le }}" -sap_hana_preconfigure_use_netapp_settings_nfs: no +sap_hana_preconfigure_use_netapp_settings_nfs: false -sap_hana_preconfigure_use_netapp_settings_nfsv3: no +sap_hana_preconfigure_use_netapp_settings_nfsv3: false # Set the following variable to 'no' if you do not want to install the IBM Power Systems service and productivity tools: -sap_hana_preconfigure_install_ibm_power_tools: yes +sap_hana_preconfigure_install_ibm_power_tools: true # Set the following variable to 'no' if you do not want to add the IBM Power tools repository (e.g. because the packages # are already available on the local network). Note that the IBM Power Systems service and productivity tools will only # be installed if the variable sap_hana_preconfigure_install_ibm_power_tools is set to `yes`, which is the default. -sap_hana_preconfigure_add_ibm_power_repo: yes +sap_hana_preconfigure_add_ibm_power_repo: true # sap_hana_preconfigure_ibm_power_repo_url: 'http://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-3.0.0-19.noarch.rpm' # sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' @@ -154,13 +154,13 @@ sap_hana_preconfigure_ppcle_tso_if: "{{ ansible_interfaces | difference(['lo']) # SELinux is already configured in role sap_general_preconfigure: #sap_hana_preconfigure_selinux_state: "{{ __sap_hana_preconfigure_selinux_state }}" -sap_hana_preconfigure_use_tuned: yes +sap_hana_preconfigure_use_tuned: true -sap_hana_preconfigure_tuned_profile: "{{ __sap_hana_preconfigure_tuned_profile }}" +sap_hana_preconfigure_tuned_profile: 'sap-hana' -sap_hana_preconfigure_modify_grub_cmdline_linux: no +sap_hana_preconfigure_modify_grub_cmdline_linux: false -sap_hana_preconfigure_run_grub2_mkconfig: "{{ __sap_hana_preconfigure_run_grub2_mkconfig }}" +sap_hana_preconfigure_run_grub2_mkconfig: true # Use the following variable to specify the name of the RHEL group which is used for the database processes # (if it exists, it will be used to configure process limits as per step diff --git a/roles/sap_hana_preconfigure/meta/argument_specs.yml b/roles/sap_hana_preconfigure/meta/argument_specs.yml new file mode 100644 index 000000000..15a9b12e9 --- /dev/null +++ b/roles/sap_hana_preconfigure/meta/argument_specs.yml @@ -0,0 +1,377 @@ +--- +# Requires: ansible 2.11 +# Argument specifications in this separate file maintain backwards compatibility. +argument_specs: + + main: + short_description: Variables for SAP HANA preconfiguration + options: + +# sap_hana_preconfigure_... +# default: +# description: +# - +# example: +# +# required: false +# type: +# options: # additional options for lists and dicts +# : +# description: +# ... + + sap_hana_preconfigure_config_all: + description: + - If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes. + - Default is to perform installation and configuration steps. + required: false + type: bool + + sap_hana_preconfigure_installation: + description: + - If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the + - installation steps of SAP notes. + required: false + type: bool + + sap_hana_preconfigure_configuration: + description: + - If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the + - configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. + example: + sap_hana_preconfigure_config_all: false + sap_hana_preconfigure_configuration: true + sap_hana_preconfigure_2772999_04: true + sap_hana_preconfigure_2382421: true + required: false + type: bool + + sap_hana_preconfigure_assert: + default: false + description: + - If set to `true`, the role will run in assertion mode instead of the default configuration mode. + required: false + type: bool + + sap_hana_preconfigure_assert_ignore_errors: + default: false + description: + - In assertion mode, the role will abort when encountering any assertion error. + - If this parameter is set to `false`, the role will *not* abort when encountering an assertion error. + - This is useful if the role is used for reporting a system's SAP notes compliance. + required: false + type: bool + + sap_hana_preconfigure_system_roles_collection: + default: 'fedora.linux_system_roles' + description: + - Set which Ansible Collection to use for the Linux System Roles. + - For community/upstream, use 'fedora.linux_system_roles' + - For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' + choices: + - 'fedora.linux_system_roles' + - 'redhat.rhel_system_roles' + required: false + type: str + + sap_hana_preconfigure_min_rhel_release_check: + default: true + description: + - Check the RHEL release against a predefined list of known SAP HANA supported RHEL minor releases. + - If this parameter is set to `false`, the role will *not* perform this check. + type: bool + + sap_hana_preconfigure_supported_rhel_minor_releases: + default: "{{ __sap_hana_preconfigure_supported_rhel_minor_releases }}" + description: + - Use this parameter to set your own list of SAP HANA supported RHEL minor releases. + required: false + type: list + elements: str + + sap_hana_preconfigure_enable_sap_hana_repos: + default: false + description: + - Set to 'true' to enable the SAP HANA required RHEL repos. + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_use_hana_repos`. + required: false + type: bool + + sap_hana_preconfigure_req_repos_redhat_7_x86_64: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_7_x86_64 }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 7 repos on x86_64' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_req_repos_redhat_7_ppc64le: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_7_ppc64le }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 7 repos on ppc64le' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_req_repos_redhat_8_x86_64: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_8_x86_64 }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 8 repos on x86_64' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_req_repos_redhat_8_ppc64le: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_8_ppc64le }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 8 repos on ppc64le' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_req_repos_redhat_9_x86_64: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_9_x86_64 }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 9 repos on x86_64' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_req_repos_redhat_9_ppc64le: + default: "{{ __sap_hana_preconfigure_req_repos_redhat_9_ppc64le }}" + description: + - Use this parameter to set your own list of SAP HANA required RHEL 9 repos on ppc64le' + - This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. + - The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + required: false + type: list + elements: str + + sap_hana_preconfigure_set_minor_release: + default: false + description: + - Use this parameter to set the RHEL minor release, which is required for SAP HANA. + - The related parameter is `sap_general_preconfigure_set_minor_release`. + required: false + type: str + + sap_hana_preconfigure_create_directories: + default: true + description: + - Set to `false` if you do not want the SAP HANA directories to be created by the role. + - The SAP HANA directories will always be created if `sap_hana_preconfigure_modify_selinux_labels` + - (see below) is set to `true`, no matter how `sap_hana_preconfigure_create_directories` is set. + required: false + type: bool + + sap_hana_preconfigure_hana_directories: + default: + - '/hana' + - '/lss/shared' + description: + - List of SAP HANA directories to be created. + required: false + type: list + elements: str + + sap_hana_preconfigure_modify_selinux_labels: + default: true + description: + - For compatibility of SAP HANA with SELinux in enforcing mode, the role will recursively add + - the `usr_t` label to directories and files in the directories where HANA is installed. + - If relabeling not desired, set this parameter `false`. + - If the variable is set to `true`, the SAP HANA directories will be created no matter + - how the variable `sap_hana_preconfigure_create_directories` (see above) is set. + required: false + type: bool + + sap_hana_preconfigure_packages: + default: "{{ __sap_hana_preconfigure_packages }}" + description: + - List of RHEL packages to be installed for SAP HANA. For RHEL 8 and later, you can choose to install either the default list + - or a list of the minimum required packages for SAP HANA server (parameter `__sap_hana_preconfigure_packages_min_install`). + required: false + type: list + elements: str + + sap_hana_preconfigure_min_package_check: + default: 'true' + description: + - SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581. + - Set this parameter to `false` if you want to ignore these requirements. + required: false + type: bool + + sap_hana_preconfigure_update: + default: 'false' + description: + - Set this parameter to `true` to update the system to the latest package levels. + - By setting the parameter `sap_general_preconfigure_set_minor_release` of the + - role `sap_general_preconfigure` to `true`, you can install the most recent package updates + - without updating to a more recent RHEL minor release. + required: false + type: bool + + sap_hana_preconfigure_reboot_ok: + default: false + description: + - Set to `true` if you want to perform a reboot at the end of the role, if necessary. + required: false + type: bool + + sap_hana_preconfigure_fail_if_reboot_required: + default: true + description: + - If `sap_hana_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not + - remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior. + - Can be useful if you want to implement your own reboot handling. + required: false + type: bool + + sap_hana_preconfigure_kernel_parameters: + default: "{{ __sap_hana_preconfigure_kernel_parameters_default }}" + description: + - Network related linux kernel parameter settings for SAP HANA on all hardware platforms. + required: false + type: list + elements: str + + sap_hana_preconfigure_kernel_parameters_ppc64le: + default: "{{ __sap_hana_preconfigure_kernel_parameters_default_ppc64le }}" + description: + - Network related linux kernel parameter settings for platform ppc64le. + required: false + type: list + elements: str + + sap_hana_preconfigure_use_netapp_settings_nfs: + default: false + description: + - Set to `true` to also set NetApp NFS required kernel parameters. + required: false + type: bool + + sap_hana_preconfigure_use_netapp_settings_nfsv3: + default: false + description: + - If `sap_hana_preconfigure_use_netapp_settings_nfs` is set to `true` and NFS Version 3 is to be used, + - this parameter must be set to `true` as well. + required: false + type: bool + + sap_hana_preconfigure_install_ibm_power_tools: + default: true + description: + - Set this parameter to `false` to not install the IBM Power Systems service and productivity tools. + required: false + type: bool + + sap_hana_preconfigure_add_ibm_power_repo: + default: true + description: + - Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages + - are already available on the local network). The IBM Power Systems service and productivity tools will only + - be installed if the variable `sap_hana_preconfigure_install_ibm_power_tools` is set to `true`, which is the default. + required: false + type: bool + + sap_hana_preconfigure_ibm_power_repo_url: + default: "{{ __sap_hana_preconfigure_ibm_power_repo_url }}" + description: + - URL of the IBM Power tools repository. + required: false + type: str + + sap_hana_preconfigure_ppcle_mtu9000_if: + default: [] + description: + - List of interfaces for which the MTU size will be set to `9000`. + required: false + type: list + elements: str + + sap_hana_preconfigure_ppcle_tso_if: + default: "{{ ansible_interfaces | difference(['lo']) }}" + description: + - List of interfaces for which the tso flag will be set. + required: false + type: list + elements: str + + sap_hana_preconfigure_use_tuned: + default: true + description: + - Use tuned for configuring most of the kernel settings for SAP HANA + - Set this parameter to `false` to use static kernel settings + required: false + type: bool + + sap_hana_preconfigure_tuned_profile: + default: 'sap-hana' + description: + - Name of the SAP HANA tuned tuned profile to enable (RHEL). + required: false + type: str + + sap_hana_preconfigure_modify_grub_cmdline_linux: + default: false + description: + - Set this parameter to `true` to modify the Grub boot command line. + required: false + type: bool + + sap_hana_preconfigure_run_grub2_mkconfig: + default: true + description: + - By default, the role will run `grub2-mkconfig` to update the Grub configuration if necessary. + - Set this parameter to `false` if this is not desired. + required: false + type: bool + + sap_hana_preconfigure_db_group_name: + default: 'dba' + description: + - Use this parameter to specify the name of the RHEL group which is used for the database processes. + - It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999. + required: false + type: str + + sap_hana_preconfigure_saptune_version: + default: '3.0.2' + description: + - Version of saptune to install (SLES for SAP Applications). + - This will replace the current installed version if present, even downgrade if necessary. + required: false + type: str + + sap_hana_preconfigure_saptune_solution: + default: HANA + description: + - The saptune solution to apply (SLES for SAP Applications). + choices: + - 'HANA' + - 'NETWEAVER+HANA' + - 'S4HANA-APP+DB' + - 'S4HANA-DBSERVER' + required: false + type: str + + sap_hana_preconfigure_saptune_azure: + default: false + description: + - On Azure, TCP timestamps, reuse and recycle should be disabled (SLES for SAP Applications). + - Set this parameter to `true` on Azure. + required: false + type: bool + diff --git a/roles/sap_hana_preconfigure/vars/main.yml b/roles/sap_hana_preconfigure/vars/main.yml index 08a489791..48003185c 100644 --- a/roles/sap_hana_preconfigure/vars/main.yml +++ b/roles/sap_hana_preconfigure/vars/main.yml @@ -5,14 +5,20 @@ # # Default parameter file for sysctl settings according to SAP NOTE 2382421 -__sap_hana_preconfigure_etc_sysctl_saphana_conf: /etc/sysctl.d/sap_hana.conf +__sap_hana_preconfigure_etc_sysctl_saphana_conf: '/etc/sysctl.d/sap_hana.conf' # Default parameter file for sysctl settings according to SAP NOTE 3024346 -__sap_hana_preconfigure_etc_sysctl_netapp_hana_conf: /etc/sysctl.d/91-NetApp-HANA.conf +__sap_hana_preconfigure_etc_sysctl_netapp_hana_conf: '/etc/sysctl.d/91-NetApp-HANA.conf' -# SELinux is already configured in role sap_general_preconfigure: -#__sap_hana_preconfigure_selinux_state: disabled - -__sap_hana_preconfigure_tuned_profile: 'sap-hana' - -__sap_hana_preconfigure_run_grub2_mkconfig: yes +# dummy entries for passing the arg spec validation: +__sap_hana_preconfigure_supported_rhel_minor_releases: [] +__sap_hana_preconfigure_req_repos_redhat_7_x86_64: [] +__sap_hana_preconfigure_req_repos_redhat_7_ppc64le: [] +__sap_hana_preconfigure_req_repos_redhat_8_x86_64: [] +__sap_hana_preconfigure_req_repos_redhat_8_ppc64le: [] +__sap_hana_preconfigure_req_repos_redhat_9_x86_64: [] +__sap_hana_preconfigure_req_repos_redhat_9_ppc64le: [] +__sap_hana_preconfigure_packages: [] +__sap_hana_preconfigure_kernel_parameters_default: [] +__sap_hana_preconfigure_kernel_parameters_default_ppc64le: [] +__sap_hana_preconfigure_ibm_power_repo_url: '' From de58cd2cdeb70fcafed80162c5678cfd21a0658d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 1 Jun 2023 12:39:43 +0000 Subject: [PATCH 064/128] sap_storage_setup: cosmetical / wording --- roles/sap_storage_setup/meta/argument_specs.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index 27fbb8458..cf36e2a43 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -48,8 +48,8 @@ argument_specs: disk_size: description: - Size of the disk device that is used for the filesystem. - - For filesystems with no LVM logical volume striping, this is the end size of the filesystem. - - For filesystems with LVM lv striping defined, this the size of each disk. Filesystem size will result in disk_size multiplied by amount of `lvm_lv_stripes` (=disks). + - For filesystems with no LVM logical volume striping, this is the total size of the filesystem. + - For filesystems with LVM LV striping defined (`lvm_lv_stripes`), this is the size of each disk. The resulting filesystem size will be `disk_size` multiplied by `lvm_lv_stripes` (=disks). required: false type: str @@ -61,10 +61,9 @@ argument_specs: type: str lvm_lv_name: - default: lv_ description: - The name of the LVM volume. - - The default name is derived from the name value of the filesystem definition entry. + - The default name is derived from the name value of the filesystem definition entry, for example 'lv_hanalog'. required: false type: str @@ -72,6 +71,7 @@ argument_specs: default: 1 description: - Number of disks that will be configured in a striped volume. + - This requires the availability of the same amount of unused disks, which must be of the size defined in `disk_size`. required: false type: int @@ -83,10 +83,9 @@ argument_specs: type: str lvm_vg_name: - default: vg_ description: - The name of the LVM volume group. - - The default name is derived from the name value of the filesystem definition entry. + - The default name is derived from the name value of the filesystem definition entry, for example 'vg_hanalog'. required: false type: str From a6f798ad240e5348956023f0e02bfa2b917696c3 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 1 Jun 2023 12:46:32 +0000 Subject: [PATCH 065/128] sap_storage_setup: improvements and sample playbook --- .../sample-storage_sap_s4hana_distributed.yml | 205 ++++++++++++++++++ roles/sap_storage_setup/README.md | 201 ++++++++++------- .../sap_storage_setup/meta/argument_specs.yml | 18 +- roles/sap_storage_setup/tasks/main.yml | 6 +- 4 files changed, 335 insertions(+), 95 deletions(-) create mode 100644 playbooks/sample-storage_sap_s4hana_distributed.yml diff --git a/playbooks/sample-storage_sap_s4hana_distributed.yml b/playbooks/sample-storage_sap_s4hana_distributed.yml new file mode 100644 index 000000000..510d0b1a7 --- /dev/null +++ b/playbooks/sample-storage_sap_s4hana_distributed.yml @@ -0,0 +1,205 @@ +--- + +- name: Complete Infrastructure setup + hosts: hana_primary, nwas_ascs, nwas_pas, nwas_aas + become: true + any_errors_fatal: true + + vars: + + sap_system_sid: "S01" + sap_system_hana_db_sid: "H01" + sap_system_hana_db_instance_nr: "90" + sap_system_nwas_abap_ascs_instance_nr: "00" + sap_system_nwas_abap_pas_instance_nr: "01" + sap_system_nwas_abap_aas_instance_nr: "11" + + nfs_mount_point: "fs-1234567890.efs.eu-west-2.amazonaws.com:/" + nfs_mount_point_separate_sap_transport_dir: "fs-0987654321.efs.eu-west-2.amazonaws.com:/" + nfs_mount_point_type: nfs4 + nfs_mount_point_opts: nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,acl,noauto # should include noauto to avoid /etc/fstab mount on boot, when Linux Pacemaker should control mount + + host_specifications_dictionary: + + hana-p: # hostname + # hana_primary, hana_secondary, nwas_abap_ascs, nwas_abap_ers, nwas_abap_pas, nwas_abap_aas, nwas_java_scs, nwas_java_ers + sap_storage_setup_host_type: + - hana_primary + + storage_definition: + + # Commented out variables are the same for each filesystem, only shown once below to ease readability + - name: hana_data + mountpoint: /hana/data + disk_size: 384 # size in GB, integer + filesystem_type: xfs # default: xfs + #lvm_lv_name: # default: lv_ + #lvm_lv_stripes: 2 # default: null, number of disks to stripe over + #lvm_lv_stripe_size: 128K # default: 64K, defined by the OS. Akin to Virtualized Block Size + #lvm_vg_name: # default: vg_ + #lvm_vg_options: # default: none, additional LVM VG options as string in LVM options syntax (e.g. "--dataalignment XX ..." to override MiB offset from disk start before first LVM VG Physical Extent) + #lvm_vg_physical_extent_size: # default: 4, uses 4 MiB default and difficult to change once set. Akin to Physical Block Size + #lvm_pv_device: # default: discovered ansible_devices matching the target size + #lvm_pv_options: # default: none, additional LVM PV options as string in LVM options syntax (e.g. "--dataalignment XX ..." to override MiB offset from disk start before first LVM PV Physical Extent) + #nfs_path: # subdirectory path on the NFS server + #nfs_server: # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + #nfs_filesystem_type: # default: {{ sap_storage_setup_nfs_filesystem_type }} + #nfs_mount_options: # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: hana_log + mountpoint: /hana/log + disk_size: 128 # size in GB, integer + filesystem_type: xfs # default: xfs + + - name: hana_shared + mountpoint: /hana/shared + disk_size: 320 # size in GB, integer + filesystem_type: xfs # default: xfs + + - name: swap + swap_path: /swapfile # use swap file on root disk, instead of creating LVM LV for swap + disk_size: 2 + filesystem_type: swap # must be swap filesystem + + - name: software + mountpoint: /software + disk_size: 100 # size in GB, integer + filesystem_type: xfs # default: xfs + + + nw-ascs: # hostname + sap_storage_setup_sid: "{{ sap_system_sid }}" + sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ sap_system_nwas_abap_ascs_instance_nr }}" + + # hana_primary, hana_secondary, nwas_abap_ascs, nwas_abap_ers, nwas_abap_pas, nwas_abap_aas, nwas_java_scs, nwas_java_ers + sap_storage_setup_host_type: + - nwas_abap_ascs + + storage_definition: + + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point_separate_sap_transport_dir | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: sapmnt + mountpoint: /sapmnt + nfs_path: /sapmnt # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: swap + disk_size: 96 + filesystem_type: swap # must be swap filesystem + + - name: software + mountpoint: /software + disk_size: 100 # size in GB, integer + filesystem_type: xfs # default: xfs + + + nw-pas: # hostname + sap_storage_setup_sid: "{{ sap_system_sid }}" + sap_storage_setup_nwas_abap_pas_instance_nr: "{{ sap_system_nwas_abap_pas_instance_nr }}" + + # hana_primary, hana_secondary, nwas_abap_ascs, nwas_abap_ers, nwas_abap_pas, nwas_abap_aas, nwas_java_scs, nwas_java_ers + sap_storage_setup_host_type: + - nwas_abap_pas + + storage_definition: + + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point_separate_sap_transport_dir | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: sapmnt + mountpoint: /sapmnt + nfs_path: /sapmnt # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: swap + disk_size: 96 + filesystem_type: swap # must be swap filesystem + + - name: software + mountpoint: /software + disk_size: 100 # size in GB, integer + filesystem_type: xfs # default: xfs + + + nw-aas: # hostname + sap_storage_setup_sid: "{{ sap_system_sid }}" + sap_storage_setup_nwas_abap_aas_instance_nr: "{{ sap_system_nwas_abap_aas_instance_nr }}" + + # hana_primary, hana_secondary, nwas_abap_ascs, nwas_abap_ers, nwas_abap_pas, nwas_abap_aas, nwas_java_scs, nwas_java_ers + sap_storage_setup_host_type: + - nwas_abap_aas + + storage_definition: + + - name: usr_sap + mountpoint: /usr/sap + nfs_path: /usr/sap # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: usr_sap_trans + mountpoint: /usr/sap/trans + nfs_path: /usr/sap/trans # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point_separate_sap_transport_dir | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: sapmnt + mountpoint: /sapmnt + nfs_path: /sapmnt # subdirectory path on the NFS server + nfs_server: "{{ nfs_mount_point | default('') }}" # NFS server and parent directory (e.g. nfs.com:/share1). default: {{ sap_storage_setup_nfs_server }} + nfs_filesystem_type: "{{ nfs_mount_point_type | default('') }}" # default: {{ sap_storage_setup_nfs_filesystem_type }} + nfs_mount_options: "{{ nfs_mount_point_opts | default('') }}" # default: {{ sap_storage_setup_nfs_mount_options }} + + - name: swap + disk_size: 96 + filesystem_type: swap # must be swap filesystem + + - name: software + mountpoint: /software + disk_size: 100 # size in GB, integer + filesystem_type: xfs # default: xfs + + + tasks: + + - name: Execute Ansible Role sap_storage_setup + ansible.builtin.include_role: + name: { role: community.sap_install.sap_storage_setup } + vars: + sap_storage_setup_sid: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_sid | default('') }}" + sap_storage_setup_nwas_abap_ascs_instance_nr: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_nwas_abap_ascs_instance_nr | default('') }}" + sap_storage_setup_nwas_abap_ers_instance_nr: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_nwas_abap_ers_instance_nr | default('') }}" + sap_storage_setup_nwas_abap_pas_instance_nr: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_nwas_abap_pas_instance_nr | default('') }}" + sap_storage_setup_nwas_abap_aas_instance_nr: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_nwas_abap_aas_instance_nr | default('') }}" + sap_storage_setup_host_type: "{{ host_specifications_dictionary[ansible_hostname].sap_storage_setup_host_type | list }}" + sap_storage_setup_definition: "{{ host_specifications_dictionary[ansible_hostname].storage_definition | list }}" diff --git a/roles/sap_storage_setup/README.md b/roles/sap_storage_setup/README.md index 34a426f59..86b4cea60 100644 --- a/roles/sap_storage_setup/README.md +++ b/roles/sap_storage_setup/README.md @@ -1,85 +1,50 @@ # sap_storage_setup Ansible Role -Ansible role for preparing the storage requirements of an SAP system prior to installation - -- physical volumes -- volume groups -- logical volumes -- filesystems - -This can be used in 2 days - -- `generic` - using direct input of required directories, filesystems, physical volumes, volume groups, logical volumes, etc -- `cloud type` - by providing a cloud type, the role will determine the physical volumes by reading the VM meta data - -## Overview - -### Execution - -- Sample execution: - - ```bash - ansible-playbook --connection=local --limit localhost -i "localhost," sap-storage.yml -e "@input_file.yml" - ``` - -### Variables - -| **Variable** | **Info** | **Default** | **Required** | -| :--------------------- | :----------------------- | :---------- | :----------- | -| sap_storage_cloud_type | 'generic' / 'az' / 'aws' | 'generic' | yes | -| sap_storage_action | 'prepare' / 'remove' | 'prepare' | yes | - -### Input - -- Sample input: - - ```yaml - sap_storage_dict: - hanadata: - name: "hanadata" - directory: "/hana/data" - vg: "hanadatavg" - lv: "hanadatalv" - pv: ["/dev/sdb"] - numluns: "1" - stripesize: "" - hanalog: - name: "hanalog" - directory: "/hana/log" - vg: "hanalogvg" - lv: "hanaloglv" - pv: ["/dev/sdc", "/dev/sdd"] - numluns: "2" - stripesize: "32" - hanashared: - name: "hanashared" - directory: "/hana/shared" - vg: "hanasharedvg" - lv: "hanasharedlv" - pv: ["/dev/sde"] - numluns: "1" - stripesize: "" - usrsap: - name: "usrsap" - directory: "/usr/sap" - vg: "usrsapvg" - lv: "usrsaplv" - pv: ["/dev/sdf"] - numluns: "1" - stripesize: "" - sapmnt: - name: "sapmnt" - directory: "/sapmnt" - vg: "sapmntvg" - lv: "sapmntlv" - pv: ["/dev/sdg"] - numluns: "1" - stripesize: "" - ``` +Ansible Role for preparing a host with the storage requirements of an SAP System (prior to software installation) + +## Requirements + +The Ansible Role requires the `community.general` Ansible Collection (uses the `lvg`, `lvol` and `filesystem` Ansible modules). Before using this role, please make sure that the required collections are installed, for example by using the following command: `ansible-galaxy install community.general` + +## Scope + +This Ansible Role provides: +- local/block storage volumes setup as LVM Logical Volumes, Filesystem formatting and mount to defined directory path +- remote/file storage mount (and subdirectories as required) +- swap file or swap partition + +This role has been tested for the following SAP software deployment types: +- SAP HANA Scale-up, Scale-out and Scale-up High Availability +- SAP NetWeaver AS in Sandbox (Two-Tier/OneHost), Standard (Three-Tier/DualHost), Distributed (Multi-Tier) and Distributed High Availability + +This Ansible Role is agnostic, and will run on any Infrastructure Platform. Only LVM is used for local/block storage, to allow for further expansion if the SAP System requires further storage space in the future. + +Please note, while this Ansible Role has protection against overwrite of existing disks and filesystems - sensibile review and care is required for any automation of disk storage. Please review the documentation and samples/examples carefully. It is strongly suggested to run the Ansible Playbook calling this Ansible Role, with `ansible-playbook --check` for Check Mode. ## Prerequisites -Disks have been attached to the VM and have the appropriate labels (hanadat, hanashared etc) +All local/block storage volumes must be attached to the host, and all remote/file storage mounts must be available with host accessibility (e.g. port 2049). + +## Variables and Parameters + +There are 3 critical variables are: +- `sap_storage_setup_definition` - a list with a dictionary for each mountpoint (e.g. /hana/data) for the host +- `sap_storage_setup_host_type` - a list which defines SAP Software on the host (e.g. list containing both hana_primary and nwas_abap_ascs values if creating a Sandbox Two-Tier/OneHost) +- `sap_storage_setup_sid` - a string with the SAP System ID of the logical system (e.g. D01) + +## Execution Flow + +The Ansible Role is sequential: +- Get host facts +- Create list of unused disk devices +- Match/Map unused disk devices to the `sap_storage_setup_definition` +- Create LVM Logical Volumes (and prerequisite LVM Volume Groups and LVM Physical Volumes) +- Create swap file or swap partition +- Mount NFS temporarily, create required subdirectories, unmount and mount subdictory on the NFS share + +## Sample + +Please see a full sample using multiple hosts to create an SAP S/4HANA Distributed deployment in the [/playbooks](../../playbooks/) directory of the Ansible Collection `sap_install`. ## License @@ -87,4 +52,84 @@ Apache license 2.0 ## Author Information -IBM Lab for SAP Solutions, Red Hat for SAP Community of Practice +Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions + +--- + +## Role Input Parameters + +Minimum required parameters: + +- [sap_storage_setup_definition](#sap_storage_setup_definition) +- [sap_storage_setup_host_type](#sap_storage_setup_host_type) +- [sap_storage_setup_sid](#sap_storage_setup_sid) + + +### sap_storage_setup_definition required + +- _Type:_ `list` + +Describes the filesystems to be configured.
+ +- **disk_size**
+ Size of the disk device that is used for the filesystem.
For filesystems with no LVM logical volume striping, this is the total size of the filesystem.
For filesystems with LVM LV striping defined (`lvm_lv_stripes`), this is the size of each disk. The resulting filesystem size will be `disk_size` multiplied by `lvm_lv_stripes` (=disks). +- **filesystem_type**
+ _Default:_ `xfs`
+ The type of filesystem that will be created on the logical volume. +- **lvm_lv_name**
+ The name of the LVM volume.
The default name is derived from the name value of the filesystem definition entry, for example 'lv_hanalog'. +- **lvm_lv_stripe_size**
+ When setting up a striped volume, the stripe size can be defined.
Example format - "128K". +- **lvm_lv_stripes**
+ _Default:_ `1`
+ Number of disks that will be configured in a striped volume.
This requires the availability of the same amount of unused disks, which must be of the size defined in `disk_size`. +- **lvm_vg_name**
+ The name of the LVM volume group.
The default name is derived from the name value of the filesystem definition entry, for example 'vg_hanalog'. +- **lvm_vg_physical_extent_size**
+ _Default:_ `4`
+ Adjustable size of the physical extents of the volume group in LVM. +- **mountpoint**
+ The path to where the filesystem will be mounted.
This can be left out for the definition of a swap volume. +- **name**
+ A name of the filesystem definition entry.
This name is used to generate volume group name and logical volume name. +- **nfs_filesystem_type**
+ _Default:_ `nfs4`
+ The type of the NFS filesystem, for example `nfs`, `nfs4`. +- **nfs_mount_options**
+ Mount options to use for the NFS mount.
Generic default is `hard,acl`.
Defaults depend on the specific platform detected by the role or defined explicitly. +- **nfs_path**
+ When defining an NFS filesystem, this is the directory path of the filesystem to be mounted. +- **nfs_server**
+ When defining an NFS filesystem, this is the address of the NFS server.
The address must contain the root path, in which the mount directories exist or will be created.
For example, `192.168.1.100:/`. +- **swap_path**
+ The path to the swap file.
When this option is defined for a swap filesystem definition, it will create a swap file on an existing filesytem. + +Example: + +```yaml +sap_storage_setup_definition: +- disk_size: 100G + filesystem_type: xfs + mountpoint: /hana/data + name: hanadata +- disk_size: 100G + filesystem_type: xfs + mountpoint: /hana/log + name: hanalog +``` + +### sap_storage_setup_host_type required + + +The type of service the target system is going to be configured for.
+This can be a list of multiple types which apply to a single host.
+If not defined, the default will be inherited from the global parameter `sap_host_type`. One of these parameters must be defined.
+ +### sap_storage_setup_sid required + +- _Type:_ `str` + +SID of the SAP service.
+If not defined, the default will be inherited from the global parameter `sap_system_sid`. One of these parameters must be defined.
+ + diff --git a/roles/sap_storage_setup/meta/argument_specs.yml b/roles/sap_storage_setup/meta/argument_specs.yml index cf36e2a43..aac9c9aa1 100644 --- a/roles/sap_storage_setup/meta/argument_specs.yml +++ b/roles/sap_storage_setup/meta/argument_specs.yml @@ -50,21 +50,18 @@ argument_specs: - Size of the disk device that is used for the filesystem. - For filesystems with no LVM logical volume striping, this is the total size of the filesystem. - For filesystems with LVM LV striping defined (`lvm_lv_stripes`), this is the size of each disk. The resulting filesystem size will be `disk_size` multiplied by `lvm_lv_stripes` (=disks). - required: false type: str filesystem_type: default: xfs description: - The type of filesystem that will be created on the logical volume. - required: false type: str lvm_lv_name: description: - The name of the LVM volume. - The default name is derived from the name value of the filesystem definition entry, for example 'lv_hanalog'. - required: false type: str lvm_lv_stripes: @@ -72,14 +69,12 @@ argument_specs: description: - Number of disks that will be configured in a striped volume. - This requires the availability of the same amount of unused disks, which must be of the size defined in `disk_size`. - required: false type: int lvm_lv_stripe_size: description: - When setting up a striped volume, the stripe size can be defined. - Example format - "128K". - required: false type: str lvm_vg_name: @@ -93,14 +88,12 @@ argument_specs: default: 4 description: - Adjustable size of the physical extents of the volume group in LVM. - required: false type: str mountpoint: description: - The path to where the filesystem will be mounted. - This can be left out for the definition of a swap volume. - required: false type: str name: @@ -114,7 +107,6 @@ argument_specs: default: nfs4 description: - The type of the NFS filesystem, for example `nfs`, `nfs4`. - required: false type: str nfs_mount_options: @@ -122,13 +114,11 @@ argument_specs: - Mount options to use for the NFS mount. - Generic default is `hard,acl`. - Defaults depend on the specific platform detected by the role or defined explicitly. - required: false type: str nfs_path: description: - When defining an NFS filesystem, this is the directory path of the filesystem to be mounted. - required: false type: str nfs_server: @@ -136,14 +126,12 @@ argument_specs: - When defining an NFS filesystem, this is the address of the NFS server. - The address must contain the root path, in which the mount directories exist or will be created. - For example, `192.168.1.100:/`. - required: false type: str swap_path: description: - The path to the swap file. - When this option is defined for a swap filesystem definition, it will create a swap file on an existing filesytem. - required: false type: str @@ -151,13 +139,13 @@ argument_specs: description: - The type of service the target system is going to be configured for. - This can be a list of multiple types which apply to a single host. - - If not defined, the default will be inherited from the global parameter `sap_host_type`. - required: false + - If not defined, the default will be inherited from the global parameter `sap_host_type`. One of these parameters must be defined. + required: true # type can be list or string, the code will convert it to a list sap_storage_setup_sid: description: - SID of the SAP service. - - If not defined, the default will be inherited from the global parameter `sap_system_sid`. + - If not defined, the default will be inherited from the global parameter `sap_system_sid`. One of these parameters must be defined. required: true type: str diff --git a/roles/sap_storage_setup/tasks/main.yml b/roles/sap_storage_setup/tasks/main.yml index 6742da5f5..20202c080 100644 --- a/roles/sap_storage_setup/tasks/main.yml +++ b/roles/sap_storage_setup/tasks/main.yml @@ -152,8 +152,10 @@ - '"nfs" not in map_item.filesystem_type' - map_item.swap_path is not defined -#- debug: -# var: volume_map + +- name: SAP Storage Setup - Display local disk setup assignment + ansible.builtin.debug: + var: volume_map ################ From b64ddd6797bcf91aec9f4142339d3d1c317a9305 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 1 Jun 2023 18:24:44 +0200 Subject: [PATCH 066/128] sap_storage_setup: separate legacy parameters for future cleanup --- roles/sap_storage_setup/defaults/main.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/roles/sap_storage_setup/defaults/main.yml b/roles/sap_storage_setup/defaults/main.yml index 90099feb3..5dbd54980 100644 --- a/roles/sap_storage_setup/defaults/main.yml +++ b/roles/sap_storage_setup/defaults/main.yml @@ -28,9 +28,6 @@ sap_storage_setup_nwas_java_ci_instance_nr: '21' #----------------------------------------------------------# -sap_storage_setup_cloud_type: 'generic' -# generic | az | aws - sap_storage_setup_nfs_filesystem_type: nfs4 sap_storage_setup_nfs_mount_options: 'hard,acl' sap_storage_setup_local_filesystem_type: xfs @@ -55,6 +52,12 @@ sap_storage_setup_nfs_dirs_usr_sap: nwas_java_scs: - "{{ sap_storage_setup_sid }}/SCS{{ sap_storage_setup_nwas_java_scs_instance_nr }}" +##### +#### Legacy code - retain vars for commented out code, until decision on specific activities for each Cloud +###### + +sap_storage_setup_cloud_type: 'generic' +# generic | az | aws # Azure variables @@ -77,3 +80,4 @@ sap_storage_aws_vmsize_url: sap_storage_aws_vmsize: # IBM Cloud variables +# From fab1b40061767f168f34e65df6a804055c66ac06 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Sat, 3 Jun 2023 00:34:35 +0200 Subject: [PATCH 067/128] sap_hana_preconfigure: README.md and defaults/main.yml get created from meta/argument_specs.yml --- roles/sap_hana_preconfigure/README.md | 457 +++++++++++------- roles/sap_hana_preconfigure/defaults/main.yml | 229 +++++---- .../meta/argument_specs.yml | 8 +- 3 files changed, 390 insertions(+), 304 deletions(-) diff --git a/roles/sap_hana_preconfigure/README.md b/roles/sap_hana_preconfigure/README.md index 6340e2fbd..0e65509ae 100644 --- a/roles/sap_hana_preconfigure/README.md +++ b/roles/sap_hana_preconfigure/README.md @@ -90,233 +90,322 @@ sap_hana_preconfigure configure the SELinux state. Same applies to the assertion 3) SLES systems are now configured using saptune rather than the ansible implementation of the notes. -## Role Variables + +## Role Input Parameters -- set in `defaults/main.yml`: +#### Minimum required parameters: -### Execute only certain steps of SAP notes (RHEL only) -If the following variable is set to `no`, only certain steps of SAP notes will be executed or checked as per setting of variable `sap_hana_preconfigure__`. If this variable is undefined or set to `yes`, all installation and configuration steps of applicable SAP notes will be executed. -```yaml -sap_hana_preconfigure_config_all -``` +This role does not require any parameter to be set in the playbook or inventory. -### Perform installation or configuration steps, or both (RHEL only) -If you have set `sap_hana_preconfigure_config_all` (see above) to `no`, you can limit the scope of the role to only execute the installation or the configuration steps. For this purpose, set one of the following variables, or both, to `yes`. The default for both is `no`. -```yaml -sap_hana_preconfigure_installation -sap_hana_preconfigure_configuration -``` -### Define configuration steps of SAP notes (RHEL only) -For defining one or more configuration steps of SAP notes to be executed or checked only, set variable `sap_hana_preconfigure_config_all` to `no`, `sap_hana_preconfigure_configuration` to `yes`, and one or more of the following variables to `yes`: -```yaml -sap_hana_preconfigure_2777782_[02...10], example: sap_hana_preconfigure_2777782_05 -sap_hana_preconfigure_2292690_[01...07,09,10], example: sap_hana_preconfigure_2292690_02 -sap_hana_preconfigure_2009879_3_9 -sap_hana_preconfigure_2009879_3_14_[1...4] -sap_hana_preconfigure_2009879_3_15 -sap_hana_preconfigure_2382421 -sap_hana_preconfigure_3024346 -``` +### sap_hana_preconfigure_config_all +- _Type:_ `bool` -### Run the role in assert mode -If the following variable is set to `yes`, the role will only check if the configuration of the managed node(s) is according to the applicable SAP notes. Default is `no`. -```yaml -sap_hana_preconfigure_assert -``` +If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes.
+Default is to perform installation and configuration steps.
-### Behavior of the role in assert mode -If the role is run in assert mode (see above) and the following variable is set to `yes`, assertion errors will not cause the role to fail. This can be useful for creating reports. -Default is `no`, meaning that the role will fail for any assertion error which is discovered. This variable has no meaning if the role is not run in assert mode. -```yaml -sap_hana_preconfigure_assert_ignore_errors -``` +### sap_hana_preconfigure_installation +- _Type:_ `bool` -### Perform all configuration checks in assert mode -If the following variable is set to `yes`, if the role is configured with variable `sap_hana_preconfigure_assert` being set to `yes`, the role will check all configuration steps -no matter of the setting of the tuned and grub variables. Default is `no`, meaning that only those configuration steps are checked which are enabled by the tuned and grub variables. -Example: If variable `sap_hana_preconfigure_modify_grub_cmdline_linux` is set to `no`, when running the role in assert mode, the role will not check if the grub command line -has been modified according to this role. -```yaml -sap_hana_preconfigure_assert_all_config -``` +If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
+installation steps of SAP notes.
-### Perform a RHEL minor release check for SAP HANA (RHEL only) +### sap_hana_preconfigure_configuration +- _Type:_ `bool` -If the following variable is set to `no`, the role will install packages and modify settings on the managed node even if the RHEL release is not contained in the list of -supported RHEL releases. Default is `yes`. In assert mode (`sap_hana_preconfigure_assert` = `yes`), the role will always perform the RHEL release check but will -display display "WARN" or "INFO" if the variable is set to `no`, instead of the default "FAIL" or "PASS". -```yaml -sap_hana_preconfigure_min_rhel_release_check -``` +If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the
+configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`.
-### Override the supported RHEL minor release list for SAP HANA (RHEL only) +Example: -If you want to provide you own list of supported RHEL releases (e.g. for testing), override the variable. Otherwise, the defaults as set in vars/RedHat_*.yml will be used. ```yaml -sap_hana_preconfigure_supported_rhel_minor_releases +sap_hana_preconfigure_config_all: false +sap_hana_preconfigure_configuration: true +sap_hana_preconfigure_2772999_04: true +sap_hana_preconfigure_2382421: true ``` -### Repo checking and enabling (RHEL only) -If you want the role to check and if necessary enable SAP HANA repos, set the following variable to `yes`. Default is `no`. -```yaml -sap_hana_preconfigure_enable_sap_hana_repos -``` +### sap_hana_preconfigure_assert +- _Type:_ `bool` +- _Default:_ `false` -### Override default repo list(s) (RHEL only) -If you want to provide you own list(s) of repositories for checking and enabling, override one or more of the following variables. Otherwise, the defaults as set in vars/RedHat_*.yml will be used. -```yaml -sap_hana_preconfigure_req_repos_RedHat_7_x86_64 -sap_hana_preconfigure_req_repos_RedHat_7_ppc64le -sap_hana_preconfigure_req_repos_RedHat_8_x86_64 -sap_hana_preconfigure_req_repos_RedHat_8_ppc64le -``` +If set to `true`, the role will run in assertion mode instead of the default configuration mode.
-### Set the RHEL release to a certain fixed minor release (RHEL only) -If you want the role to set the RHEL release to a certain fixed minor release (according to installed RHEL release), set the following variable to `yes`. Default is `no`. -```yaml -sap_hana_preconfigure_set_minor_release -``` +### sap_hana_preconfigure_assert_ignore_errors +- _Type:_ `bool` +- _Default:_ `false` -### Minimum package check -The following variable will make sure packages are installed at minimum required versions as defined in files `vars/*.yml`. Default is `yes`. -```yaml -sap_hana_preconfigure_min_package_check -``` +In assertion mode, the role will abort when encountering any assertion error.
+If this parameter is set to `false`, the role will *not* abort when encountering an assertion error.
+This is useful if the role is used for reporting a system's SAP notes compliance.
-### Perform a package update -If the following variable is set to `yes`, the role will run a `yum update` for RHEL or a `zypper update` for SLES, before performing configuration changes. Default is `no`. \ -*Note*: The outcome of a `yum update` depends on the managed node's configuration for sticky OS minor version, see the description of the release option in `man subscription-manager`. For SAP HANA installations, setting a certain minor version with `subscription-manager release --set=X.Y` is a strict requirement. -```yaml -sap_hana_preconfigure_update -``` +### sap_hana_preconfigure_system_roles_collection +- _Type:_ `str` +- _Default:_ `'fedora.linux_system_roles'` +- _Possible Values:_
+ - `fedora.linux_system_roles` + - `redhat.rhel_system_roles` -### HANA kernel parameters -[SAP Note 238241](https://launchpad.support.sap.com/#/notes/238241) defines kernel parameters that all Linux systems need to set. -The default parameter recomendations are dependent on the OS release. Hence the OS dependant default setting is defined in -./vars/{{ansible_os_release}}.yml. If you need to add or change parameters for your system, copy these parameters from the vars file -into the variable sap_hana_preconfigure_kernel_parameters and add or change your settings, as in the following example: +Set which Ansible Collection to use for the Linux System Roles.
+For community/upstream, use 'fedora.linux_system_roles'
+For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles'
-```yaml -sap_hana_preconfigure_kernel_parameters: - - { name: net.core.somaxconn, value: 4096 } - - { name: net.ipv4.tcp_max_syn_backlog, value: 8192 } - - { name: net.ipv4.tcp_timestamps, value: 1 } - - { name: net.ipv4.tcp_slow_start_after_idle, value: 0 } -``` +### sap_hana_preconfigure_min_rhel_release_check +- _Type:_ `bool` +- _Default:_ `true` -Note that kernel parameters for SLES systems are automatically handled by saptune. +Check the RHEL release against a predefined list of known SAP HANA supported RHEL minor releases.
+If this parameter is set to `false`, the role will *not* perform this check.
-### HANA kernel parameters for IBM POWER servers -[SAP Note 2055470](https://launchpad.support.sap.com/#/notes/2055470) contains links to IBM documents for SAP HANA on POWER. -Among these is a document which contains certain recommended Linux kernel settings for SAP HANA on POWER: -Network_Configuration_for_HANA_Workloads_on_IBM_Power_Servers_V7.1.pdf. -This document is linked from SAP note 2055470 via "SAP HANA on IBM Power Systems and IBM System Storage - Guides", then via -"SAP on Linux and IBM Storage Guides (incl. HANA)", and then via -"SAP on Power Linux Network and Fibre Channel Guides". -The default parameter recommendations are defined in ./vars/{{ansible_os_release}}.yml. If you need to add or change parameters -for your system, copy these parameters from the vars file into the variable sap_hana_preconfigure_kernel_parameters_ppc64le and -add or change your settings, similar to the previous example. +### sap_hana_preconfigure_supported_rhel_minor_releases +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -Note that kernel parameters for SLES systems are automatically handled by saptune. +Use this parameter to set your own list of SAP HANA supported RHEL minor releases.
-### HANA kernel parameters for NetApp NFS (RHEL only) -[SAP Note 3024346](https://launchpad.support.sap.com/#/notes/3024346) defines kernel parameter settings for NetApp NFS. -In case you want the role to set or check these parameters, set the following variable to `yes`. Default is `no`. +### sap_hana_preconfigure_enable_sap_hana_repos +- _Type:_ `bool` +- _Default:_ `false` -```yaml -sap_hana_preconfigure_use_netapp_settings_nfs -``` +Set to 'true' to enable the SAP HANA required RHEL repos.
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_use_hana_repos`.
-### HANA kernel parameters for NetApp NFSv3 (RHEL only) -[SAP Note 3024346](https://launchpad.support.sap.com/#/notes/3024346) also contains an additional parameter setting for NetApp when using NFSv3. -In case you want the role to set or check this parameter, set the following variable to `yes`. Default is `no`. +### sap_hana_preconfigure_req_repos_redhat_7_x86_64 +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -```yaml -sap_hana_preconfigure_use_netapp_settings_nfsv3 -``` +Use this parameter to set your own list of SAP HANA required RHEL 7 repos on x86_64'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-### Add the repository for IBM service and productivity tools for POWER (RHEL ppc64le only) -In case you do *not* want to automatically add the repository for the IBM service and productivity tools, set the following variable to `no`. Default is `yes`, meaning that the role will download and install the package specified in variable sap_hana_preconfigure_ibm_power_repo_url (see below) and also run the command /opt/ibm/lop/configure to accept the license. -```yaml -sap_hana_preconfigure_add_ibm_power_repo -``` +### sap_hana_preconfigure_req_repos_redhat_7_ppc64le +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -### URL for IBM service and productivity tools for POWER (RHEL ppc64le only) -The following variable is set to the location of package ibm-power-repo-lastest.noarch.rpm or a package with similar contents, as defined by variable __sap_hana_preconfigure_ibm_power_repo_url in vars/RedHat_7.yml and vars/RedHat_8.yml. -You can replace it by your own URL by setting this variable to a different URL. -```yaml -sap_hana_preconfigure_ibm_power_repo_url -``` +Use this parameter to set your own list of SAP HANA required RHEL 7 repos on ppc64le'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-### Reboot the system if required -If the following variable is set to `yes`, the role will reboot the managed node if required. The default is `no`, in which case the role will only report that a reboot is required. -```yaml -sap_hana_preconfigure_reboot_ok -``` +### sap_hana_preconfigure_req_repos_redhat_8_x86_64 +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -### How to behave if a reboot is required -In case `sap_hana_preconfigure_reboot_ok` (see above) is set to `no`, we should make sure that a reboot requirement does not remain unnoticed. -The following variable will cause the role to fail if a reboot is required, if undefined or set to `yes`, which is also the default. -By setting the variable to `no`, the role will not fail if a reboot is required but just print a warning message. -```yaml -sap_hana_preconfigure_fail_if_reboot_required -``` +Use this parameter to set your own list of SAP HANA required RHEL 8 repos on x86_64'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-### Use tuned profile sap-hana (RHEL only) -By default, the role will activate tuned profile `sap-hana` for configuring kernel parameters (where possible). If you do not want -to use the tuned profile sap-hana, set the following variable to `no`. In this case, the role will also modify GRUB_CMDLINE_LINUX, -no matter how variable `sap_hana_preconfigure_modify_grub_cmdline_linux` (see below) is set. -Note: If this variable is set to `yes`, the role may still modify GRUB_CMDLINE_LINUX in /etc/default/grub, by setting variable -`sap_hana_preconfigure_modify_grub_cmdline_linux` to `yes`. This provides more flexibility for setting certain kernel parameters. -```yaml -sap_hana_preconfigure_use_tuned -``` +### sap_hana_preconfigure_req_repos_redhat_8_ppc64le +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -### Specify your own tuned profile (RHEL only) -Use the following variable to set a tuned profile string other than the default `sap-hana`. The tuned profile must reside in directory -`/etc/tuned/my_own_profile`, as file named `tuned.conf` (example for a tuned profile named `my_own_profile`). -```yaml -sap_hana_preconfigure_tuned_profile -``` +Use this parameter to set your own list of SAP HANA required RHEL 8 repos on ppc64le'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-### Modify grub2 line GRUB_CMDLINE_LINUX -If you want to modify the grub2 line GRUB_CMDLINE_LINUX in /etc/default/grub, set the following variable to `yes`. The default is `no`. Setting this variable to `yes` probably only makes sense if `sap_hana_preconfigure_run_grub2_mkconfig` (see below) is also set to `yes`. -Note: If variable sap_hana_preconfigure_use_tuned (see above) is set to `no`, GRUB_CMDLINE_LINUX will modified in any case, no matter how variable `sap_hana_preconfigure_modify_grub_cmdline_linux` is set. This is to guarantee that either the tuned settings or the static settings will be applied. If variable sap_hana_preconfigure_use_tuned (see above) is set to `yes`, `sap_hana_preconfigure_modify_grub_cmdline_linux` can still be set to `yes` for modifying GRUB_CMDLINE_LINUX, providing more flexibility for setting certain kernel parameters. -```yaml -sap_hana_preconfigure_modify_grub_cmdline_linux -``` +### sap_hana_preconfigure_req_repos_redhat_9_x86_64 +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -For SLES users any required changes to grub for SLES are automatically handled by saptune. +Use this parameter to set your own list of SAP HANA required RHEL 9 repos on x86_64'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-### Run grub2-mkconfig -If you do not want to run grub2-mkconfig to regenerate the grub2 config file after a change to /etc/default/grub (see the desciption of the two previous parameters), set the following variable to `no`. The default is `yes`. -```yaml -sap_hana_preconfigure_run_grub2_mkconfig -``` +### sap_hana_preconfigure_req_repos_redhat_9_ppc64le +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) -For SLES users any required changes to grub for SLES are automatically handled by saptune. +Use this parameter to set your own list of SAP HANA required RHEL 9 repos on ppc64le'
+This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose.
+The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`.
-## Select saptune solution (SLES only) -You can specify the saptune solution you want to implement. For HANA, there are a number of possible solutions depending on the deployment: +### sap_hana_preconfigure_set_minor_release +- _Type:_ `bool` +- _Default:_ `false` -- HANA, for when HANA is installed with no other applications -- NETWEAVER+HANA, for when HANA is installed on the same host as netweaver solution -- S4HANA-APP+DB, for when HANA is installed on the same host as an S4 solution +Use this parameter to set the RHEL minor release, which is required for SAP HANA.
+The related parameter is `sap_general_preconfigure_set_minor_release`.
-The default is `HANA` +### sap_hana_preconfigure_create_directories +- _Type:_ `bool` +- _Default:_ `true` -```yaml -sap_hana_preconfigure_saptune_solution -``` +Set to `false` if you do not want the SAP HANA directories to be created by the role.
+The SAP HANA directories will always be created if `sap_hana_preconfigure_modify_selinux_labels`
+(see below) is set to `true`, no matter how `sap_hana_preconfigure_create_directories` is set.
-### HANA Major and minor version -These variables are used in all sap-hana roles so that they are only prefixed with `sap-hana`. If you use `sap-hana-mediacheck` role, these variables are read in automatically. The variable is used in the checks for [SAP Note 2235581](https://launchpad.support.sap.com/#/notes/2235581). +### sap_hana_preconfigure_hana_directories +- _Type:_ `list` with elements of type `str` +- _Default:_ + - /hana + - /lss/shared -```yaml -sap_hana_version: "2" -sap_hana_sps: "0" -``` +List of SAP HANA directories to be created.
+ +### sap_hana_preconfigure_modify_selinux_labels +- _Type:_ `bool` +- _Default:_ `true` + +For compatibility of SAP HANA with SELinux in enforcing mode, the role will recursively add
+the `usr_t` label to directories and files in the directories where HANA is installed.
+If relabeling not desired, set this parameter `false`.
+If the variable is set to `true`, the SAP HANA directories will be created no matter
+how the variable `sap_hana_preconfigure_create_directories` (see above) is set.
+ +### sap_hana_preconfigure_packages +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) + +List of RHEL packages to be installed for SAP HANA. For RHEL 8 and later, you can choose to install either the default list
+or a list of the minimum required packages for SAP HANA server (parameter `__sap_hana_preconfigure_packages_min_install`).
+ +### sap_hana_preconfigure_min_package_check +- _Type:_ `bool` +- _Default:_ `true` + +SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581.
+Set this parameter to `false` if you want to ignore these requirements.
+ +### sap_hana_preconfigure_update +- _Type:_ `bool` +- _Default:_ `false` + +Set this parameter to `true` to update the system to the latest package levels.
+By setting the parameter `sap_general_preconfigure_set_minor_release` of the
+role `sap_general_preconfigure` to `true`, you can install the most recent package updates
+without updating to a more recent RHEL minor release.
+ +### sap_hana_preconfigure_reboot_ok +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` if you want to perform a reboot at the end of the role, if necessary.
+ +### sap_hana_preconfigure_fail_if_reboot_required +- _Type:_ `bool` +- _Default:_ `true` + +If `sap_hana_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not
+remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior.
+Can be useful if you want to implement your own reboot handling.
+ +### sap_hana_preconfigure_kernel_parameters +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) + +Network related linux kernel parameter settings for SAP HANA on all hardware platforms.
+ +### sap_hana_preconfigure_kernel_parameters_ppc64le +- _Type:_ `list` with elements of type `str` +- _Default:_ (set by platform/environment specific variables) + +Network related linux kernel parameter settings for platform ppc64le.
+ +### sap_hana_preconfigure_use_netapp_settings_nfs +- _Type:_ `bool` +- _Default:_ `false` + +Set to `true` to also set NetApp NFS required kernel parameters.
+ +### sap_hana_preconfigure_use_netapp_settings_nfsv3 +- _Type:_ `bool` +- _Default:_ `false` + +If `sap_hana_preconfigure_use_netapp_settings_nfs` is set to `true` and NFS Version 3 is to be used,
+this parameter must be set to `true` as well.
+ +### sap_hana_preconfigure_install_ibm_power_tools +- _Type:_ `bool` +- _Default:_ `true` + +Set this parameter to `false` to not install the IBM Power Systems service and productivity tools.
+ +### sap_hana_preconfigure_add_ibm_power_repo +- _Type:_ `bool` +- _Default:_ `true` + +Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages
+are already available on the local network). The IBM Power Systems service and productivity tools will only
+be installed if the variable `sap_hana_preconfigure_install_ibm_power_tools` is set to `true`, which is the default.
+ +### sap_hana_preconfigure_ibm_power_repo_url +- _Type:_ `str` +- _Default:_ (set by platform/environment specific variables) + +URL of the IBM Power tools repository.
+ +### sap_hana_preconfigure_ppcle_mtu9000_if +- _Type:_ `str` +- _Default:_ `''` + +List of interfaces for which the MTU size will be set to `9000`.
+ +### sap_hana_preconfigure_ppcle_tso_if +- _Type:_ `list` with elements of type `str` +- _Default:_ + '{{ ansible_interfaces | difference([''lo'']) }}' + +List of interfaces for which the tso flag will be set.
+ +### sap_hana_preconfigure_use_tuned +- _Type:_ `bool` +- _Default:_ `true` + +Use tuned for configuring most of the kernel settings for SAP HANA
+Set this parameter to `false` to use static kernel settings
+ +### sap_hana_preconfigure_tuned_profile +- _Type:_ `str` +- _Default:_ `'sap-hana'` + +Name of the SAP HANA tuned tuned profile to enable (RHEL).
+ +### sap_hana_preconfigure_modify_grub_cmdline_linux +- _Type:_ `bool` +- _Default:_ `false` + +Set this parameter to `true` to modify the Grub boot command line.
+ +### sap_hana_preconfigure_run_grub2_mkconfig +- _Type:_ `bool` +- _Default:_ `true` + +By default, the role will run `grub2-mkconfig` to update the Grub configuration if necessary.
+Set this parameter to `false` if this is not desired.
+ +### sap_hana_preconfigure_db_group_name +- _Type:_ `str` +- _Default:_ `'dba'` + +Use this parameter to specify the name of the RHEL group which is used for the database processes.
+It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999.
+ +### sap_hana_preconfigure_saptune_version +- _Type:_ `str` +- _Default:_ `'3.0.2'` + +Version of saptune to install (SLES for SAP Applications).
+This will replace the current installed version if present, even downgrade if necessary.
+ +### sap_hana_preconfigure_saptune_solution +- _Type:_ `str` +- _Default:_ `'HANA'` +- _Possible Values:_
+ - `HANA` + - `NETWEAVER+HANA` + - `S4HANA-APP+DB` + - `S4HANA-DBSERVER` + +The saptune solution to apply (SLES for SAP Applications).
+ +### sap_hana_preconfigure_saptune_azure +- _Type:_ `bool` +- _Default:_ `false` + +On Azure, TCP timestamps, reuse and recycle should be disabled (SLES for SAP Applications).
+Set this parameter to `true` on Azure.
+ + ## Example Playbook diff --git a/roles/sap_hana_preconfigure/defaults/main.yml b/roles/sap_hana_preconfigure/defaults/main.yml index a7456446b..67a8e5f38 100644 --- a/roles/sap_hana_preconfigure/defaults/main.yml +++ b/roles/sap_hana_preconfigure/defaults/main.yml @@ -1,185 +1,182 @@ --- -###################################### -# HANA Default Variables -# - -# Want extensive debugging -#debuglevel: 3 - -# For executing just some of the configuration steps, -# 1 - set sap_hana_preconfigure_config_all to `no` (default is `yes`), -# 2 - set sap_hana_preconfigure_installation or sap_hana_preconfigure_configuration, or both, to `yes` (default for both is `no`) -# 3 - and set one or more of the SAP notes related variables to `yes`: -#sap_hana_preconfigure_config_all: false -#sap_hana_preconfigure_installation: true -#sap_hana_preconfigure_configuration: true -## examples for RHEL7: -#sap_hana_preconfigure_2292690_02: true -#sap_hana_preconfigure_2292690_05: true -#sap_hana_preconfigure_2009879_3_9: true -#sap_hana_preconfigure_2009879_3_14_1: true -#sap_hana_preconfigure_2009879_3_14_2: true -#sap_hana_preconfigure_2009879_3_14_3: true -#sap_hana_preconfigure_2009879_3_14_4: true -## examples for RHEL8: -#sap_hana_preconfigure_2777782_03: true -#sap_hana_preconfigure_2777782_10: true -## both: -#sap_hana_preconfigure_2382421: true - -# Perform an assertion run: +# BEGIN: Default Variables for sap_hana_preconfigure + +# sap_hana_preconfigure_config_all: (not defined by default) +# If set to `false`, the role will only execute or verify the installation or configuration steps of SAP notes. +# Default is to perform installation and configuration steps. + +# sap_hana_preconfigure_installation: (not defined by default) +# If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the +# installation steps of SAP notes. + +# sap_hana_preconfigure_configuration: (not defined by default) +# If `sap_hana_preconfigure_config_all` is set to `false`, set this variable to `true` to perform only the +# configuration steps of SAP notes for which the corresponding SAP notes parameters have been set to `true`. +# Example: See README.md + sap_hana_preconfigure_assert: false +# If set to `true`, the role will run in assertion mode instead of the default configuration mode. -# In case of an assertion run, if set to `yes`, the role will abort for any assertion error: sap_hana_preconfigure_assert_ignore_errors: false +# In assertion mode, the role will abort when encountering any assertion error. +# If this parameter is set to `false`, the role will *not* abort when encountering an assertion error. +# This is useful if the role is used for reporting a system's SAP notes compliance. -# In case of an assertion run, if set to `yes`, check all configuration steps no matter if tuned or static configuration has been selected: -sap_hana_preconfigure_assert_all_config: false - +sap_hana_preconfigure_system_roles_collection: 'fedora.linux_system_roles' # Set which Ansible Collection to use for the Linux System Roles. # For community/upstream, use 'fedora.linux_system_roles' # For the RHEL System Roles for SAP, or for Red Hat Automation Hub, use 'redhat.rhel_system_roles' -sap_hana_preconfigure_system_roles_collection: 'fedora.linux_system_roles' +# Possible Values: +# - fedora.linux_system_roles +# - redhat.rhel_system_roles -# Perform a RHEL minor release check for SAP HANA: sap_hana_preconfigure_min_rhel_release_check: true +# Check the RHEL release against a predefined list of known SAP HANA supported RHEL minor releases. +# If this parameter is set to `false`, the role will *not* perform this check. -# supported RHEL minor releases for SAP HANA: sap_hana_preconfigure_supported_rhel_minor_releases: "{{ __sap_hana_preconfigure_supported_rhel_minor_releases }}" +# Use this parameter to set your own list of SAP HANA supported RHEL minor releases. -# Set to `yes` if you want the role to enable SAP HANA repos. The default is `no`. sap_hana_preconfigure_enable_sap_hana_repos: false +# Set to 'true' to enable the SAP HANA required RHEL repos. +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_use_hana_repos`. -# Change one or more of the following in case you want different repos to be enabled than defined in vars. sap_hana_preconfigure_req_repos_redhat_7_x86_64: "{{ __sap_hana_preconfigure_req_repos_redhat_7_x86_64 }}" +# Use this parameter to set your own list of SAP HANA required RHEL 7 repos on x86_64' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + sap_hana_preconfigure_req_repos_redhat_7_ppc64le: "{{ __sap_hana_preconfigure_req_repos_redhat_7_ppc64le }}" +# Use this parameter to set your own list of SAP HANA required RHEL 7 repos on ppc64le' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + sap_hana_preconfigure_req_repos_redhat_8_x86_64: "{{ __sap_hana_preconfigure_req_repos_redhat_8_x86_64 }}" +# Use this parameter to set your own list of SAP HANA required RHEL 8 repos on x86_64' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + sap_hana_preconfigure_req_repos_redhat_8_ppc64le: "{{ __sap_hana_preconfigure_req_repos_redhat_8_ppc64le }}" +# Use this parameter to set your own list of SAP HANA required RHEL 8 repos on ppc64le' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + sap_hana_preconfigure_req_repos_redhat_9_x86_64: "{{ __sap_hana_preconfigure_req_repos_redhat_9_x86_64 }}" +# Use this parameter to set your own list of SAP HANA required RHEL 9 repos on x86_64' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. + sap_hana_preconfigure_req_repos_redhat_9_ppc64le: "{{ __sap_hana_preconfigure_req_repos_redhat_9_ppc64le }}" +# Use this parameter to set your own list of SAP HANA required RHEL 9 repos on ppc64le' +# This parameter is deprecated because the role sap_general_preconfigure can be used for this purpose. +# The related parameters are `sap_general_preconfigure_enable_repos` and `sap_general_preconfigure_req_repos`. -# Set to `yes` if you want the role to set the RHEL minor release, which is required for SAP HANA. Default is `no`. sap_hana_preconfigure_set_minor_release: false +# Use this parameter to set the RHEL minor release, which is required for SAP HANA. +# The related parameter is `sap_general_preconfigure_set_minor_release`. -# Set to 'no' if you do not want the SAP HANA directories to be created by the role. Default is 'yes'. -# Note: The SAP HANA directories will always be created if 'sap_hana_preconfigure_modify_selinux_labels' -# (see below) is set to 'yes', no matter how 'sap_hana_preconfigure_create_directories' is set. sap_hana_preconfigure_create_directories: true +# Set to `false` if you do not want the SAP HANA directories to be created by the role. +# The SAP HANA directories will always be created if `sap_hana_preconfigure_modify_selinux_labels` +# (see below) is set to `true`, no matter how `sap_hana_preconfigure_create_directories` is set. -# HANA directories to be created sap_hana_preconfigure_hana_directories: - - '/hana' -# - '/hana/shared' -# - '/hana/data' -# - '/hana/log' - - '/lss/shared' + - /hana + - /lss/shared +# List of SAP HANA directories to be created. -# For compatibility of SAP HANA with SELinux in enforcing mode, the role will recursively add -# the 'usr_t' label to directories and files in the directories where HANA is installed. -# If relabeling not desired, set the following variable to `no`. -# Note: If the variable is set to 'yes', which is the default, the SAP HANA directories will be created -# no matter how the variable 'sap_hana_preconfigure_create_directories' (see above) is set. sap_hana_preconfigure_modify_selinux_labels: true +# For compatibility of SAP HANA with SELinux in enforcing mode, the role will recursively add +# the `usr_t` label to directories and files in the directories where HANA is installed. +# If relabeling not desired, set this parameter `false`. +# If the variable is set to `true`, the SAP HANA directories will be created no matter +# how the variable `sap_hana_preconfigure_create_directories` (see above) is set. -# HANA Major and minor version -# These variables are used in other SAP HANA related roles, e.g. sap-hana-mediacheck. -sap_hana_version: "2" -sap_hana_sps: "0" - -# List of RHEL packages to be installed for SAP HANA. For RHEL 8 and later, you can choose to install either the default list -# or a list of the minimum required packages for SAP HANA server: sap_hana_preconfigure_packages: "{{ __sap_hana_preconfigure_packages }}" -#sap_hana_preconfigure_packages: "{{ __sap_hana_preconfigure_packages_min_install }}" +# List of RHEL packages to be installed for SAP HANA. For RHEL 8 and later, you can choose to install either the default list +# or a list of the minimum required packages for SAP HANA server (parameter `__sap_hana_preconfigure_packages_min_install`). -# SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581. -# Set to no if you want to ignore these requirements. sap_hana_preconfigure_min_package_check: true +# SAP HANA requires certain minimum package versions to be supported. These minimum levels are listed in SAP Note 2235581. +# Set this parameter to `false` if you want to ignore these requirements. -# Set the following variable to `yes` if you want to run "yum update" during the installation part: sap_hana_preconfigure_update: false +# Set this parameter to `true` to update the system to the latest package levels. +# By setting the parameter `sap_general_preconfigure_set_minor_release` of the +# role `sap_general_preconfigure` to `true`, you can install the most recent package updates +# without updating to a more recent RHEL minor release. -# Set the following variable to `yes` if you want the role to reboot the server if necessary: sap_hana_preconfigure_reboot_ok: false +# Set to `true` if you want to perform a reboot at the end of the role, if necessary. -# Set the following variable to `no` if you want the role to not fail if a reboot is required: sap_hana_preconfigure_fail_if_reboot_required: true - -### -# -# The following variables are optional. -# If they are defined, the users sapadm and sapsys will already be created -# This is necessary for installation of hostagent, but some customers require it at an earlier stage. -# -# sap_sapadm_uid: -# sap_sapadm_pw_clear: -# sap_sapsys_gid: -# sap_hana_id_group_sapsys: not yet used -# sap_hana_id_user_sapadm: not yet used - -## HANA kernel parameters -# [SAP Note 2382421](https://launchpad.support.sap.com/#/notes/2382421) defines kernel parameters that all Linux systems need to set. -# The default parameter recommendations are dependent on the OS release. Hence the OS dependant default setting is defined in -# ./vars/{{ansible_os_release}}.yml. If you need to add or change parameters for your system, copy these parameters from the vars file -# into the variable sap_hana_preconfigure_kernel_parameters and add or change your settings: +# If `sap_hana_preconfigure_reboot_ok` is set to `false`, which is the default, a reboot requirement should not +# remain unnoticed. For this reason, we let the role fail. Set this parameter to `false` to override this behavior. +# Can be useful if you want to implement your own reboot handling. sap_hana_preconfigure_kernel_parameters: "{{ __sap_hana_preconfigure_kernel_parameters_default }}" +# Network related linux kernel parameter settings for SAP HANA on all hardware platforms. sap_hana_preconfigure_kernel_parameters_ppc64le: "{{ __sap_hana_preconfigure_kernel_parameters_default_ppc64le }}" +# Network related linux kernel parameter settings for platform ppc64le. sap_hana_preconfigure_use_netapp_settings_nfs: false +# Set to `true` to also set NetApp NFS required kernel parameters. sap_hana_preconfigure_use_netapp_settings_nfsv3: false +# If `sap_hana_preconfigure_use_netapp_settings_nfs` is set to `true` and NFS Version 3 is to be used, +# this parameter must be set to `true` as well. -# Set the following variable to 'no' if you do not want to install the IBM Power Systems service and productivity tools: sap_hana_preconfigure_install_ibm_power_tools: true +# Set this parameter to `false` to not install the IBM Power Systems service and productivity tools. -# Set the following variable to 'no' if you do not want to add the IBM Power tools repository (e.g. because the packages -# are already available on the local network). Note that the IBM Power Systems service and productivity tools will only -# be installed if the variable sap_hana_preconfigure_install_ibm_power_tools is set to `yes`, which is the default. sap_hana_preconfigure_add_ibm_power_repo: true +# Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages +# are already available on the local network). The IBM Power Systems service and productivity tools will only +# be installed if the variable `sap_hana_preconfigure_install_ibm_power_tools` is set to `true`, which is the default. -# sap_hana_preconfigure_ibm_power_repo_url: 'http://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-3.0.0-19.noarch.rpm' -# sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' sap_hana_preconfigure_ibm_power_repo_url: "{{ __sap_hana_preconfigure_ibm_power_repo_url }}" +# URL of the IBM Power tools repository. -#### The following parameters are for PPC LE only -## add a list of interfaces where MTU size will be set to 9000 -## defaults to empty -#sap_hana_preconfigure_ppcle_mtu9000_if: "{{ ansible_interfaces | difference(['lo']) }}" # all interfaces sap_hana_preconfigure_ppcle_mtu9000_if: '' -## list where tso flag should be set -## defaults to all interfaces -sap_hana_preconfigure_ppcle_tso_if: "{{ ansible_interfaces | difference(['lo']) }}" +# List of interfaces for which the MTU size will be set to `9000`. -# SELinux is already configured in role sap_general_preconfigure: -#sap_hana_preconfigure_selinux_state: "{{ __sap_hana_preconfigure_selinux_state }}" +sap_hana_preconfigure_ppcle_tso_if: "{{ ansible_interfaces | difference(['lo']) }}" +# List of interfaces for which the tso flag will be set. sap_hana_preconfigure_use_tuned: true +# Use tuned for configuring most of the kernel settings for SAP HANA +# Set this parameter to `false` to use static kernel settings sap_hana_preconfigure_tuned_profile: 'sap-hana' +# Name of the SAP HANA tuned tuned profile to enable (RHEL). sap_hana_preconfigure_modify_grub_cmdline_linux: false +# Set this parameter to `true` to modify the Grub boot command line. sap_hana_preconfigure_run_grub2_mkconfig: true +# By default, the role will run `grub2-mkconfig` to update the Grub configuration if necessary. +# Set this parameter to `false` if this is not desired. -# Use the following variable to specify the name of the RHEL group which is used for the database processes -# (if it exists, it will be used to configure process limits as per step -# "Configuring Process Resource Limits" of SAP note 2772999): -# sap_hana_preconfigure_db_group_name: dba - -## The following variables control aspects of saptune and are only relevant for SLES for SAP Application +sap_hana_preconfigure_db_group_name: 'dba' +# Use this parameter to specify the name of the RHEL group which is used for the database processes. +# It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999. -# Version of saptune to install this will replace the current installed version if present, downgrading if necessary -sap_hana_preconfigure_saptune_version: 3.0.2 +sap_hana_preconfigure_saptune_version: '3.0.2' +# Version of saptune to install (SLES for SAP Applications). +# This will replace the current installed version if present, even downgrade if necessary. -# The saptune solution to apply. For HANA, the only appropriate options are: -# * HANA -# * NETWEAVER+HANA -# * S4HANA-APP+DB -# * S4HANA-DBSERVER -# * The default option is HANA -sap_hana_preconfigure_saptune_solution: HANA +sap_hana_preconfigure_saptune_solution: 'HANA' +# The saptune solution to apply (SLES for SAP Applications). +# Possible Values: +# - HANA +# - NETWEAVER+HANA +# - S4HANA-APP+DB +# - S4HANA-DBSERVER -# When running on Azure, TCP timestamps, reuse and recycle should be disabled -# set to yes when running on Azure sap_hana_preconfigure_saptune_azure: false +# On Azure, TCP timestamps, reuse and recycle should be disabled (SLES for SAP Applications). +# Set this parameter to `true` on Azure. + +# END: Default Variables for sap_hana_preconfigure diff --git a/roles/sap_hana_preconfigure/meta/argument_specs.yml b/roles/sap_hana_preconfigure/meta/argument_specs.yml index 15a9b12e9..f0a008c02 100644 --- a/roles/sap_hana_preconfigure/meta/argument_specs.yml +++ b/roles/sap_hana_preconfigure/meta/argument_specs.yml @@ -79,6 +79,7 @@ argument_specs: description: - Check the RHEL release against a predefined list of known SAP HANA supported RHEL minor releases. - If this parameter is set to `false`, the role will *not* perform this check. + required: false type: bool sap_hana_preconfigure_supported_rhel_minor_releases: @@ -164,7 +165,7 @@ argument_specs: - Use this parameter to set the RHEL minor release, which is required for SAP HANA. - The related parameter is `sap_general_preconfigure_set_minor_release`. required: false - type: str + type: bool sap_hana_preconfigure_create_directories: default: true @@ -294,12 +295,11 @@ argument_specs: type: str sap_hana_preconfigure_ppcle_mtu9000_if: - default: [] + default: '' description: - List of interfaces for which the MTU size will be set to `9000`. required: false - type: list - elements: str + type: str sap_hana_preconfigure_ppcle_tso_if: default: "{{ ansible_interfaces | difference(['lo']) }}" From d19dc5bf0c5abce60e32edfcb42504783c108fc8 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 11:11:58 +0200 Subject: [PATCH 068/128] sap_install_media_detect: fix yaml:trailing-spaces --- .../defaults/main.yml | 2 +- .../tasks/detect_export_sapecc.yml | 20 +++++++++---------- .../tasks/detect_export_sapecc_ides.yml | 20 +++++++++---------- .../tasks/detect_export_sapnwas_abap.yml | 20 +++++++++---------- .../tasks/detect_export_sapnwas_java.yml | 20 +++++++++---------- .../tasks/detect_export_sapsolman_abap.yml | 12 +++++------ .../tasks/detect_sapanydb_ibmdb2.yml | 16 +++++++-------- .../tasks/detect_sapanydb_oracledb.yml | 12 +++++------ .../tasks/detect_sapanydb_sapase.yml | 10 +++++----- .../tasks/detect_sapanydb_sapmaxdb.yml | 8 ++++---- 10 files changed, 70 insertions(+), 70 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index fb587f511..f873032ac 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -19,7 +19,7 @@ sap_install_media_detect_webdisp: false sap_install_media_detect_export: # e.g. /db_backup -sap_install_media_detect_backup_directory: +sap_install_media_detect_backup_directory: # saphana sap_install_media_detect_backup: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index e6a22eb1a..33fe79bab 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -31,7 +31,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -43,7 +43,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: @@ -51,21 +51,21 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_export_extracted ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_export_extracted/ ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -92,7 +92,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -104,7 +104,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -118,7 +118,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: @@ -128,7 +128,7 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - move SAP ECC EXPORT compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_export/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index e9ebf3421..d44067fab 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -31,7 +31,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -43,7 +43,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: @@ -51,21 +51,21 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_ides_export_extracted ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_ides_export_extracted/ ; fi - with_items: + with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -92,7 +92,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -104,7 +104,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -118,7 +118,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: @@ -128,7 +128,7 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - move SAP ECC IDES EXPORT compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_ides_export/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index b5e60927c..411226076 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -31,7 +31,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -43,7 +43,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: @@ -51,21 +51,21 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_abap_export_extracted ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files (unrar x) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_abap_export_extracted/ ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -92,7 +92,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -104,7 +104,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -118,7 +118,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: @@ -128,7 +128,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - move EXPORT compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index e96959d9e..b85e7bae7 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -31,7 +31,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -43,7 +43,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: @@ -51,21 +51,21 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_java_export_extracted ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files (unrar x) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_java_export_extracted/ ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -92,7 +92,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -104,7 +104,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -118,7 +118,7 @@ elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export_repeated changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: @@ -128,7 +128,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - move EXPORT compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_java_export/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_nwas_java_export_repeated.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index 6cb9514fc..97e4159bd 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -32,14 +32,14 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapsolman_abap_export_extracted/{{ item }} ; fi - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -66,7 +66,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -79,7 +79,7 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -88,7 +88,7 @@ - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - move EXPORT compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 9d7bba958..73e6c0b51 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -23,7 +23,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -34,7 +34,7 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2 changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -44,7 +44,7 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_client changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -54,28 +54,28 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_license changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -98,7 +98,7 @@ - name: SAP Install Media Detect - IBM Db2 - Local Directory source - move IBM Db2 compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/ibmdb2/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 5a49a08a0..46991606f 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -22,7 +22,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -33,7 +33,7 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -43,21 +43,21 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb_client changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -80,7 +80,7 @@ - name: SAP Install Media Detect - Oracle DB - Local Directory source - move Oracle DB compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/oracledb/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index 61d6549d7..a63c86910 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -22,7 +22,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -33,7 +33,7 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapase changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -49,7 +49,7 @@ - name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapase_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -63,7 +63,7 @@ -R "{{ sap_install_media_detect_directory }}/sapase_client_extracted" args: chdir: "{{ sap_install_media_detect_directory }}" - with_items: + with_items: - "{{ detect_directory_files_sapase_client.files[0].path }}" - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted @@ -85,7 +85,7 @@ - name: SAP Install Media Detect - SAP ASE - Local Directory source - move SAP ASE compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapase/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index bad74d3d0..f7c5f156b 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -21,7 +21,7 @@ ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip # changed_when: "item.stdout | length > 0" - with_items: + with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -32,14 +32,14 @@ if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapmaxdb changed_when: "item | length > 0" - with_items: + with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" - name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi - with_items: + with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" @@ -55,7 +55,7 @@ - name: SAP Install Media Detect - SAP MaxDB - Local Directory source - move SAP MaxDB compressed archive files command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapmaxdb/{{ item }}" - with_items: + with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" when: - sap_install_media_detect_source == "local_dir" From 3d3913ab3001386fee99bceecce1b6f864bebdf3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 11:16:13 +0200 Subject: [PATCH 069/128] sap_install_media_detect: fix yaml:empty-lines --- roles/sap_install_media_detect/tasks/detect_sapcar.yml | 1 - roles/sap_install_media_detect/tasks/detect_sapswpm.yml | 4 ---- 2 files changed, 5 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_sapcar.yml b/roles/sap_install_media_detect/tasks/detect_sapcar.yml index daa219629..332782e44 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapcar.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapcar.yml @@ -18,4 +18,3 @@ mode: '0755' owner: root group: root - diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml index cd144822b..b91eda72e 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml @@ -80,10 +80,6 @@ # when: # - "'restore' in sap_swpm_swpm_installation_type" - - - - # SWPM Path - name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM path - {{ sap_swpm_swpm_path }} From c896ca50794fbc2814a48297551fe2711a29cf0c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 11:18:27 +0200 Subject: [PATCH 070/128] sap_install_media_detect: fix literal-compare --- roles/sap_install_media_detect/tasks/main.yml | 14 ++++++-------- .../tasks/set_global_vars.yml | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index a177dc461..d73ce2613 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -14,35 +14,33 @@ - name: SAP Install Media Detect - Organize SAP SWPM installation media files include_tasks: "detect_sapswpm.yml" when: - - sap_install_media_detect_swpm == true + - sap_install_media_detect_swpm - name: SAP Install Media Detect - Organize SAP Host Agent installation media files include_tasks: "detect_saphostagent.yml" when: - - sap_install_media_detect_hostagent == true + - sap_install_media_detect_hostagent - name: SAP Install Media Detect - Organize SAP IGS installation media files include_tasks: "detect_sapigs.yml" when: - - sap_install_media_detect_igs == true + - sap_install_media_detect_igs - name: SAP Install Media Detect - Organize SAP Kernel installation media files include_tasks: "detect_sapkernel.yml" when: - - sap_install_media_detect_kernel == true + - sap_install_media_detect_kernel - name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files include_tasks: "detect_sapwebdisp.yml" when: - - sap_install_media_detect_webdisp == true - + - sap_install_media_detect_webdisp - name: SAP Install Media Detect - Complete Data Backup files for SAP HANA include_tasks: "detect_backup_saphana.yml" when: - sap_install_media_detect_backup == "saphana" - # Detect files which (historically) have filenames which are Numbered IDs only (e.g. 51054410_2 for SAP MaxDB 7.9) # Leave to last so directory has less files to scan @@ -120,4 +118,4 @@ - "SAP SWPM SAPCAR Path - {{ sap_swpm_sapcar_path }}" - "SAP SWPM Path - {{ sap_swpm_swpm_path }}" when: - - sap_install_media_detect_swpm == true + - sap_install_media_detect_swpm diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 2448fc580..0fd3aed83 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -99,4 +99,4 @@ sap_swpm_sapcar_path: "{{ sap_install_media_detect_directory }}/sap_swpm" # for sap_swpm Ansible Role ignore_errors: true when: - - sap_install_media_detect_swpm == true + - sap_install_media_detect_swpm From 7ae3dfdc97c02da82ab4d0e83079ad41ee5c1de3 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 11:43:41 +0200 Subject: [PATCH 071/128] sap_install_media_detect: fix fqcn:action-core --- .../tasks/detect_export_sapbw4hana.yml | 2 +- .../tasks/detect_export_sapecc.yml | 2 +- .../tasks/detect_export_sapecc_ides.yml | 2 +- .../tasks/detect_export_sapnwas_abap.yml | 2 +- .../tasks/detect_export_sapnwas_java.yml | 2 +- .../tasks/detect_export_saps4hana.yml | 2 +- .../tasks/detect_export_sapsolman_abap.yml | 2 +- .../tasks/detect_sapanydb_ibmdb2.yml | 2 +- .../tasks/detect_sapanydb_oracledb.yml | 2 +- .../tasks/detect_sapanydb_sapase.yml | 2 +- .../tasks/detect_sapanydb_sapmaxdb.yml | 2 +- .../tasks/detect_saphana.yml | 18 ++++---- .../tasks/detect_saphostagent.yml | 4 +- .../tasks/detect_sapigs.yml | 8 ++-- .../tasks/detect_sapkernel.yml | 8 ++-- .../tasks/detect_sapswpm.yml | 14 +++--- .../tasks/detect_sapwebdisp.yml | 4 +- .../extract/sapcar_loop_handler_saphana.yml | 8 ++-- roles/sap_install_media_detect/tasks/main.yml | 46 +++++++++---------- 19 files changed, 65 insertions(+), 67 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml index abb0ccdb3..dca9a2e72 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml @@ -20,7 +20,7 @@ register: bw4hana_export_files - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Local Directory source - move SAP BW/4HANA EXPORT files - command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/sapbw4hana_export/{{ item.path | basename }}" + ansible.builtin.command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/sapbw4hana_export/{{ item.path | basename }}" with_items: "{{ bw4hana_export_files.files }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 33fe79bab..02b0a1e09 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -127,7 +127,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - move SAP ECC EXPORT compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_export/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index d44067fab..3f030f9a9 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -127,7 +127,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - move SAP ECC IDES EXPORT compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_ides_export/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_ides_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 411226076..23f6e3dfc 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -127,7 +127,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - move EXPORT compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index b85e7bae7..9dca4a02f 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -127,7 +127,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - move EXPORT compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_java_export/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_java_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_java_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml index 50dbc007a..f3654b038 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml @@ -20,7 +20,7 @@ register: s4hana_export_files - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Local Directory source - move SAP S/4HANA EXPORT files - command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/saps4hana_export/{{ item.path | basename }}" + ansible.builtin.command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/saps4hana_export/{{ item.path | basename }}" with_items: "{{ s4hana_export_files.files }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index 97e4159bd..c9ac50b8d 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -87,7 +87,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - move EXPORT compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 73e6c0b51..27e727f08 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -97,7 +97,7 @@ register: detect_directory_ibmdb2_client_extracted - name: SAP Install Media Detect - IBM Db2 - Local Directory source - move IBM Db2 compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/ibmdb2/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/ibmdb2/{{ item }}" with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 46991606f..0350ed7da 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -79,7 +79,7 @@ register: detect_directory_oracledb_client_extracted - name: SAP Install Media Detect - Oracle DB - Local Directory source - move Oracle DB compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/oracledb/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/oracledb/{{ item }}" with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index a63c86910..3a5913041 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -84,7 +84,7 @@ register: detect_directory_sapase_client_extracted - name: SAP Install Media Detect - SAP ASE - Local Directory source - move SAP ASE compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapase/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapase/{{ item }}" with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index f7c5f156b..716f5b74e 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -54,7 +54,7 @@ register: detect_directory_sapmaxdb_extracted - name: SAP Install Media Detect - SAP MaxDB - Local Directory source - move SAP MaxDB compressed archive files - command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapmaxdb/{{ item }}" + ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapmaxdb/{{ item }}" with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index 610942815..ebc23cd13 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -1,11 +1,11 @@ --- - name: SAP Install Media Detect - SAP HANA - Set fact for install media directory - set_fact: + ansible.builtin.set_fact: sap_hana_install_directory: "{{ sap_install_media_detect_directory }}/sap_hana" - name: SAP Install Media Detect - SAP HANA - Create Directory - {{ sap_hana_install_directory }} - file: + ansible.builtin.file: path: "{{ sap_hana_install_directory }}" state: directory mode: '0755' @@ -26,7 +26,7 @@ register: imdb_sarfiles_list - name: SAP Install Media Detect - SAP HANA - Set fact list of SAR files - set_fact: + ansible.builtin.set_fact: sap_hana_install_imdb_sar: "{{ imdb_sarfiles_list.stdout.split() }}" when: - not( imdb_sarfiles_list.stdout == '' ) @@ -38,9 +38,8 @@ when: - not( imdb_sarfiles_list.stdout == '' ) - - name: SAP Install Media Detect - SAP HANA - Check availability of software path - {{ sap_hana_install_directory }} - stat: + ansible.builtin.stat: path: "{{ sap_hana_install_directory }}" register: sap_hana_install_software_path_stat failed_when: not sap_hana_install_software_path_stat.stat.exists @@ -54,7 +53,6 @@ owner: root group: root - # Create directory {{ sap_hana_install_directory }}/extracted # This is where all extracted .SAR files will be stored - name: SAP Install Media Detect - SAP HANA - Remove directory - {{ sap_hana_install_directory }}/extracted @@ -84,13 +82,13 @@ register: sarfiles_list - name: SAP Install Media Detect - SAP HANA - Set fact for list of SAR files - set_fact: + ansible.builtin.set_fact: sap_hana_install_components_sar: "{{ sarfiles_list.stdout.split() }}" when: - not( sarfiles_list.stdout == '' ) - name: SAP Install Media Detect - SAP HANA - Extract all SAR files in folder - {{ sap_hana_install_directory }} - include_tasks: ./extract/sapcar_loop_handler_saphana.yml + ansible.builtin.include_tasks: ./extract/sapcar_loop_handler_saphana.yml register: extract_all_sar_files loop: "{{ sap_hana_install_components_sar }}" loop_control: @@ -108,7 +106,7 @@ group: root - name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_DATABASE - find: + ansible.builtin.find: paths: "{{ sap_hana_install_directory }}" recurse: yes file_type: directory @@ -116,7 +114,7 @@ register: sap_hana_database - name: SAP Install Media Detect - SAP HANA - Find SAP_HANA_CLIENT for SAP SWPM - find: + ansible.builtin.find: paths: "{{ sap_hana_install_directory }}" recurse: yes file_type: directory diff --git a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml index f23328fdc..6a41e8f82 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml @@ -1,11 +1,11 @@ --- - name: SAP Install Media Detect - SAP Host Agent - Set fact for install media directory - set_fact: + ansible.builtin.set_fact: sap_hostagent_install_directory: "{{ sap_install_media_detect_directory }}/sap_hostagent" - name: SAP Install Media Detect - SAP Host Agent - Create Directory - {{ sap_hostagent_install_directory }} - file: + ansible.builtin.file: path: "{{ sap_hostagent_install_directory }}" state: directory mode: '0755' diff --git a/roles/sap_install_media_detect/tasks/detect_sapigs.yml b/roles/sap_install_media_detect/tasks/detect_sapigs.yml index 924c21041..8b564b566 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapigs.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapigs.yml @@ -8,13 +8,13 @@ register: sap_swpm_igs_file_name_get - name: SAP Install Media Detect - SAP IGS - Set fact for IGS - set_fact: + ansible.builtin.set_fact: sap_swpm_igs_path: "{{ sap_swpm_software_path }}" sap_swpm_igs_file_name: "{{ sap_swpm_igs_file_name_get.stdout }}" # failed_when will trigger if more than 1 igsexe is identified and added to the register - name: SAP Install Media Detect - SAP IGS - Check availability of IGS - {{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_igs_path }}/{{ sap_swpm_igs_file_name }}" register: sap_swpm_igs_file_name_stat failed_when: not sap_swpm_igs_file_name_stat.stat.exists @@ -28,12 +28,12 @@ register: sap_swpm_igs_helper_file_name_get - name: SAP Install Media Detect - SAP IGS - Set fact for IGS - set_fact: + ansible.builtin.set_fact: sap_swpm_igs_helper_path: "{{ sap_swpm_software_path }}" sap_swpm_igs_helper_file_name: "{{ sap_swpm_igs_helper_file_name_get.stdout }}" - name: SAP Install Media Detect - SAP IGS - Check availability of IGS Helper - {{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_igs_helper_path }}/{{ sap_swpm_igs_helper_file_name }}" register: sap_swpm_igs_helper_file_name_stat failed_when: not sap_swpm_igs_helper_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml index daf5805f4..ce059a921 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml @@ -9,12 +9,12 @@ register: sap_swpm_kernel_dependent_file_name_get - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB - set_fact: + ansible.builtin.set_fact: sap_swpm_kernel_dependent_path: "{{ sap_swpm_software_path }}" sap_swpm_kernel_dependent_file_name: "{{ sap_swpm_kernel_dependent_file_name_get.stdout }}" - name: SAP Install Media Detect - SAP Kernel - Check availability of SAPEXEDB - {{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_kernel_dependent_path }}/{{ sap_swpm_kernel_dependent_file_name }}" register: sap_swpm_kernel_dependent_file_name_stat failed_when: not sap_swpm_kernel_dependent_file_name_stat.stat.exists @@ -28,12 +28,12 @@ register: sap_swpm_kernel_independent_file_name_get - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE - set_fact: + ansible.builtin.set_fact: sap_swpm_kernel_independent_path: "{{ sap_swpm_software_path }}" sap_swpm_kernel_independent_file_name: "{{ sap_swpm_kernel_independent_file_name_get.stdout }}" - name: SAP Install Media Detect - SAP Kernel - Check availability of SAPEXE - {{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_kernel_independent_path }}/{{ sap_swpm_kernel_independent_file_name }}" register: sap_swpm_kernel_independent_file_name_stat failed_when: not sap_swpm_kernel_independent_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml index b91eda72e..d2555e5ac 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml @@ -1,13 +1,13 @@ --- - name: SAP Install Media Detect - SAP SWPM - Set fact for install media directory - set_fact: + ansible.builtin.set_fact: sap_swpm_install_directory: "{{ sap_install_media_detect_directory }}/sap_swpm" sap_swpm_software_path: "{{ sap_install_media_detect_directory }}" sap_swpm_swpm_path: "{{ sap_install_media_detect_directory }}/sap_swpm" - name: SAP Install Media Detect - SAP SWPM - Create Directory - {{ sap_swpm_install_directory }} - file: + ansible.builtin.file: path: "{{ sap_swpm_install_directory }}" state: directory mode: '0755' @@ -33,7 +33,7 @@ - name: SAP Install Media Detect - SAP SWPM - Check availability of software path - {{ sap_swpm_software_path }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_software_path }}" register: sap_swpm_software_path_stat failed_when: not sap_swpm_software_path_stat.stat.exists @@ -61,7 +61,7 @@ # block: # - name: SAP Install Media Detect - SAP SWPM - Check availability backup location - {{ sap_swpm_backup_location }} -# stat: +# ansible.builtin.stat: # path: "{{ sap_swpm_backup_location }}" # register: sap_swpm_backup_location_stat # failed_when: not sap_swpm_backup_location_stat.stat.exists and '.CP' in sap_swpm_product_catalog_id @@ -83,7 +83,7 @@ # SWPM Path - name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM path - {{ sap_swpm_swpm_path }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_swpm_path }}" register: sap_swpm_swpm_path_stat failed_when: not sap_swpm_swpm_path_stat.stat.exists @@ -112,11 +112,11 @@ register: sap_swpm_swpm_sar_file_name_get - name: SAP Install Media Detect - SAP SWPM - Set fact for SWPM - set_fact: + ansible.builtin.set_fact: sap_swpm_swpm_sar_file_name: "{{ sap_swpm_swpm_sar_file_name_get.stdout }}" - name: SAP Install Media Detect - SAP SWPM - Check availability of SWPM - {{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_swpm_path }}/{{ sap_swpm_swpm_sar_file_name }}" register: sap_swpm_swpm_sar_file_name_stat failed_when: not sap_swpm_swpm_sar_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml index 6f6e613df..5095041b8 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml @@ -10,13 +10,13 @@ ignore_errors: true - name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP - set_fact: + ansible.builtin.set_fact: sap_swpm_web_dispatcher_path: "{{ sap_swpm_software_path }}" sap_swpm_web_dispatcher_file_name: "{{ sap_swpm_web_dispatcher_file_name_get.stdout }}" ignore_errors: true - name: SAP Install Media Detect - SAP WebDisp - Check availability of WEBDISP - {{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }} - stat: + ansible.builtin.stat: path: "{{ sap_swpm_web_dispatcher_path }}/{{ sap_swpm_web_dispatcher_file_name }}" register: sap_swpm_web_dispatcher_file_name_stat failed_when: not sap_swpm_web_dispatcher_file_name_stat.stat.exists diff --git a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml index 172ceb9da..55a4675e5 100644 --- a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml +++ b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml @@ -1,12 +1,12 @@ --- - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Create temp dir - {{ sap_hana_install_directory }}/tmp - file: + ansible.builtin.file: path: "{{ sap_hana_install_directory }}/tmp" state: directory - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Extracting {{ passed_sap_hana_install_components_sar }} - command: >- + ansible.builtin.command: >- {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} \ -R {{ sap_hana_install_directory }}/tmp -xvf {{ sap_hana_install_directory }}/{{ passed_sap_hana_install_components_sar }} \ @@ -17,7 +17,7 @@ changed_when: "'SAPCAR: processing archive' in sap_hana_install_extract.stdout" - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Create directory if SAP Host Agent - file: + ansible.builtin.file: path: "{{ sap_hana_install_directory }}/tmp/SAP_HOST_AGENT" state: directory mode: '0755' @@ -34,6 +34,6 @@ chdir: "{{ sap_hana_install_directory }}/tmp" - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Remove temp dir - {{ sap_hana_install_directory }}/tmp - file: + ansible.builtin.file: path: "{{ sap_hana_install_directory }}/tmp" state: absent diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index d73ce2613..9f7f1b6a0 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,43 +1,43 @@ --- - name: SAP Install Media Detect - Prepare - Get unrar - include_tasks: "prepare/unrar_get.yml" + ansible.builtin.include_tasks: "prepare/unrar_get.yml" - name: SAP Install Media Detect - Organize SAPCAR - include_tasks: "detect_sapcar.yml" + ansible.builtin.include_tasks: "detect_sapcar.yml" - name: SAP Install Media Detect - Organize SAP HANA installation media files - include_tasks: "detect_saphana.yml" + ansible.builtin.include_tasks: "detect_saphana.yml" when: - sap_install_media_detect_db == "saphana" - name: SAP Install Media Detect - Organize SAP SWPM installation media files - include_tasks: "detect_sapswpm.yml" + ansible.builtin.include_tasks: "detect_sapswpm.yml" when: - sap_install_media_detect_swpm - name: SAP Install Media Detect - Organize SAP Host Agent installation media files - include_tasks: "detect_saphostagent.yml" + ansible.builtin.include_tasks: "detect_saphostagent.yml" when: - sap_install_media_detect_hostagent - name: SAP Install Media Detect - Organize SAP IGS installation media files - include_tasks: "detect_sapigs.yml" + ansible.builtin.include_tasks: "detect_sapigs.yml" when: - sap_install_media_detect_igs - name: SAP Install Media Detect - Organize SAP Kernel installation media files - include_tasks: "detect_sapkernel.yml" + ansible.builtin.include_tasks: "detect_sapkernel.yml" when: - sap_install_media_detect_kernel - name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files - include_tasks: "detect_sapwebdisp.yml" + ansible.builtin.include_tasks: "detect_sapwebdisp.yml" when: - sap_install_media_detect_webdisp - name: SAP Install Media Detect - Complete Data Backup files for SAP HANA - include_tasks: "detect_backup_saphana.yml" + ansible.builtin.include_tasks: "detect_backup_saphana.yml" when: - sap_install_media_detect_backup == "saphana" @@ -45,74 +45,74 @@ # Leave to last so directory has less files to scan - name: SAP Install Media Detect - Organize SAP ASE installation media files - include_tasks: "detect_sapanydb_sapase.yml" + ansible.builtin.include_tasks: "detect_sapanydb_sapase.yml" when: - sap_install_media_detect_db == "sapase" - name: SAP Install Media Detect - Organize SAP MaxDB installation media files - include_tasks: "detect_sapanydb_sapmaxdb.yml" + ansible.builtin.include_tasks: "detect_sapanydb_sapmaxdb.yml" when: - sap_install_media_detect_db == "sapmaxdb" - name: SAP Install Media Detect - Organize Oracle DB installation media files - include_tasks: "detect_sapanydb_oracledb.yml" + ansible.builtin.include_tasks: "detect_sapanydb_oracledb.yml" when: - sap_install_media_detect_db == "oracledb" - name: SAP Install Media Detect - Organize IBM Db2 installation media files - include_tasks: "detect_sapanydb_ibmdb2.yml" + ansible.builtin.include_tasks: "detect_sapanydb_ibmdb2.yml" when: - sap_install_media_detect_db == "ibmdb2" - name: SAP Install Media Detect - EXPORT files for SAP ECC - include_tasks: "detect_export_sapecc.yml" + ansible.builtin.include_tasks: "detect_export_sapecc.yml" when: - sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - EXPORT files for SAP ECC IDES - include_tasks: "detect_export_sapecc_ides.yml" + ansible.builtin.include_tasks: "detect_export_sapecc_ides.yml" when: - sap_install_media_detect_export == "sapecc_ides" - name: SAP Install Media Detect - EXPORT files for SAP S/4HANA - include_tasks: "detect_export_saps4hana.yml" + ansible.builtin.include_tasks: "detect_export_saps4hana.yml" when: - sap_install_media_detect_export == "saps4hana" - name: SAP Install Media Detect - EXPORT files for SAP BW/4HANA - include_tasks: "detect_export_sapbw4hana.yml" + ansible.builtin.include_tasks: "detect_export_sapbw4hana.yml" when: - sap_install_media_detect_export == "sapbw4hana" - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only - include_tasks: "detect_export_sapnwas_abap.yml" + ansible.builtin.include_tasks: "detect_export_sapnwas_abap.yml" when: - sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only - include_tasks: "detect_export_sapnwas_java.yml" + ansible.builtin.include_tasks: "detect_export_sapnwas_java.yml" when: - sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) - include_tasks: "detect_export_sapsolman_abap.yml" + ansible.builtin.include_tasks: "detect_export_sapsolman_abap.yml" when: - sap_install_media_detect_export == "sapsolman_abap" - name: SAP Install Media Detection Completed - set global vars for subsequent Ansible Tasks - include_tasks: "set_global_vars.yml" + ansible.builtin.include_tasks: "set_global_vars.yml" # Output of detected SAP Software - name: SAP Install Media Detection Completed - Display Paths for SAP HANA - debug: + ansible.builtin.debug: msg: - "SAP HANA Path - {{ sap_hana_install_directory }}" when: - sap_install_media_detect_db == "saphana" - name: SAP Install Media Detection Completed - Display Paths for SAP SWPM - debug: + ansible.builtin.debug: msg: - "SAP SWPM Software Path - {{ sap_swpm_software_path }}" - "SAP SWPM SAPCAR Path - {{ sap_swpm_sapcar_path }}" From 1283abb7583e4ca1b74efad80f4d805525cd1448 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 11:49:52 +0200 Subject: [PATCH 072/128] sap_install_media_detect: fix command-instead-of-shell --- roles/sap_install_media_detect/tasks/detect_export_sapecc.yml | 4 ++-- .../tasks/detect_export_sapecc_ides.yml | 4 ++-- .../tasks/detect_export_sapnwas_abap.yml | 4 ++-- .../tasks/detect_export_sapnwas_java.yml | 4 ++-- .../tasks/detect_export_sapsolman_abap.yml | 4 ++-- .../sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml | 2 +- .../tasks/detect_sapanydb_oracledb.yml | 2 +- .../sap_install_media_detect/tasks/detect_sapanydb_sapase.yml | 2 +- .../tasks/detect_sapanydb_sapmaxdb.yml | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 02b0a1e09..38d7e209c 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapecc_export_extracted/" - name: SAP Install Media Detect - SAP ECC EXPORT - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" @@ -81,7 +81,7 @@ register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-list files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 3f030f9a9..e63ff4b92 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapecc_ides_export_extracted/" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" @@ -81,7 +81,7 @@ register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-list files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 23f6e3dfc..dd8b1653a 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapnwas_abap_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" @@ -81,7 +81,7 @@ register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-list files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index 9dca4a02f..d3a60459b 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapnwas_java_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" @@ -81,7 +81,7 @@ register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-list files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index c9ac50b8d..6ce331f15 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapsolman_abap_export_extracted/" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" @@ -55,7 +55,7 @@ register: detect_directory_export_extracted - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-list files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 27e727f08..3e99ad503 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -14,7 +14,7 @@ - "{{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/" - name: SAP Install Media Detect - IBM Db2 - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 0350ed7da..8bb2a0fbe 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -13,7 +13,7 @@ - "{{ sap_install_media_detect_directory }}/oracledb_client_extracted/" - name: SAP Install Media Detect - Oracle DB - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index 3a5913041..f6100f5e5 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -13,7 +13,7 @@ - "{{ sap_install_media_detect_directory }}/sapase_client_extracted/" - name: SAP Install Media Detect - SAP ASE - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index 716f5b74e..4e4b20ee1 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -12,7 +12,7 @@ - "{{ sap_install_media_detect_directory }}/sapmaxdb_extracted/" - name: SAP Install Media Detect - SAP MaxDB - List files in directory - ansible.builtin.shell: ls -1 + ansible.builtin.command: ls -1 register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" From f26fe683adc80ee76be52657e909f3139493e63a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 12:02:39 +0200 Subject: [PATCH 073/128] sap_install_media_detect: fix deprecated-command-syntax --- roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index f6100f5e5..63366e772 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -56,7 +56,6 @@ - name: SAP Install Media Detect - SAP ASE - Extract SAP ASE 16.0 Client with SAPCAR ansible.builtin.shell: | - chmod +x {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name }} {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name }} \ -xvf {{ item }} \ -manifest SIGNATURE.SMF \ From 6f8058ebee88b3b5a6733244eae5887ddf6c0a9c Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:12:08 +0100 Subject: [PATCH 074/128] sap_storage_setup: amend pkgs --- roles/sap_storage_setup/vars/RedHat.yml | 5 ++++- roles/sap_storage_setup/vars/Suse.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/roles/sap_storage_setup/vars/RedHat.yml b/roles/sap_storage_setup/vars/RedHat.yml index 973dc4445..0ecc0616d 100644 --- a/roles/sap_storage_setup/vars/RedHat.yml +++ b/roles/sap_storage_setup/vars/RedHat.yml @@ -3,7 +3,10 @@ __sap_storage_setup_extra_packages: - device-mapper-multipath - - lvm2* + - lvm2 + - lvm2-dbusd + - lvm2-libs + - lvm2-lockd - nfs-utils __sap_storage_setup_extra_services: diff --git a/roles/sap_storage_setup/vars/Suse.yml b/roles/sap_storage_setup/vars/Suse.yml index 4c4d6a812..47d3bf422 100644 --- a/roles/sap_storage_setup/vars/Suse.yml +++ b/roles/sap_storage_setup/vars/Suse.yml @@ -3,7 +3,7 @@ __sap_storage_setup_extra_packages: - multipath-tools - - lvm2* + - lvm2 - nfs-client __sap_storage_setup_extra_services: From 371767c1a260fa6b3213c7cdc1cf2ea25c29bbf1 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 15:55:06 +0200 Subject: [PATCH 075/128] sap_install_media_detect: fix command-instead-of-module and introduce url variable for rar --- .../defaults/main.yml | 3 +++ .../tasks/prepare/unrar_get.yml | 24 +++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index f873032ac..cf5176887 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -1,5 +1,8 @@ --- +# URL of rar +sap_install_media_detect_rar_url: https://www.rarlab.com/rar/rarlinux-x64-622.tar.gz + # e.g. /software sap_install_media_detect_directory: diff --git a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml b/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml index 9d9fe0d93..c19d5f28f 100644 --- a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml +++ b/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml @@ -1,9 +1,25 @@ --- -- name: SAP Install Media Detect - Prepare - Get unrar binary - ansible.builtin.shell: curl https://www.rarlab.com/rar/rarlinux-x64-612.tar.gz | tar -xvz --strip-components=1 rar/unrar - args: - chdir: "{{ sap_install_media_detect_directory }}" +- name: SAP Install Media Detect - Prepare - Download rar tar file + ansible.builtin.get_url: + url: "{{ sap_install_media_detect_rar_url }}" + dest: "{{ sap_install_media_detect_directory }}" + +- name: SAP Install Media Detect - Prepare - Extract unrar + ansible.builtin.unarchive: + src: "{{ sap_install_media_detect_directory }}/{{ sap_install_media_detect_rar_url.split('/')[-1:] | join() }}" + dest: "{{ sap_install_media_detect_directory }}" + remote_src: true + include: + - rar/unrar + extra_opts: + - --strip-components + - 1 + +- name: SAP Install Media Detect - Prepare - Remove rar tar file + ansible.builtin.file: + path: "{{ sap_install_media_detect_directory }}/{{ sap_install_media_detect_rar_url.split('/')[-1:] | join() }}" + state: absent - name: SAP Install Media Detect - Prepare - set facts for unrar path ansible.builtin.set_fact: From 363fefbda940414008902f0e595981351eeefb39 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 16:49:31 +0200 Subject: [PATCH 076/128] sap_install_media_detect: fix no-changed-when; add mode to get_url for rar --- .../tasks/detect_export_sapecc.yml | 15 ++++++++++----- .../tasks/detect_export_sapecc_ides.yml | 15 ++++++++++----- .../tasks/detect_export_sapnwas_abap.yml | 15 ++++++++++----- .../tasks/detect_export_sapnwas_java.yml | 15 ++++++++++----- .../tasks/detect_export_sapsolman_abap.yml | 7 +++++-- .../tasks/detect_sapanydb_ibmdb2.yml | 12 ++++++++---- .../tasks/detect_sapanydb_oracledb.yml | 9 ++++++--- .../tasks/detect_sapanydb_sapase.yml | 7 +++++-- .../tasks/detect_sapanydb_sapmaxdb.yml | 6 ++++-- .../tasks/detect_saphana.yml | 10 +++++----- .../tasks/detect_saphostagent.yml | 5 +++-- .../tasks/detect_sapigs.yml | 8 ++++---- .../tasks/detect_sapkernel.yml | 8 ++++---- .../tasks/detect_sapswpm.yml | 11 ++++++----- .../tasks/detect_sapwebdisp.yml | 4 ++-- .../tasks/extract/sapcar_loop_handler_saphana.yml | 1 + .../tasks/prepare/unrar_get.yml | 1 + 17 files changed, 94 insertions(+), 55 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 38d7e209c..c4f6de744 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -16,26 +16,27 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files ansible.builtin.shell: | @@ -49,21 +50,24 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_export_extracted ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" @@ -85,6 +89,7 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index e63ff4b92..145aa9e5e 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -16,26 +16,27 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files ansible.builtin.shell: | @@ -49,21 +50,24 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_ides_export_extracted ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_ides_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" @@ -85,6 +89,7 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index dd8b1653a..3ae98d80b 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -16,26 +16,27 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: no - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: no - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | @@ -49,21 +50,24 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_abap_export_extracted ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files (unrar x) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files (unrar x) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_abap_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" @@ -85,6 +89,7 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index d3a60459b..a7791ee50 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -16,26 +16,27 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | @@ -49,21 +50,24 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_java_export_extracted ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files (unrar x) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files (unrar x) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_java_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" @@ -85,6 +89,7 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index 6ce331f15..f2b92edde 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -16,16 +16,17 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT files ansible.builtin.shell: | @@ -37,7 +38,8 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapsolman_abap_export_extracted/{{ item }} ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" @@ -59,6 +61,7 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 3e99ad503..89e22c257 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -18,16 +18,17 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - IBM Db2 - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 installation media ansible.builtin.shell: | @@ -59,21 +60,24 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 8bb2a0fbe..a75f44c01 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -17,16 +17,17 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - Oracle DB - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB installation media ansible.builtin.shell: | @@ -48,14 +49,16 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index 63366e772..5b5a5236c 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -17,16 +17,17 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP ASE - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE installation media ansible.builtin.shell: | @@ -47,7 +48,8 @@ use_regex: yes register: detect_directory_files_sapase_client -- name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapase_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" @@ -64,6 +66,7 @@ chdir: "{{ sap_install_media_detect_directory }}" with_items: - "{{ detect_directory_files_sapase_client.files[0].path }}" + changed_when: true - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted ansible.builtin.find: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index 4e4b20ee1..83751cc37 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -16,16 +16,17 @@ register: detect_directory_files args: chdir: "{{ sap_install_media_detect_directory }}" + changed_when: false - name: SAP Install Media Detect - SAP MaxDB - Detect ZIP files (including no file extensions), ignore errors ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip -# changed_when: "item.stdout | length > 0" with_items: - "{{ detect_directory_files.stdout_lines }}" args: chdir: "{{ sap_install_media_detect_directory }}" ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB installation media ansible.builtin.shell: | @@ -37,7 +38,8 @@ args: chdir: "{{ sap_install_media_detect_directory }}" -- name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media +# Reason for noqa: Difficult to determine the change status in the shell command sequence +- name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index ebc23cd13..15c458f0f 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -15,15 +15,15 @@ - name: SAP Install Media Detect - SAP HANA - Copy SAPCAR file ansible.builtin.shell: | cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} - + changed_when: true # IMDB SAR Files - name: SAP Install Media Detect - SAP HANA - Get all IMDB SAR files in folder - {{ sap_install_media_detect_directory }} - ansible.builtin.shell: | - ls IMDB*.SAR + ansible.builtin.shell: ls IMDB*.SAR args: chdir: "{{ sap_install_media_detect_directory }}" register: imdb_sarfiles_list + changed_when: false - name: SAP Install Media Detect - SAP HANA - Set fact list of SAR files ansible.builtin.set_fact: @@ -75,11 +75,11 @@ group: root - name: SAP Install Media Detect - SAP HANA - Get all SAR files in folder - {{ sap_hana_install_directory }} - ansible.builtin.shell: | - ls *.SAR + ansible.builtin.shell: ls *.SAR args: chdir: "{{ sap_hana_install_directory }}" register: sarfiles_list + changed_when: false - name: SAP Install Media Detect - SAP HANA - Set fact for list of SAR files ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml index 6a41e8f82..23f0f8e6f 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml @@ -14,12 +14,13 @@ # SAPHOSTAGENT - name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ sap_install_media_detect_directory }} - ansible.builtin.shell: | - ls SAPHOSTAGENT*SAR + ansible.builtin.shell: ls SAPHOSTAGENT*SAR args: chdir: "{{ sap_install_media_detect_directory }}" register: saphostagent_sarfile + changed_when: false - name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file ansible.builtin.shell: | cp {{ sap_install_media_detect_directory }}/{{ saphostagent_sarfile.stdout }} {{ sap_hostagent_install_directory }}/{{ saphostagent_sarfile.stdout }} + changed_when: true diff --git a/roles/sap_install_media_detect/tasks/detect_sapigs.yml b/roles/sap_install_media_detect/tasks/detect_sapigs.yml index 8b564b566..9c08067f7 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapigs.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapigs.yml @@ -1,11 +1,11 @@ --- - name: SAP Install Media Detect - SAP IGS - Get IGS from software path - ansible.builtin.shell: | - ls igsexe*.sar + ansible.builtin.shell: ls igsexe*.sar args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP IGS - Set fact for IGS ansible.builtin.set_fact: @@ -21,11 +21,11 @@ # 4. IGS Helper - name: SAP Install Media Detect - SAP IGS - Get IGS Helper from software path - ansible.builtin.shell: | - ls igshelper*.sar + ansible.builtin.shell: ls igshelper*.sar args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_igs_helper_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP IGS - Set fact for IGS ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml index ce059a921..911dd5a10 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapkernel.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapkernel.yml @@ -2,11 +2,11 @@ # 5. SAPEXEDB - name: SAP Install Media Detect - SAP Kernel - Get SAPEXEDB from software path - ansible.builtin.shell: | - ls SAPEXEDB_*.SAR + ansible.builtin.shell: ls SAPEXEDB_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_dependent_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXEDB ansible.builtin.set_fact: @@ -21,11 +21,11 @@ # 6. SAPEXE - name: SAP Install Media Detect - SAP Kernel - Get SAPEXE from software path - ansible.builtin.shell: | - ls SAPEXE_*.SAR + ansible.builtin.shell: ls SAPEXE_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_kernel_independent_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP Kernel - Set fact for SAPEXE ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml index d2555e5ac..057d614ac 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml @@ -17,19 +17,20 @@ - name: SAP Install Media Detect - SAP SWPM - Copy SAPCAR file ansible.builtin.shell: | cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_swpm_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} - + changed_when: true # SWPM - name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_install_media_detect_directory }} - ansible.builtin.shell: | - ls SWPM*.SAR + ansible.builtin.shell: ls SWPM*.SAR args: chdir: "{{ sap_install_media_detect_directory }}" register: sap_swpm_swpm_sar_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP SWPM - Copy SWPM file ansible.builtin.shell: | cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }} {{ sap_install_media_detect_directory }}/sap_swpm/{{ sap_swpm_swpm_sar_file_name_get.stdout }} + changed_when: true - name: SAP Install Media Detect - SAP SWPM - Check availability of software path - {{ sap_swpm_software_path }} @@ -105,11 +106,11 @@ # 2. SWPM - name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_swpm_swpm_path }} - ansible.builtin.shell: | - ls SWPM*.SAR + ansible.builtin.shell: ls SWPM*.SAR args: chdir: "{{ sap_swpm_swpm_path }}" register: sap_swpm_swpm_sar_file_name_get + changed_when: false - name: SAP Install Media Detect - SAP SWPM - Set fact for SWPM ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml index 5095041b8..960f22cb6 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapwebdisp.yml @@ -2,12 +2,12 @@ # 7. Web Dispatcher - name: SAP Install Media Detect - SAP WebDisp - Get WEBDISP from software path - ansible.builtin.shell: | - ls SAPWEBDISP_*.SAR + ansible.builtin.shell: ls SAPWEBDISP_*.SAR args: chdir: "{{ sap_swpm_software_path }}" register: sap_swpm_web_dispatcher_file_name_get ignore_errors: true + changed_when: false - name: SAP Install Media Detect - SAP WebDisp - Set fact for WEBDISP ansible.builtin.set_fact: diff --git a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml index 55a4675e5..773ac6eb8 100644 --- a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml +++ b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml @@ -32,6 +32,7 @@ cp -R $extracted_dir ../extracted/$extracted_dir args: chdir: "{{ sap_hana_install_directory }}/tmp" + changed_when: true - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Remove temp dir - {{ sap_hana_install_directory }}/tmp ansible.builtin.file: diff --git a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml b/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml index c19d5f28f..8001f0485 100644 --- a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml +++ b/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml @@ -4,6 +4,7 @@ ansible.builtin.get_url: url: "{{ sap_install_media_detect_rar_url }}" dest: "{{ sap_install_media_detect_directory }}" + mode: '0644' - name: SAP Install Media Detect - Prepare - Extract unrar ansible.builtin.unarchive: From dcef092dfbe1019cffe06e0a68ec5f14d05ac640 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 5 Jun 2023 17:28:31 +0200 Subject: [PATCH 077/128] sap_install_media_detect: fix risky-file-permissions: Use the permissions from a test run --- roles/sap_install_media_detect/tasks/detect_saphana.yml | 1 + .../tasks/extract/sapcar_loop_handler_saphana.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index 15c458f0f..573e101fd 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -64,6 +64,7 @@ ansible.builtin.file: path: "{{ sap_hana_install_directory }}/extracted" state: directory + mode: '0755' - name: SAP Install Media Detect - SAP HANA - Change ownership of deployment directory - {{ sap_hana_install_directory }} ansible.builtin.file: diff --git a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml index 773ac6eb8..b99da95da 100644 --- a/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml +++ b/roles/sap_install_media_detect/tasks/extract/sapcar_loop_handler_saphana.yml @@ -4,6 +4,7 @@ ansible.builtin.file: path: "{{ sap_hana_install_directory }}/tmp" state: directory + mode: '0700' - name: SAP Install Media Detect - SAP HANA - SAPCAR Extract Loop - Extracting {{ passed_sap_hana_install_components_sar }} ansible.builtin.command: >- From 645ac474e139ea67a58ccb8fb0da9f3cda179336 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 6 Jun 2023 16:25:01 +0200 Subject: [PATCH 078/128] sap_install_media_detect: modify the handling of RAR files --- .../defaults/main.yml | 10 +++- .../tasks/detect_export_sapecc.yml | 10 ++-- .../tasks/detect_export_sapecc_ides.yml | 10 ++-- .../tasks/detect_export_sapnwas_abap.yml | 10 ++-- .../tasks/detect_export_sapnwas_java.yml | 10 ++-- roles/sap_install_media_detect/tasks/main.yml | 4 +- .../tasks/prepare/enable_rar_handling.yml | 51 +++++++++++++++++++ .../tasks/prepare/unrar_get.yml | 27 ---------- 8 files changed, 81 insertions(+), 51 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml delete mode 100644 roles/sap_install_media_detect/tasks/prepare/unrar_get.yml diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index cf5176887..d6b1a6fa7 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -1,7 +1,13 @@ --- -# URL of rar -sap_install_media_detect_rar_url: https://www.rarlab.com/rar/rarlinux-x64-622.tar.gz +sap_install_media_detect_rar_package: '' + +# commands for handling rar files +sap_install_media_detect_rar_list: '/usr/bin/lsar' +sap_install_media_detect_rar_extract: '/usr/bin/unar' + +#sap_install_media_detect_rar_list: '/usr/bin/unrar lb' +#sap_install_media_detect_rar_extract: '/usr/bin/unrar x' # e.g. /software sap_install_media_detect_directory: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index c4f6de744..a9e332af6 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -41,7 +41,7 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" with_items: @@ -59,7 +59,7 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when +- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" @@ -67,8 +67,8 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_export_extracted/ ; fi +- name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when + ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -120,7 +120,7 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-identify SAP ECC EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 145aa9e5e..f73b404af 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -41,7 +41,7 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" with_items: @@ -59,7 +59,7 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" @@ -67,8 +67,8 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files (unrar x) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapecc_ides_export_extracted/ ; fi +- name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when + ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_ides_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -120,7 +120,7 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-identify SAP ECC IDES EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 3ae98d80b..2d5afd022 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -41,7 +41,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" with_items: @@ -59,7 +59,7 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" @@ -67,8 +67,8 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files (unrar x) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_abap_export_extracted/ ; fi +- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when + ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_abap_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: @@ -120,7 +120,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-identify EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index a7791ee50..724bf77ae 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -41,7 +41,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export changed_when: "item | length > 0" with_items: @@ -59,7 +59,7 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension (for use with unrar binary) # noqa no-changed-when +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" @@ -67,8 +67,8 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files (unrar x) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then "{{ sap_install_media_detect_unrar_binary }}" x "{{ item }}" sapnwas_java_export_extracted/ ; fi +- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when + ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_java_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: @@ -120,7 +120,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-identify EXPORT files ansible.builtin.shell: | if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; - elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if "{{ sap_install_media_detect_unrar_binary }}" lb {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi + elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 9f7f1b6a0..9ae602f62 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,7 +1,7 @@ --- -- name: SAP Install Media Detect - Prepare - Get unrar - ansible.builtin.include_tasks: "prepare/unrar_get.yml" +- name: SAP Install Media Detect - Prepare - enable rar handling + ansible.builtin.include_tasks: "prepare/enable_rar_handling.yml" - name: SAP Install Media Detect - Organize SAPCAR ansible.builtin.include_tasks: "detect_sapcar.yml" diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml new file mode 100644 index 000000000..c4caccca7 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -0,0 +1,51 @@ +--- + +- name: SAP Install Media Detect - Prepare - Install the unar package from EPEL + when: sap_install_media_detect_rar_package == 'EPEL' + block: + + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the correct EPEL GPG key + ansible.builtin.set_fact: + sap_install_media_detect_epel_gpg_key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + + - name: SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key + ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" + + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL + ansible.builtin.set_fact: + sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" + + - name: SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo + ansible.builtin.package: + name: "{{ sap_install_media_detect_epel_url }}" + state: present + + - name: SAP Install Media Detect - Prepare - EPEL - Install the unar package + ansible.builtin.package: + name: unar + state: present + + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for listing the content of a RAR file + ansible.builtin.set_fact: + sap_install_media_detect_rar_list: '/usr/bin/lsar' + + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for extracting a RAR file + ansible.builtin.set_fact: + sap_install_media_detect_rar_extract: '/usr/bin/unar' + +- name: SAP Install Media Detect - Prepare - Install an unrar package + when: sap_install_media_detect_rar_package != 'EPEL' + block: + + - name: SAP Install Media Detect - Prepare - unrar - Install the unrar package + ansible.builtin.package: + name: "{{ sap_install_media_detect_rar_package }}" + state: present + + - name: SAP Install Media Detect - Prepare - unrar - Set fact for listing the content of a RAR file + ansible.builtin.set_fact: + sap_install_media_detect_rar_list: '/usr/bin/unrar lb' + + - name: SAP Install Media Detect - Prepare - unrar - Set fact for extracting a RAR file + ansible.builtin.set_fact: + sap_install_media_detect_rar_extract: '/usr/bin/unrar x' diff --git a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml b/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml deleted file mode 100644 index 8001f0485..000000000 --- a/roles/sap_install_media_detect/tasks/prepare/unrar_get.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- - -- name: SAP Install Media Detect - Prepare - Download rar tar file - ansible.builtin.get_url: - url: "{{ sap_install_media_detect_rar_url }}" - dest: "{{ sap_install_media_detect_directory }}" - mode: '0644' - -- name: SAP Install Media Detect - Prepare - Extract unrar - ansible.builtin.unarchive: - src: "{{ sap_install_media_detect_directory }}/{{ sap_install_media_detect_rar_url.split('/')[-1:] | join() }}" - dest: "{{ sap_install_media_detect_directory }}" - remote_src: true - include: - - rar/unrar - extra_opts: - - --strip-components - - 1 - -- name: SAP Install Media Detect - Prepare - Remove rar tar file - ansible.builtin.file: - path: "{{ sap_install_media_detect_directory }}/{{ sap_install_media_detect_rar_url.split('/')[-1:] | join() }}" - state: absent - -- name: SAP Install Media Detect - Prepare - set facts for unrar path - ansible.builtin.set_fact: - sap_install_media_detect_unrar_binary: "{{ sap_install_media_detect_directory }}/unrar" From dfc0666511b07d0459ccc3bfc8f7fba3abc73b6d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 7 Jun 2023 17:16:11 +0200 Subject: [PATCH 079/128] sap_install_media_detect: take care of the EPEL repo --- .../defaults/main.yml | 3 +- .../tasks/cleanup/disable-epel-repo.yml | 29 +++++++++++++++ roles/sap_install_media_detect/tasks/main.yml | 4 +++ .../tasks/prepare/enable_rar_handling.yml | 36 ++++++++++++------- 4 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index d6b1a6fa7..e0199068b 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -1,6 +1,7 @@ --- -sap_install_media_detect_rar_package: '' +sap_install_media_detect_rar_package: 'EPEL' +#sap_install_media_detect_rar_package: 'linux-rar' # commands for handling rar files sap_install_media_detect_rar_list: '/usr/bin/lsar' diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml new file mode 100644 index 000000000..bbd9c35de --- /dev/null +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -0,0 +1,29 @@ +--- + +- name: SAP Install Media Detect - Cleanup - Get all GPG keys + ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | awk '/gpg/&&/Fedora/{gsub ("\\(epel", "EPEL "); gsub (" \\(", " "); if ($0 ~ /EPEL {{ ansible_distribution_major_version }}/)print}' + register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys + failed_when: false + changed_when: false + +- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version + ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" + register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey + when: + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 + +- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal + ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})' + register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal + failed_when: false + +- name: SAP Install Media Detect - Cleanup - Report any EPEL GPG key presence for this OS version + ansible.builtin.fail: + msg: Not all EPEL GPG keys have been removed! + when: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal.stdout_lines | length != 0 + +- name: SAP Install Media Detect - Cleanup - Remove the EPEL repo + ansible.builtin.package: + name: epel-release + state: absent diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 9ae602f62..98ba95024 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -119,3 +119,7 @@ - "SAP SWPM Path - {{ sap_swpm_swpm_path }}" when: - sap_install_media_detect_swpm + +- name: SAP Install Media Detect - Cleanup - Disable the EPEL repo if necessary + ansible.builtin.include_tasks: "cleanup/disable-epel-repo.yml" + when: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index c4caccca7..b01a7bbf6 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -4,21 +4,33 @@ when: sap_install_media_detect_rar_package == 'EPEL' block: - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the correct EPEL GPG key - ansible.builtin.set_fact: - sap_install_media_detect_epel_gpg_key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + - name: SAP Install Media Detect - Prepare - EPEL - Detect the presence of the epel-release package + ansible.builtin.command: rpm -q epel-release --qf '%{NAME}' + register: __sap_install_media_detect_register_rpm_q_epel + failed_when: false - - name: SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key - ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" + - name: SAP Install Media Detect - Prepare - EPEL - enable the epel repo if necessary + when: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' + block: - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL - ansible.builtin.set_fact: - sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the correct EPEL GPG key + ansible.builtin.set_fact: + sap_install_media_detect_epel_gpg_key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" - - name: SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo - ansible.builtin.package: - name: "{{ sap_install_media_detect_epel_url }}" - state: present + - name: SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key + ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" + + - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL + ansible.builtin.set_fact: + sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" + + - name: SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo + ansible.builtin.package: + name: "{{ sap_install_media_detect_epel_url }}" + state: present + + - name: SAP Install Media Detect - Prepare - EPEL - Enable the CRB repo + ansible.builtin.command: /usr/bin/crb enable - name: SAP Install Media Detect - Prepare - EPEL - Install the unar package ansible.builtin.package: From f9bdf749f55cf367a5fe53a212ab0cf1f32aacec Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 13 Jun 2023 15:46:31 +0200 Subject: [PATCH 080/128] sap_storage_setup: add missing mount opts --- .../tasks/generic_tasks/configure_nfs_filesystems.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml index 0b07c257f..4697ec2dc 100644 --- a/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml +++ b/roles/sap_storage_setup/tasks/generic_tasks/configure_nfs_filesystems.yml @@ -176,6 +176,7 @@ path: "{{ mount_item.mountpoint }}" src: "{{ nfs_server }}/{{ mount_item.mount_src | regex_replace('^/', '') }}" fstype: "{{ nfs_item.nfs_filesystem_type | default(sap_storage_setup_nfs_filesystem_type) }}" + opts: "{{ attach_item.nfs_mount_options | default(sap_storage_setup_nfs_mount_options) }}" state: mounted loop: "{{ sap_storage_setup_related_directories }}" loop_control: @@ -184,4 +185,8 @@ vars: nfs_path: "{{ nfs_item.nfs_path | regex_replace('^/', '') | regex_replace('/$', '') }}" nfs_server: "{{ nfs_item.nfs_server | default(sap_storage_setup_nfs_server) | regex_replace('/$', '') }}" - attach_item: "{{ sap_storage_setup_definition | selectattr('name', 'eq', nfs_item.name) }}" + attach_item: | + {{ sap_storage_setup_definition + | selectattr('name', 'eq', nfs_item.name) + | join('') + }} # convert this single element list to a simple dict From 713ff8f949ef385793f5a39a0597ac8bdddb3fc5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 14 Jun 2023 14:58:13 +0200 Subject: [PATCH 081/128] sap_install_media_detect: Resolve new ansible-lint errors related to rar file handling --- .../tasks/cleanup/disable-epel-repo.yml | 25 ++++++++++------- roles/sap_install_media_detect/tasks/main.yml | 4 ++- .../tasks/prepare/enable_rar_handling.yml | 27 ++++++++++++++----- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml index bbd9c35de..b8b9464eb 100644 --- a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -1,5 +1,7 @@ --- +# Note: This file is only included from tasks/main.yml if the epel-release package had not been initially detected. + - name: SAP Install Media Detect - Cleanup - Get all GPG keys ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | awk '/gpg/&&/Fedora/{gsub ("\\(epel", "EPEL "); gsub (" \\(", " "); if ($0 ~ /EPEL {{ ansible_distribution_major_version }}/)print}' register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys @@ -7,21 +9,24 @@ changed_when: false - name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version - ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" - register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey + ansible.builtin.rpm_key: + state: absent + key: "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" +# ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" +# register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey when: - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 -- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal - ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})' - register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal - failed_when: false +#- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal +# ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})' +# register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal +# failed_when: false -- name: SAP Install Media Detect - Cleanup - Report any EPEL GPG key presence for this OS version - ansible.builtin.fail: - msg: Not all EPEL GPG keys have been removed! - when: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal.stdout_lines | length != 0 +#- name: SAP Install Media Detect - Cleanup - Report any EPEL GPG key presence for this OS version +# ansible.builtin.fail: +# msg: Not all EPEL GPG keys have been removed! +# when: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal.stdout_lines | length != 0 - name: SAP Install Media Detect - Cleanup - Remove the EPEL repo ansible.builtin.package: diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 98ba95024..e2e55cc07 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -122,4 +122,6 @@ - name: SAP Install Media Detect - Cleanup - Disable the EPEL repo if necessary ansible.builtin.include_tasks: "cleanup/disable-epel-repo.yml" - when: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' + when: + - sap_install_media_detect_rar_package == 'EPEL' + - __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index b01a7bbf6..cb23ba804 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -4,10 +4,17 @@ when: sap_install_media_detect_rar_package == 'EPEL' block: - - name: SAP Install Media Detect - Prepare - EPEL - Detect the presence of the epel-release package +# Reason for noqa: Too much effort for now to examine the output of the yum module for the presence of a package +# If the epel-release package is installed, the yum module with the list parameter returns an array +# with two dictionaries, one with yumstate installed and one with yumstate available. +# If the epel-release package is not installed, the yum module with the list parameter returns an empty array. + - name: SAP Install Media Detect - Prepare - EPEL - Detect the presence of the epel-release package # noqa command-instead-of-module +# ansible.builtin.yum: +# list: epel-release ansible.builtin.command: rpm -q epel-release --qf '%{NAME}' register: __sap_install_media_detect_register_rpm_q_epel failed_when: false + changed_when: false - name: SAP Install Media Detect - Prepare - EPEL - enable the epel repo if necessary when: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' @@ -18,18 +25,24 @@ sap_install_media_detect_epel_gpg_key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" - name: SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key - ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" + ansible.builtin.rpm_key: + state: present + key: "{{ sap_install_media_detect_epel_gpg_key }}" +# ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" +# changed_when: true - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL - ansible.builtin.set_fact: - sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" +# - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL +# ansible.builtin.set_fact: +# sap_install_media_detect_epel_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" - name: SAP Install Media Detect - Prepare - EPEL - Enable the EPEL repo ansible.builtin.package: - name: "{{ sap_install_media_detect_epel_url }}" +# name: "{{ sap_install_media_detect_epel_url }}" + name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm" state: present - - name: SAP Install Media Detect - Prepare - EPEL - Enable the CRB repo +# Reason for noqa: We would need an extra call to /usr/bin/crb status to determine the current status + - name: SAP Install Media Detect - Prepare - EPEL - Enable the CRB repo # noqa no-changed-when ansible.builtin.command: /usr/bin/crb enable - name: SAP Install Media Detect - Prepare - EPEL - Install the unar package From f194924e832b2834bc1d328a971bb05aa1be378f Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 14 Jun 2023 15:21:05 +0200 Subject: [PATCH 082/128] sap_install_media_detect: introduce a tag for just performing the rar handling tasks --- .../tasks/cleanup/disable-epel-repo.yml | 2 +- roles/sap_install_media_detect/tasks/main.yml | 57 ++++++++++++------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml index b8b9464eb..eac79a748 100644 --- a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -11,7 +11,7 @@ - name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version ansible.builtin.rpm_key: state: absent - key: "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" + key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" # ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" # register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey when: diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index e2e55cc07..a64ea714c 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,43 +1,52 @@ --- +- name: dummy + debug: + msg: dummy + tags: sap_install_media_detect_rar_handling + - name: SAP Install Media Detect - Prepare - enable rar handling - ansible.builtin.include_tasks: "prepare/enable_rar_handling.yml" + ansible.builtin.include_tasks: + file: prepare/enable_rar_handling.yml + apply: + tags: sap_install_media_detect_rar_handling + tags: sap_install_media_detect_rar_handling - name: SAP Install Media Detect - Organize SAPCAR - ansible.builtin.include_tasks: "detect_sapcar.yml" + ansible.builtin.include_tasks: detect_sapcar.yml - name: SAP Install Media Detect - Organize SAP HANA installation media files - ansible.builtin.include_tasks: "detect_saphana.yml" + ansible.builtin.include_tasks: detect_saphana.yml when: - sap_install_media_detect_db == "saphana" - name: SAP Install Media Detect - Organize SAP SWPM installation media files - ansible.builtin.include_tasks: "detect_sapswpm.yml" + ansible.builtin.include_tasks: detect_sapswpm.yml when: - sap_install_media_detect_swpm - name: SAP Install Media Detect - Organize SAP Host Agent installation media files - ansible.builtin.include_tasks: "detect_saphostagent.yml" + ansible.builtin.include_tasks: detect_saphostagent.yml when: - sap_install_media_detect_hostagent - name: SAP Install Media Detect - Organize SAP IGS installation media files - ansible.builtin.include_tasks: "detect_sapigs.yml" + ansible.builtin.include_tasks: detect_sapigs.yml when: - sap_install_media_detect_igs - name: SAP Install Media Detect - Organize SAP Kernel installation media files - ansible.builtin.include_tasks: "detect_sapkernel.yml" + ansible.builtin.include_tasks: detect_sapkernel.yml when: - sap_install_media_detect_kernel - name: SAP Install Media Detect - Organize SAP Web Dispatcher installation media files - ansible.builtin.include_tasks: "detect_sapwebdisp.yml" + ansible.builtin.include_tasks: detect_sapwebdisp.yml when: - sap_install_media_detect_webdisp - name: SAP Install Media Detect - Complete Data Backup files for SAP HANA - ansible.builtin.include_tasks: "detect_backup_saphana.yml" + ansible.builtin.include_tasks: detect_backup_saphana.yml when: - sap_install_media_detect_backup == "saphana" @@ -45,62 +54,62 @@ # Leave to last so directory has less files to scan - name: SAP Install Media Detect - Organize SAP ASE installation media files - ansible.builtin.include_tasks: "detect_sapanydb_sapase.yml" + ansible.builtin.include_tasks: detect_sapanydb_sapase.yml when: - sap_install_media_detect_db == "sapase" - name: SAP Install Media Detect - Organize SAP MaxDB installation media files - ansible.builtin.include_tasks: "detect_sapanydb_sapmaxdb.yml" + ansible.builtin.include_tasks: detect_sapanydb_sapmaxdb.yml when: - sap_install_media_detect_db == "sapmaxdb" - name: SAP Install Media Detect - Organize Oracle DB installation media files - ansible.builtin.include_tasks: "detect_sapanydb_oracledb.yml" + ansible.builtin.include_tasks: detect_sapanydb_oracledb.yml when: - sap_install_media_detect_db == "oracledb" - name: SAP Install Media Detect - Organize IBM Db2 installation media files - ansible.builtin.include_tasks: "detect_sapanydb_ibmdb2.yml" + ansible.builtin.include_tasks: detect_sapanydb_ibmdb2.yml when: - sap_install_media_detect_db == "ibmdb2" - name: SAP Install Media Detect - EXPORT files for SAP ECC - ansible.builtin.include_tasks: "detect_export_sapecc.yml" + ansible.builtin.include_tasks: detect_export_sapecc.yml when: - sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - EXPORT files for SAP ECC IDES - ansible.builtin.include_tasks: "detect_export_sapecc_ides.yml" + ansible.builtin.include_tasks: detect_export_sapecc_ides.yml when: - sap_install_media_detect_export == "sapecc_ides" - name: SAP Install Media Detect - EXPORT files for SAP S/4HANA - ansible.builtin.include_tasks: "detect_export_saps4hana.yml" + ansible.builtin.include_tasks: detect_export_saps4hana.yml when: - sap_install_media_detect_export == "saps4hana" - name: SAP Install Media Detect - EXPORT files for SAP BW/4HANA - ansible.builtin.include_tasks: "detect_export_sapbw4hana.yml" + ansible.builtin.include_tasks: detect_export_sapbw4hana.yml when: - sap_install_media_detect_export == "sapbw4hana" - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only - ansible.builtin.include_tasks: "detect_export_sapnwas_abap.yml" + ansible.builtin.include_tasks: detect_export_sapnwas_abap.yml when: - sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only - ansible.builtin.include_tasks: "detect_export_sapnwas_java.yml" + ansible.builtin.include_tasks: detect_export_sapnwas_java.yml when: - sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) - ansible.builtin.include_tasks: "detect_export_sapsolman_abap.yml" + ansible.builtin.include_tasks: detect_export_sapsolman_abap.yml when: - sap_install_media_detect_export == "sapsolman_abap" - name: SAP Install Media Detection Completed - set global vars for subsequent Ansible Tasks - ansible.builtin.include_tasks: "set_global_vars.yml" + ansible.builtin.include_tasks: set_global_vars.yml # Output of detected SAP Software @@ -121,7 +130,11 @@ - sap_install_media_detect_swpm - name: SAP Install Media Detect - Cleanup - Disable the EPEL repo if necessary - ansible.builtin.include_tasks: "cleanup/disable-epel-repo.yml" + ansible.builtin.include_tasks: + file: cleanup/disable-epel-repo.yml + apply: + tags: sap_install_media_detect_rar_handling + tags: sap_install_media_detect_rar_handling when: - sap_install_media_detect_rar_package == 'EPEL' - __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' From 0993661cf11d6080ddfd367c6f2769464fcb0cee Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 14 Jun 2023 15:22:36 +0200 Subject: [PATCH 083/128] sap_install_media_detect: remove superfluous debug task --- roles/sap_install_media_detect/tasks/main.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index a64ea714c..6955cdf20 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,10 +1,5 @@ --- -- name: dummy - debug: - msg: dummy - tags: sap_install_media_detect_rar_handling - - name: SAP Install Media Detect - Prepare - enable rar handling ansible.builtin.include_tasks: file: prepare/enable_rar_handling.yml From 8b6100f6743daa05c2c9944eb61bd4f9db182e55 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 14 Jun 2023 15:52:25 +0200 Subject: [PATCH 084/128] sap_install_media_detect: fix risky-shell-pipe --- .../tasks/detect_export_sapecc.yml | 18 +++++++++--------- .../tasks/detect_export_sapecc_ides.yml | 18 +++++++++--------- .../tasks/detect_export_sapnwas_abap.yml | 18 +++++++++--------- .../tasks/detect_export_sapnwas_java.yml | 18 +++++++++--------- .../tasks/detect_export_sapsolman_abap.yml | 10 +++++----- .../tasks/detect_sapanydb_ibmdb2.yml | 12 ++++++------ .../tasks/detect_sapanydb_oracledb.yml | 10 +++++----- .../tasks/detect_sapanydb_sapase.yml | 4 ++-- .../tasks/detect_sapanydb_sapmaxdb.yml | 4 ++-- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index a9e332af6..63105f676 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -19,7 +19,7 @@ changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -29,7 +29,7 @@ changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -40,7 +40,7 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" @@ -52,7 +52,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_export_extracted ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_export_extracted ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -60,7 +60,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -68,7 +68,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -94,7 +94,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -106,7 +106,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -119,7 +119,7 @@ - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - re-identify SAP ECC EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXPORT_' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index f73b404af..434496df9 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -19,7 +19,7 @@ changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -29,7 +29,7 @@ changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -40,7 +40,7 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export changed_when: "item | length > 0" @@ -52,7 +52,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_ides_export_extracted ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapecc_ides_export_extracted ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -60,7 +60,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -68,7 +68,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_ides_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapecc_ides_export_extracted/ ; fi with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: @@ -94,7 +94,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -106,7 +106,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -119,7 +119,7 @@ - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - re-identify SAP ECC IDES EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -Eq '*EXP[0-9]' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ecc_export_repeated changed_when: "item | length > 0" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 2d5afd022..a6e5bab79 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -19,7 +19,7 @@ changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -29,7 +29,7 @@ changed_when: no - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -40,7 +40,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" @@ -52,7 +52,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_abap_export_extracted ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_abap_export_extracted ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: @@ -60,7 +60,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: @@ -68,7 +68,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_abap_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_abap_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: @@ -94,7 +94,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -106,7 +106,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -119,7 +119,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - re-identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index 724bf77ae..bdbdf0033 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -19,7 +19,7 @@ changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -29,7 +29,7 @@ changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -40,7 +40,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export changed_when: "item | length > 0" @@ -52,7 +52,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_java_export_extracted ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapnwas_java_export_extracted ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: @@ -60,7 +60,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: @@ -68,7 +68,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_java_export_extracted/ ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR self-extracting archive')" ]; then eval "{{ sap_install_media_detect_rar_extract }}" "{{ item }}" sapnwas_java_export_extracted/ ; fi with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: @@ -94,7 +94,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -106,7 +106,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-detect RAR files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then echo {{ item }}; fi register: detect_directory_files_rar_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -119,7 +119,7 @@ - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - re-identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; elif [ ! -z "$(file {{ item }} | grep 'RAR')" ]; then if eval "{{ sap_install_media_detect_rar_list }}" {{ item }} | grep -q 'DATA_UNITS/JAVA_EXPORT_JDMP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_java_export_repeated changed_when: "item | length > 0" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index f2b92edde..bb8d2639a 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -19,7 +19,7 @@ changed_when: false - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -30,7 +30,7 @@ - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export changed_when: "item | length > 0" with_items: @@ -40,7 +40,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapsolman_abap_export_extracted/{{ item }} ; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d ./sapsolman_abap_export_extracted/{{ item }} ; fi with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: @@ -66,7 +66,7 @@ - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip_repeated # changed_when: "item.stdout | length > 0" with_items: @@ -79,7 +79,7 @@ - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - re-identify EXPORT files ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'DATA_UNITS/EXP' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_nwas_abap_export_repeated changed_when: "item | length > 0" with_items: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 89e22c257..5aae900f4 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -32,7 +32,7 @@ - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2setup' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2 changed_when: "item | length > 0" with_items: @@ -42,7 +42,7 @@ - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db6_update_client.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_client changed_when: "item | length > 0" with_items: @@ -52,7 +52,7 @@ - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'db2aese_c.lic' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_ibmdb2_license changed_when: "item | length > 0" with_items: @@ -62,7 +62,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" args: @@ -70,7 +70,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" args: @@ -78,7 +78,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" args: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index a75f44c01..39cc58a6f 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -20,7 +20,7 @@ changed_when: false - name: SAP Install Media Detect - Oracle DB - Detect ZIP files (including no file extensions), ignore errors - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then echo {{ item }}; fi register: detect_directory_files_zip with_items: - "{{ detect_directory_files.stdout_lines }}" @@ -31,7 +31,7 @@ - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q '19cinstall.sh' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb changed_when: "item | length > 0" with_items: @@ -41,7 +41,7 @@ - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'OCL_LINUX_X86_64' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_oracledb_client changed_when: "item | length > 0" with_items: @@ -51,7 +51,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" args: @@ -59,7 +59,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" args: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index 5b5a5236c..b0a8aaec4 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -31,7 +31,7 @@ - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'BD_SYBASE_ASE' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapase changed_when: "item | length > 0" with_items: @@ -50,7 +50,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapase_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapase_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" args: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index 83751cc37..d5582769e 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -30,7 +30,7 @@ - name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB installation media ansible.builtin.shell: | - if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi + set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then if zipinfo -1 {{ item }} | grep -q 'MaxDB_7.9' ; then echo '{{ item }}' ; fi ; fi register: detect_directory_files_sapmaxdb changed_when: "item | length > 0" with_items: @@ -40,7 +40,7 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media # noqa no-changed-when - ansible.builtin.shell: if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" args: From b301a5735997ddb29c990354d15165dfd1b31577 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 15 Jun 2023 14:12:24 +0200 Subject: [PATCH 085/128] sap_install_media_detect: explain RAR file handling in README.md --- roles/sap_install_media_detect/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index c166680b8..8076922b8 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -11,6 +11,11 @@ As an example, SAP HANA Client would be detected and the SAP Kernel Part I/II wo Once detection (e.g. using `zipinfo -1` and `unrar lb`) and extraction are completed, the file paths are shown and stored as variables for subsequent use by other Ansible Tasks. +RAR files can be either handled by the unar package from EPEL or by another package which can list the contents of, and extract files from, +RAR files. See the comments and examples for the RAR file handling in `defaults/main.yml`. If the EPEL repo had been enabled at the time +when the role was run, it will remain enabled. If the EPEL repo was not present, the associated GPG key will be removed and the EPEL repo +will be disabled as the last task. + ## Dependencies This role does not depend on any other Ansible Role. @@ -21,4 +26,4 @@ Apache license 2.0 ## Author Information -IBM Lab for SAP Solutions, Red Hat for SAP Community of Practice +IBM Lab for SAP Solutions, Red Hat for SAP Community of Practice, Bernd Finger From dfba9a4971034820cd24a250afb828db6b86da0a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Fri, 16 Jun 2023 16:34:24 +0200 Subject: [PATCH 086/128] sap_install_media_detect: Explain the new tag for RAR file handling in README.md --- roles/sap_install_media_detect/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index 8076922b8..58cfc2679 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -20,6 +20,12 @@ will be disabled as the last task. This role does not depend on any other Ansible Role. +## Tags + +With the following tags, the role can be called to perform certain activities only: +- tag `sap_install_media_detect_rar_handling`: Only perform the tasks for enabling the listing and extracting of files of type `RAR`. This + includes enabling and disabling the EPEL repo for RHEL systems, if desired. + ## License Apache license 2.0 From 89e0fc4f7d2bab67a858ac6f3c937ce1850eb01b Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 07:59:33 +0000 Subject: [PATCH 087/128] sap_ha_pacemaker_cluster: various cloud platform enhancements --- .../defaults/main.yml | 28 +++++++ roles/sap_ha_pacemaker_cluster/tasks/main.yml | 5 +- .../ascertain_platform_type.yml | 81 +++++++++++++++---- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 8 +- ...ct_vars_vip_resources_cloud_msazure_vm.yml | 78 ++++++++++++++++++ .../tasks/platform/include_vars_platform.yml | 50 ++++++++++++ .../preconfigure_cloud_aws_ec2_vs.yml | 15 +--- .../preconfigure_cloud_ibmcloud_powervs.yml | 2 + .../preconfigure_cloud_ibmcloud_vs.yml | 2 + .../preconfigure_cloud_msazure_vm.yml | 2 + ...egister_sysinfo_cloud_ibmcloud_powervs.yml | 9 +++ .../register_sysinfo_cloud_ibmcloud_vs.yml | 12 +-- roles/sap_ha_pacemaker_cluster/vars/main.yml | 1 + .../vars/platform_cloud_aws_ec2_vs.yml | 12 +-- .../vars/platform_cloud_gcp_ce_vm.yml | 56 +++++++++++++ .../vars/platform_cloud_ibmcloud_powervs.yml | 52 ++++++++++++ .../vars/platform_cloud_ibmcloud_vs.yml | 33 +++++++- .../vars/platform_cloud_msazure_vm.yml | 44 ++++++++++ 18 files changed, 435 insertions(+), 55 deletions(-) rename roles/sap_ha_pacemaker_cluster/tasks/{ => platform}/ascertain_platform_type.yml (52%) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_powervs.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_vs.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_msazure_vm.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml diff --git a/roles/sap_ha_pacemaker_cluster/defaults/main.yml b/roles/sap_ha_pacemaker_cluster/defaults/main.yml index fb0d35a67..ac0cb4696 100644 --- a/roles/sap_ha_pacemaker_cluster/defaults/main.yml +++ b/roles/sap_ha_pacemaker_cluster/defaults/main.yml @@ -152,3 +152,31 @@ sap_ha_pacemaker_cluster_cluster_properties: stonith-enabled: true stonith-timeout: 900 concurrent-fencing: true + + +## Infrastructure Platform variables, shown here for visibility only and should not be given default values +## +## AWS platform, EC2 Virtual Servers +# sap_ha_pacemaker_cluster_aws_access_key_id +# sap_ha_pacemaker_cluster_aws_secret_access_key +# sap_ha_pacemaker_cluster_aws_region +## +## Google Cloud platform, Compute Engine Virtual Machines +# sap_ha_pacemaker_cluster_gcp_project +# sap_ha_pacemaker_cluster_gcp_region_zone +## +## IBM Cloud platform, Virtual Servers (x86_64) +# sap_ha_pacemaker_cluster_ibmcloud_api_key +# sap_ha_pacemaker_cluster_ibmcloud_region +## +## IBM Cloud platform, IBM Power Virtual Servers (ppc64le) +# sap_ha_pacemaker_cluster_ibmcloud_api_key +# sap_ha_pacemaker_cluster_ibmcloud_region +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn +# sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid +# sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type +# sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url +## +## MS Azure platform, Virtual Machines +# sap_ha_pacemaker_cluster_msazure_subscription_id +# sap_ha_pacemaker_cluster_msazure_resource_group diff --git a/roles/sap_ha_pacemaker_cluster/tasks/main.yml b/roles/sap_ha_pacemaker_cluster/tasks/main.yml index 59e6bd9b2..6b8361fd1 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/main.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/main.yml @@ -33,7 +33,10 @@ # Determine if we are on a cloud platform. - name: "SAP HA Prepare Pacemaker - Include tasks for platform detection" - ansible.builtin.import_tasks: ascertain_platform_type.yml + ansible.builtin.import_tasks: platform/ascertain_platform_type.yml + +- name: "SAP HA Prepare Pacemaker - Include platform specific variables" + ansible.builtin.import_tasks: platform/include_vars_platform.yml - name: "SAP HA Prepare Pacemaker - Include common variable construction tasks" ansible.builtin.import_tasks: construct_vars_common.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml similarity index 52% rename from roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml rename to roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml index ebf5315c0..4c242c0f7 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml @@ -20,15 +20,15 @@ ### IBM Cloud Virtual Server. Not applicable for IBM Cloud Classic Infrastructure. # ansible_chassis_asset_tag: "ibmcloud" # SMBIOS Chassis Asset Tag # ansible_board_asset_tag: "0c7d4459-xxxx-yyyy-zzzz-abcdefghijkl" # SMBIOS Baseboard Asset Tag, ID of virtual machine on platform -# ansible_chassis_vendor: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name +# ansible_chassis_vendor: "IBM:Cloud Compute Server 1.0:mx2-16x128" # IaaS profile name as suffix (after colon) # ansible_product_name: "Standard PC (i440FX + PIIX, 1996)" # ansible_system_vendor: "QEMU" # ### Microsoft Azure Virtual Machine. Not applicable for MS Azure Classic/ASM. # ansible_chassis_asset_tag: "7783-xxxx-yyyy-zzzz-aaaa-bbbb-cc" # SMBIOS Chassis Asset Tag # ansible_board_asset_tag: "None" # SMBIOS Baseboard Asset Tag -# ansible_chassis_vendor: "Virtual Machine" -# ansible_product_name: "Microsoft Corporation" +# ansible_chassis_vendor: "Microsoft Corporation" +# ansible_product_name: "Virtual Machine" # ansible_system_vendor: "70f4a858-1eea-4c35-b9e1-e179c32fc6b5" # ID of virtual machine on platform # ### VMware vSphere @@ -50,11 +50,11 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_platform: cloud_aws_ec2_vs -#- name: "SAP HA Prepare Pacemaker - Check if platform is Google Cloud Compute Engine Virtual Machine" -# when: -# - ansible_product_name == 'Google Compute Engine' -# ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: cloud_gcp_ce_vm +- name: "SAP HA Prepare Pacemaker - Check if platform is Google Cloud Compute Engine Virtual Machine" + when: + - ansible_product_name == 'Google Compute Engine' + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_platform: cloud_gcp_ce_vm - name: "SAP HA Prepare Pacemaker - Check if platform is IBM Cloud Virtual Server" when: @@ -62,12 +62,47 @@ ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_vs -#- name: "SAP HA Prepare Pacemaker - Check if platform is Microsoft Azure Virtual Machine" +- name: "SAP HA Prepare Pacemaker - Check if platform is Microsoft Azure Virtual Machine" + when: + - ansible_product_name == 'Virtual Machine' + - ansible_chassis_vendor == 'Microsoft Corporation' + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_platform: cloud_msazure_vm + +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" + ansible.builtin.shell: | + set -o pipefail && rpm -qa | grep -E -e "rsct.basic" + register: __sap_ha_pacemaker_cluster_power_rsct_check + when: ansible_architecture == "ppc64le" + +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" + ansible.builtin.fail: + msg: Please install RSCT from IBM Power Systems service and productivity tools repository + when: + - ansible_architecture == "ppc64le" + - __sap_ha_pacemaker_cluster_power_rsct_check.stdout == "" + +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power - RSCT binary check" + ansible.builtin.shell: | + /opt/rsct/bin/ctgethscid + register: __sap_ha_pacemaker_cluster_power_rsct_hscid + when: + - ansible_architecture == "ppc64le" + - __sap_ha_pacemaker_cluster_power_rsct_check.stdout != "" + +- name: "SAP HA Prepare Pacemaker - Check if platform is IBM Power Virtual Server from IBM Cloud" + when: + - ansible_architecture == "ppc64le" + - '"ibmcloud" in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_platform: cloud_ibmcloud_powervs + +#- name: "SAP HA Prepare Pacemaker - Check if platform is IBM PowerVC" # when: -# - ansible_chassis_vendor == 'Virtual Machine' -# - ansible_product_name == 'Microsoft Corporation' +# - ansible_architecture == "ppc64le" +# - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' # ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: cloud_msazure_vm +# __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_lpar #- name: "SAP HA Prepare Pacemaker - Check if platform is VMware vSphere" # when: @@ -83,9 +118,25 @@ ansible.builtin.include_tasks: file: "{{ item }}" loop: - - "platform/register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml" + - "register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml" vars: __sap_ha_pacemaker_cluster_platform_info: "{{ role_path }}/tasks/{{ item }}" -- name: "SAP HA Prepare Pacemaker - Include platform specific variables" - ansible.builtin.import_tasks: platform/include_vars_platform.yml +- name: "SAP HA Prepare Pacemaker - Include platform specific tasks - MS Azure VM - Ensure socat binary installed" + ansible.builtin.package: + name: + - socat + state: present + when: __sap_ha_pacemaker_cluster_platform == "cloud_msazure_vm" + +# Call tasks to discover information that is needed as input for any further steps. +# Run this before including the platform vars in order to build vars based on the +# discovered data. +- name: "SAP HA Prepare Pacemaker - Include platform specific information collection" + when: __sap_ha_pacemaker_cluster_platform_info is file + ansible.builtin.include_tasks: + file: "{{ item }}" + loop: + - "register_sysinfo_{{ __sap_ha_pacemaker_cluster_platform }}.yml" + vars: + __sap_ha_pacemaker_cluster_platform_info: "{{ role_path }}/tasks/{{ item }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 7fd309b71..290f726eb 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -1,7 +1,7 @@ --- # Reminder: This file is included in a loop over a dictionary. -- name: "SAP HA Prepare Pacemaker - Add resource: OS floating IP (dev/test only)" +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS floating IP (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" @@ -19,7 +19,7 @@ (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) -- name: "SAP HA Prepare Pacemaker - Add resource: AWS floating IP (dev/test only)" +- name: "SAP HA Prepare Pacemaker - awsvip resource agent - Add resource: AWS floating IP (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" vars: @@ -34,7 +34,7 @@ - ('pri' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method == 'awsvip' -- name: "SAP HA Prepare Pacemaker - Add resource group for VIP resources" +- name: "SAP HA Prepare Pacemaker - awsvip resource agent - Add resource group for VIP resources" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_groups: "{{ __sap_ha_pacemaker_cluster_resource_groups + [__vip_group] }}" __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_group_name }}_{{ vip_list_item.key }}" @@ -48,7 +48,7 @@ - __vip_group.id is not in (__sap_ha_pacemaker_cluster_resource_groups | map(attribute='id')) - sap_ha_pacemaker_cluster_vip_method in ['awsvip'] -- name: "SAP HA Prepare Pacemaker - Add resource: AWS VIP routing" +- name: "SAP HA Prepare Pacemaker - aws_vpc_move_ip resource agent - Add resource: AWS VIP routing" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml new file mode 100644 index 000000000..e61061d9e --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -0,0 +1,78 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS floating IP (dev/test only)" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __resource_vip: + id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" + instance_attrs: + - attrs: + - name: ip + value: "{{ vip_list_item.value }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or + (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and + 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) + +- name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Verify socat binary path" + ansible.builtin.shell: | + which socat + register: __sap_ha_pacemaker_cluster_register_socat_path + changed_when: false + + +- name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Define load balancer port for health check when SAP HANA scale-up HA" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_lb_port: "626{{ sap_ha_pacemaker_cluster_hana_instance_number }}" + when: "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list + +- name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Add resource: Azure Load Balancer (NLB L-4) for VIP routing when SAP HANA scale-up HA" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __health_check: + id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" + instance_attrs: + - attrs: + - name: port + value: "{{ __sap_ha_pacemaker_cluster_resource_lb_port | default(0) }}" # Add default to ensure skip without errors + - name: nc + value: "{{ __sap_ha_pacemaker_cluster_register_socat_path.stdout }}" + when: + - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method == 'azure_lb' + - "'hana_scaleup' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list + + +- name: "SAP HA Prepare Pacemaker - azure_lb resource agent - Add resource: Azure Load Balancer (NLB L-4) for VIP routing when SAP NetWeaver HA - ASCS and ERS" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __health_check: + id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" + instance_attrs: + - attrs: + - name: port + value: "{{ lb_port_for_hc | default(0) }}" # Add default to ensure skip without errors + - name: nc + value: "{{ __sap_ha_pacemaker_cluster_register_socat_path.stdout }}" + loop: ["626{{ sap_ha_pacemaker_cluster_netweaver_abap_ascs_instance_number }}", "626{{ sap_ha_pacemaker_cluster_netweaver_abap_ers_instance_number }}"] + loop_control: + loop_var: lb_port_for_hc + index_var: lb_port_for_hc_index + label: "{{ lb_port_for_hc }}" + when: + - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method == 'azure_lb' + - "'nwas_abap_ascs_ers' in sap_ha_pacemaker_cluster_host_type[0]" # REPLACE with substring in any of the strings contained in the list diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml index 67ae184c0..c7bf0176c 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/include_vars_platform.yml @@ -1,4 +1,5 @@ --- + # Include vars files based on the environment. - name: "SAP HA Prepare Pacemaker - Include platform specific variables" when: __sap_ha_pacemaker_cluster_vars_file is file @@ -7,3 +8,52 @@ - "platform_{{ __sap_ha_pacemaker_cluster_platform }}.yml" vars: __sap_ha_pacemaker_cluster_vars_file: "{{ role_path }}/vars/{{ item }}" + + +# pcmk_host_map format: :;:... +- name: "SAP HA Prepare Pacemaker - AWS EC2 VS - Assemble host mapping" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_pcmk_host_map: > + {% for node in ansible_play_hosts_all -%} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_board_asset_tag }} + {%- if not loop.last %};{% endif -%} + {%- endfor %} + when: __sap_ha_pacemaker_cluster_platform == "cloud_aws_ec2_vs" + + +- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Set variable for fencing agent" + ansible.builtin.set_fact: + sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid: "{{ __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host }}" + when: __sap_ha_pacemaker_cluster_platform == "" + +# pcmk_host_map format: :;:... +- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Assemble host mapping" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_pcmk_host_map: >- + {% for node in ansible_play_hosts_all -%} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }} + {%- if not loop.last %};{%- endif -%} + {%- endfor %} + when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_powervs" + + +# pcmk_host_map format: :;:... +- name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Assemble host mapping" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_pcmk_host_map: >- + {% for node in ansible_play_hosts_all -%} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_vs_host.stdout }} + {%- if not loop.last %};{%- endif -%} + {%- endfor %} + when: __sap_ha_pacemaker_cluster_platform == "cloud_ibmcloud_vs" + + +# pcmk_host_map format: :;:... +- name: "SAP HA Prepare Pacemaker - MS Azure VM - Assemble host mapping" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_pcmk_host_map: >- + {% for node in ansible_play_hosts_all -%} + {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_hostname }} + {%- if not loop.last %};{%- endif -%} + {%- endfor %} + when: __sap_ha_pacemaker_cluster_platform == "cloud_msazure_vm" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_aws_ec2_vs.yml index b404d76e9..98a2efa23 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_aws_ec2_vs.yml @@ -1,14 +1,14 @@ --- # Requirement to enable the fencing resource to function. -- name: "SAP HA Prepare Pacemaker - Create awscli config directory" +- name: "SAP HA Prepare Pacemaker - AWS EC2 VS - Create awscli config directory" ansible.builtin.file: mode: 0755 owner: root path: /root/.aws state: directory -- name: "SAP HA Prepare Pacemaker - Create awscli config" +- name: "SAP HA Prepare Pacemaker - AWS EC2 VS - Create awscli config" ansible.builtin.blockinfile: backup: true block: | @@ -19,7 +19,7 @@ owner: root path: /root/.aws/config -- name: "SAP HA Prepare Pacemaker - Store awscli credentials" +- name: "SAP HA Prepare Pacemaker - AWS EC2 VS - Store awscli credentials" ansible.builtin.blockinfile: backup: true block: | @@ -31,12 +31,3 @@ owner: root path: /root/.aws/credentials no_log: true - -# pcmk_host_map format: :;:... -- name: "SAP HA Prepare Pacemaker - Assemble host mapping" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: > - {% for node in ansible_play_hosts_all -%} - {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].ansible_board_asset_tag }} - {%- if not loop.last %};{% endif -%} - {%- endfor %} diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_powervs.yml new file mode 100644 index 000000000..33c4f2d5a --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_powervs.yml @@ -0,0 +1,2 @@ +--- +# Requirement to enable the fencing resource to function. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_vs.yml new file mode 100644 index 000000000..33c4f2d5a --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_ibmcloud_vs.yml @@ -0,0 +1,2 @@ +--- +# Requirement to enable the fencing resource to function. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_msazure_vm.yml new file mode 100644 index 000000000..33c4f2d5a --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_msazure_vm.yml @@ -0,0 +1,2 @@ +--- +# Requirement to enable the fencing resource to function. diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml new file mode 100644 index 000000000..c31078c72 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_powervs.yml @@ -0,0 +1,9 @@ +--- +# Ansible facts rely on SMBIOS/DMI, which does not exist on ppc64le CPU Architecture. +# Identify from RSCT binary instead. +- name: "SAP HA Prepare Pacemaker - IBM Power VS from IBM Cloud - Register instance ID" + ansible.builtin.shell: | + /opt/rsct/bin/ctgethscid -value PartitionUUID + register: __sap_ha_pacemaker_cluster_register_ibmcloud_powervs_host + changed_when: false + check_mode: false diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_vs.yml index d09114f55..298804b72 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/register_sysinfo_cloud_ibmcloud_vs.yml @@ -1,17 +1,9 @@ --- # There is no ansible fact with the fully qualified VM instance ID. # We get this information from the SMBIOS/DMI. -- name: "SAP HA Prepare Pacemaker - Register instance ID" +- name: "SAP HA Prepare Pacemaker - IBM Cloud VS - Register instance ID" ansible.builtin.shell: | dmidecode -s system-family - register: __sap_ha_pacemaker_cluster_register_ibmcloud_instance + register: __sap_ha_pacemaker_cluster_register_ibmcloud_vs_host changed_when: false check_mode: false - -- name: "SAP HA Prepare Pacemaker - Assemble host mapping" - ansible.builtin.set_fact: - __sap_ha_pacemaker_cluster_pcmk_host_map: >- - {% for node in ansible_play_hosts_all -%} - {{ hostvars[node].ansible_hostname }}:{{ hostvars[node].__sap_ha_pacemaker_cluster_register_ibmcloud_instance.stdout }} - {%- if not loop.last %};{%- endif -%} - {%- endfor %} diff --git a/roles/sap_ha_pacemaker_cluster/vars/main.yml b/roles/sap_ha_pacemaker_cluster/vars/main.yml index 0b90249ba..c96a08fbf 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/main.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/main.yml @@ -62,6 +62,7 @@ __sap_ha_pacemaker_cluster_nwas_pas_synonyms: __sap_ha_pacemaker_cluster_platform: '' __sap_ha_pacemaker_cluster_supported_platforms: - cloud_aws_ec2_vs + - cloud_msazure_vm # ATTENTION: # Any variables for 'ha_cluster' which this SAP role supports/inherits should also diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index 4165d3eb1..fb531772f 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -1,5 +1,5 @@ --- -# Variables specific on AWS platform +# Variables specific on AWS platform, EC2 Virtual Servers # # TODO: make sure to first respect 'ha_cluster' native variables @@ -16,14 +16,6 @@ __sap_ha_pacemaker_cluster_repos: # Predefine __sap_ha_pacemaker_cluster_aws_instances: [] -## Requires: -# TODO: decide where to define these vars -# sap_ha_pacemaker_cluster_aws_access_key_id: -# sap_ha_pacemaker_cluster_aws_secret_access_key: -# sap_ha_pacemaker_cluster_aws_region: -# sap_ha_pacemaker_cluster_aws_vpc: - - sap_ha_pacemaker_cluster_stonith_default: agent: "stonith:fence_aws" options: @@ -38,7 +30,7 @@ sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup __sap_ha_pacemaker_cluster_available_vip_agents: # Testing only! Not officially supported for SAP on AWS. ipaddr: - agent: "ocf:heartbeat:IPAddr2" + agent: "ocf:heartbeat:IPaddr2" # Testing only! Not officially supported for SAP on AWS. Updates VM Instance network interface (ENI) with Secondary Private IP. awsvip: diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml new file mode 100644 index 000000000..22901d7bd --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -0,0 +1,56 @@ +--- +# Variables specific on Google Cloud platform, Compute Engine Virtual Machines +# +# TODO: make sure to first respect 'ha_cluster' native variables + +sap_ha_pacemaker_cluster_fence_agent_packages: + - fence-agents-gce + +sap_ha_pacemaker_cluster_platform_extra_packages: + - resource-agents-gcp + +__sap_ha_pacemaker_cluster_repos: + - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rhui-rpms" + name: High Availability + +# Predefine +__sap_ha_pacemaker_cluster_gcp_hosts: [] + +sap_ha_pacemaker_cluster_stonith_default: + agent: "stonith:fence_gce" + options: + project: "{{ sap_ha_pacemaker_cluster_gcp_project }}" + zone: "{{ sap_ha_pacemaker_cluster_gcp_region_zone }}" +# port: "{{ hostvars[node].ansible_hostname }}" + +# Platform specific VIP handling +sap_ha_pacemaker_cluster_vip_method: gcp_nlb_reserved_ip_haproxy # gcp_vpc_move_ip +sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup + +__sap_ha_pacemaker_cluster_available_vip_agents: + + ipaddr: + agent: "ocf:heartbeat:IPaddr2" + + # Recommended method is to use an internal passthrough Network Load Balancer (NLB for TCP/UDP) and Reserved Static Internal IP Address, with host health check response using socat or HAProxy + # Alternative method is to use static route Virtual IP (outside VPC Subnet ranges) using VPC Routing Table + # Refer to Google Cloud Compute Engine Reserved Static Internal IP Address, https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address + # Refer to Google Cloud Load Balancing - Internal passthrough Network Load Balancer overview, https://cloud.google.com/load-balancing/docs/internal + # Refer to SAP HANA guidance 1, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address + # Refer to SAP HANA guidance 2, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#vip_implementation + # Refer to SAP NetWeaver guidance, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address + + # Recommended method + gcp_nlb_reserved_ip_haproxy: + agent: "ocf:heartbeat:haproxy" + with: ipaddr + + # Alternative method + # Move Virtual/Floating IP, must be outside of the VPC Subnet Range, by replacing + # (temporary route, delete, create, delete temp.) + # the VPC Routing Table record with next-hop as the VM Instance's ID. + # Execution via Python urllib to GCP Compute Engine API and GCP Metadata Server API + # heartbeat:gcp-vpc-move-route is the replacement of heartbeat:gcp-vpc-move-ip (which uses execution via GCloud CLI, and is itself a fork of external/gcp:route) + gcp_vpc_move_ip: + agent: "ocf:heartbeat:gcp-vpc-move-vip" + with: haproxy diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml new file mode 100644 index 000000000..54b09937c --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -0,0 +1,52 @@ +--- +# Variables specific on IBM Cloud platform, IBM Power Virtual Servers (ppc64le) +# +# TODO: make sure to first respect 'ha_cluster' native variables + +sap_ha_pacemaker_cluster_fence_agent_packages: + - fence-agents-ibm-powervs + +#sap_ha_pacemaker_cluster_platform_extra_packages: +# - + +__sap_ha_pacemaker_cluster_repos: + - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rpms" + name: High Availability E4S (4-Year) for Power, little endian +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-eus-rpms" +# name: High Availability EUS (2-Year) for Power, little endian +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-rpms" +# name: High Availability for Power, little endian + +# Predefine +__sap_ha_pacemaker_cluster_ibmcloud_powervs_hosts: [] + + +sap_ha_pacemaker_cluster_stonith_default: + agent: "stonith:fence_ibm_powervs" + options: + token: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" + region: "{{ sap_ha_pacemaker_cluster_ibmcloud_region }}" + crn: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_crn }}" + instance: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_workspace_guid }}" + plug: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_host_guid }}" # Identified during execution initial tasks, populated when variables are imported + api-type: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_api_type | default('private') }}" + proxy: "{{ sap_ha_pacemaker_cluster_ibmcloud_powervs_forward_proxy_url }}" + +sap_ha_pacemaker_cluster_fence_options: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 600 + pcmk_monitor_timeout: 600 + pcmk_status_timeout: 60 + power_timeout: 240 + + +# Platform specific VIP handling +sap_ha_pacemaker_cluster_vip_method: ipaddr +sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup + +__sap_ha_pacemaker_cluster_available_vip_agents: + + # IPaddr2 requires a Virtual IP within a common Network (i.e. 1 VLAN / 1 VPC / 1 VNet), one or more Subnets may be used + # With this design restriction, IPaddr2 is only to be used for High Availability within a single location (i.e. 1 Availability Zone / Datacenter / Location within 1 Region) + ipaddr: + agent: "ocf:heartbeat:IPaddr2" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml index 6cadf3cfd..f7e7c62da 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml @@ -1,17 +1,44 @@ --- -# Variables specific on IBM Cloud platform +# Variables specific on IBM Cloud platform, Virtual Servers (x86_64) # # TODO: make sure to first respect 'ha_cluster' native variables sap_ha_pacemaker_cluster_fence_agent_packages: - fence-agents-ibm-vpc -# __sap_ha_pacemaker_cluster_repos: -# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rpms" +#sap_ha_pacemaker_cluster_platform_extra_packages: +# - + +__sap_ha_pacemaker_cluster_repos: + - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rpms" + name: High Availability E4S (4-Year) +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-eus-rpms" +# name: High Availability EUS (2-Year) +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-rpms" # name: High Availability +# Predefine +__sap_ha_pacemaker_cluster_ibmcloud_hosts: [] + sap_ha_pacemaker_cluster_stonith_default: agent: "stonith:fence_ibm_vpc" options: apikey: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" region: "{{ sap_ha_pacemaker_cluster_ibmcloud_region }}" + +# Platform specific VIP handling +sap_ha_pacemaker_cluster_vip_method: haproxy_with_ipaddr +sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup + +__sap_ha_pacemaker_cluster_available_vip_agents: + + # IPaddr2 requires a Virtual IP within a common Network (i.e. 1 VLAN / 1 VPC / 1 VNet), one or more Subnets may be used + # With this design restriction, IPaddr2 is only to be used for High Availability within a single location (i.e. 1 Availability Zone / Datacenter / Location within 1 Region) + ipaddr: + agent: "ocf:heartbeat:IPaddr2" + + # Use haproxy daemon to listen for and respond to health check probe monitoring private network requests from IBM Cloud Application Load Balancer (ALB), + # if failure to respond then the Load Balancer will perform failover activities + haproxy_with_ipaddr: + agent: "ocf:heartbeat:haproxy" + with: ipaddr diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml new file mode 100644 index 000000000..dab111f39 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml @@ -0,0 +1,44 @@ +--- +# Variables specific on MS Azure platform, Virtual Machines +# +# TODO: make sure to first respect 'ha_cluster' native variables + +sap_ha_pacemaker_cluster_fence_agent_packages: + - fence-agents-azure-arm + +sap_ha_pacemaker_cluster_platform_extra_packages: + - socat + +__sap_ha_pacemaker_cluster_repos: + - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rhui-rpms" + name: High Availability + - id: "rhui-microsoft-azure-rhel8-sap-ha" + name: Microsoft Azure RPMs for Red Hat Enterprise Linux 8 (rhel8-sap-ha) + +# Predefine +__sap_ha_pacemaker_cluster_msazure_hosts: [] + +# Fencing via MS Azure Managed Service Identity (MSI) per cluster node +sap_ha_pacemaker_cluster_stonith_default: + agent: "stonith:fence_azure_arm" + options: + msi: true + subscriptionId: "{{ sap_ha_pacemaker_cluster_msazure_subscription_id }}" + resourceGroup: "{{ sap_ha_pacemaker_cluster_msazure_resource_group }}" + +# Platform specific VIP handling +sap_ha_pacemaker_cluster_vip_method: azure_lb +sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup + +__sap_ha_pacemaker_cluster_available_vip_agents: + + # IPaddr2 requires a Virtual IP within a common Network (i.e. 1 VLAN / 1 VPC / 1 VNet), one or more Subnets may be used + # With this design restriction, IPaddr2 is only to be used for High Availability within a single location (i.e. 1 Availability Zone / Datacenter / Location within 1 Region) + ipaddr: + agent: "ocf:heartbeat:IPaddr2" + + # Use nc/socat to listen for and respond to health check probe monitoring requests from Azure Load Balancer, + # if failure to respond then the Load Balancer will perform failover activities + azure_lb: + agent: "ocf:heartbeat:azure-lb" + with: ipaddr From 4b478d416fe50e59ca7a0eb44cfe13c7d6254a39 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 08:05:17 +0000 Subject: [PATCH 088/128] sap_ha_pacemaker_cluster: adjusted hook path to match RHEL documentation --- roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml | 2 +- roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml index 4a049a6e9..4e356cae9 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleout_common.yml @@ -8,4 +8,4 @@ sap_ha_pacemaker_cluster_sap_extra_packages: sap_ha_pacemaker_cluster_ra_hana: SAPHanaController sap_ha_pacemaker_cluster_hadr_provider_name: SAPHanaSR -sap_ha_pacemaker_cluster_hadr_provider_path: /hana/shared/myhooks +sap_ha_pacemaker_cluster_hadr_provider_path: /hana/shared/myHooks diff --git a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml index de1d90519..5c76b2497 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/hana_scaleup_common.yml @@ -8,4 +8,4 @@ sap_ha_pacemaker_cluster_sap_extra_packages: sap_ha_pacemaker_cluster_ra_hana: SAPHana sap_ha_pacemaker_cluster_hadr_provider_name: SAPHanaSR -sap_ha_pacemaker_cluster_hadr_provider_path: /hana/shared/myhooks +sap_ha_pacemaker_cluster_hadr_provider_path: /hana/shared/myHooks From 224be0454152fe6b7fe740f53352cbb894c20421 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 08:21:31 +0000 Subject: [PATCH 089/128] sap_ha_pacemaker_cluster: adjust SAPHana monitor intervals to RHEL documentation --- .../tasks/construct_vars_hana_common.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml index feb558a7a..06def49c8 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_hana_common.yml @@ -71,7 +71,7 @@ - action: monitor attrs: - name: interval - value: 121 + value: 61 - name: role value: Slave - name: timeout @@ -79,7 +79,7 @@ - action: monitor attrs: - name: interval - value: 119 + value: 59 - name: role value: Master - name: timeout From c54d8f4ed163f70bf0b28a70d9bec81ac2847ed4 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 08:53:46 +0000 Subject: [PATCH 090/128] workflow: lock ansible-core to 2.14.5 for compatibility --- .github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml index 1c718e9df..453bba75c 100644 --- a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml +++ b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml @@ -35,6 +35,7 @@ jobs: run: | pip3 install ansible ansible-lint==6.8.6 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_ha_pacemaker_cluster From 1afce99c65b82ff804802599fe7eeea1b9b32225 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 09:02:42 +0000 Subject: [PATCH 091/128] workflow: lock ansible version to 7.5.0 for ansible* package compatibility --- .github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml index 453bba75c..b1f0bc420 100644 --- a/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml +++ b/.github/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml @@ -33,9 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_ha_pacemaker_cluster From 6ce389234ee7b8b59d85ac395eb8b249bfbe28c4 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 09:25:36 +0000 Subject: [PATCH 092/128] workflows: version locking of ansible packages for compatibility --- .github/workflows/ansible-lint-sap_general_preconfigure.yml | 4 +++- .github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml | 4 +++- .github/workflows/ansible-lint-sap_hana_install.yml | 4 +++- .github/workflows/ansible-lint-sap_hana_preconfigure.yml | 4 +++- .../ansible-lint-sap_hypervisor_node_preconfigure.yml | 4 +++- .github/workflows/ansible-lint-sap_netweaver_preconfigure.yml | 4 +++- .github/workflows/ansible-lint-sap_storage_setup.yml | 4 +++- .github/workflows/ansible-lint-sap_swpm.yml | 4 +++- .github/workflows/ansible-lint-sap_vm_preconfigure.yml | 4 +++- .github/workflows/ansible-lint.yml | 4 +++- 10 files changed, 30 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ansible-lint-sap_general_preconfigure.yml b/.github/workflows/ansible-lint-sap_general_preconfigure.yml index b41cc3002..6355423d1 100644 --- a/.github/workflows/ansible-lint-sap_general_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_general_preconfigure.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_general_preconfigure diff --git a/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml b/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml index ba05ecd25..d6e20713f 100644 --- a/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml +++ b/.github/workflows/ansible-lint-sap_ha_install_hana_hsr.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_ha_install_hana_hsr diff --git a/.github/workflows/ansible-lint-sap_hana_install.yml b/.github/workflows/ansible-lint-sap_hana_install.yml index 9f6cde49b..2196b8c5e 100644 --- a/.github/workflows/ansible-lint-sap_hana_install.yml +++ b/.github/workflows/ansible-lint-sap_hana_install.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hana_install diff --git a/.github/workflows/ansible-lint-sap_hana_preconfigure.yml b/.github/workflows/ansible-lint-sap_hana_preconfigure.yml index a2967b9d0..3fcba086f 100644 --- a/.github/workflows/ansible-lint-sap_hana_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_hana_preconfigure.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hana_preconfigure diff --git a/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml b/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml index 26e78abcf..9ed7999e8 100644 --- a/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_hypervisor_node_preconfigure.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_hypervisor_node_preconfigure diff --git a/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml b/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml index 2be0a2e8d..387a2a690 100644 --- a/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_netweaver_preconfigure.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_netweaver_preconfigure diff --git a/.github/workflows/ansible-lint-sap_storage_setup.yml b/.github/workflows/ansible-lint-sap_storage_setup.yml index b2d15645c..fa5d7ac92 100644 --- a/.github/workflows/ansible-lint-sap_storage_setup.yml +++ b/.github/workflows/ansible-lint-sap_storage_setup.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_storage_setup diff --git a/.github/workflows/ansible-lint-sap_swpm.yml b/.github/workflows/ansible-lint-sap_swpm.yml index 067e19488..2d1587cbe 100644 --- a/.github/workflows/ansible-lint-sap_swpm.yml +++ b/.github/workflows/ansible-lint-sap_swpm.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_swpm diff --git a/.github/workflows/ansible-lint-sap_vm_preconfigure.yml b/.github/workflows/ansible-lint-sap_vm_preconfigure.yml index 7dc1df564..4b6b38747 100644 --- a/.github/workflows/ansible-lint-sap_vm_preconfigure.yml +++ b/.github/workflows/ansible-lint-sap_vm_preconfigure.yml @@ -33,8 +33,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 - name: Run ansible-lint working-directory: /home/runner/work/community.sap_install/community.sap_install/roles/sap_vm_preconfigure diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml index 536ed65ec..48249fc4c 100644 --- a/.github/workflows/ansible-lint.yml +++ b/.github/workflows/ansible-lint.yml @@ -25,8 +25,10 @@ jobs: - name: Install test dependencies run: | - pip3 install ansible ansible-lint==6.8.6 + pip3 install ansible==7.5.0 pip3 install ansible-compat==3.0.2 + pip3 install ansible-core==2.14.5 + pip3 install ansible-lint==6.8.6 # - name: Install collection dependencies # run: ansible-galaxy collection install community.general From 1edc8bad5cbda7e5a46e7bf798fa40093b3f5298 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 21 Jun 2023 10:26:41 +0000 Subject: [PATCH 093/128] sap_ha_pacemaker_cluster: GCP ip resource name fixes --- .../vars/platform_cloud_gcp_ce_vm.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index 22901d7bd..af182b504 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -24,7 +24,7 @@ sap_ha_pacemaker_cluster_stonith_default: # port: "{{ hostvars[node].ansible_hostname }}" # Platform specific VIP handling -sap_ha_pacemaker_cluster_vip_method: gcp_nlb_reserved_ip_haproxy # gcp_vpc_move_ip +sap_ha_pacemaker_cluster_vip_method: gcp_nlb_reserved_ip_haproxy # gcp_vpc_move_route sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup __sap_ha_pacemaker_cluster_available_vip_agents: @@ -51,6 +51,6 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # the VPC Routing Table record with next-hop as the VM Instance's ID. # Execution via Python urllib to GCP Compute Engine API and GCP Metadata Server API # heartbeat:gcp-vpc-move-route is the replacement of heartbeat:gcp-vpc-move-ip (which uses execution via GCloud CLI, and is itself a fork of external/gcp:route) - gcp_vpc_move_ip: - agent: "ocf:heartbeat:gcp-vpc-move-vip" + gcp_vpc_move_route: + agent: "ocf:heartbeat:gcp-vpc-move-route" with: haproxy From 78167d5f75d0970c3026d10d6ae196a885d90842 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 22 Jun 2023 15:47:47 +0200 Subject: [PATCH 094/128] sap_install_media_detect: Perform all SAP archive file preparation steps --- .../defaults/main.yml | 13 ++++- .../tasks/detect_export_sapecc.yml | 12 ++--- .../tasks/detect_export_sapecc_ides.yml | 12 ++--- .../tasks/detect_export_sapnwas_abap.yml | 12 ++--- .../tasks/detect_export_sapnwas_java.yml | 12 ++--- roles/sap_install_media_detect/tasks/main.yml | 35 ++++++++---- .../tasks/prepare/check_directories.yml | 44 +++++++++++++++ .../tasks/prepare/create_file_list.yml | 53 +++++++++++++++++++ .../tasks/rename/add_rar_extension.yml | 12 +++++ .../rename/add_rar_extension_loop_block.yml | 15 ++++++ 10 files changed, 185 insertions(+), 35 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/prepare/check_directories.yml create mode 100644 roles/sap_install_media_detect/tasks/prepare/create_file_list.yml create mode 100644 roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml create mode 100644 roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index e0199068b..83bcd56b5 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -11,10 +11,19 @@ sap_install_media_detect_rar_extract: '/usr/bin/unar' #sap_install_media_detect_rar_extract: '/usr/bin/unrar x' # e.g. /software -sap_install_media_detect_directory: +# If this role is running on a file server on which the SAP software is not to be installed, set the following to true. +# If this role is running on a system on which the SAP software is to be installed, set the following to false. +sap_install_media_detect_file_server_only: true + +# Directory where the SAP software is located +sap_install_media_detect_source_directory: /software + +# Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory +#sap_install_media_detect_target_directory: /software_local +sap_install_media_detect_target_directory: /software_local # local_dir, remote_dir (e.g. NFS, s3fuse) -sap_install_media_detect_source: local_dir +#sap_install_media_detect_source: local_dir # saphana, sapase, sapmaxdb, oracledb, ibmdb2 sap_install_media_detect_db: "saphana" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 63105f676..39e44ed91 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -59,12 +59,12 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_directory }}" +#- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when +# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi +# with_items: +# - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" +# args: +# chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 434496df9..746eedf93 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -59,12 +59,12 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: - - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_directory }}" +#- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when +# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi +# with_items: +# - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" +# args: +# chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index a6e5bab79..76c2a340b 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -59,12 +59,12 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: - - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_directory }}" +#- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when +# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi +# with_items: +# - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" +# args: +# chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index bdbdf0033..6a93ca4ea 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -59,12 +59,12 @@ chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence -- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi - with_items: - - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" - args: - chdir: "{{ sap_install_media_detect_directory }}" +#- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when +# ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'RAR archive data')" ]; then filename="{{ item }}" && if [ "${filename##*.}" != "rar" ]; then mv {{ item }} {{ item }}.rar ; fi ; fi +# with_items: +# - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" +# args: +# chdir: "{{ sap_install_media_detect_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 6955cdf20..6ded0dde0 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -1,12 +1,33 @@ --- -- name: SAP Install Media Detect - Prepare - enable rar handling +- name: SAP Install Media Detect - Prepare - Enable rar handling ansible.builtin.include_tasks: file: prepare/enable_rar_handling.yml apply: tags: sap_install_media_detect_rar_handling tags: sap_install_media_detect_rar_handling +- name: SAP Install Media Detect - Prepare - Check directories + ansible.builtin.include_tasks: + file: prepare/check_directories.yml + apply: + tags: sap_install_media_detect_check_directories + tags: sap_install_media_detect_check_directories + +- name: SAP Install Media Detect - Create a list of all files + ansible.builtin.include_tasks: + file: prepare/create_file_list.yml + apply: + tags: sap_install_media_detect_create_file_list + tags: sap_install_media_detect_create_file_list + +- name: SAP Install Media Detect - Detect and if necessary rename rar files without extension + ansible.builtin.include_tasks: + file: rename/add_rar_extension.yml + apply: + tags: sap_install_media_detect_add_rar_extension + tags: sap_install_media_detect_add_rar_extension + - name: SAP Install Media Detect - Organize SAPCAR ansible.builtin.include_tasks: detect_sapcar.yml @@ -70,13 +91,11 @@ - name: SAP Install Media Detect - EXPORT files for SAP ECC ansible.builtin.include_tasks: detect_export_sapecc.yml - when: - - sap_install_media_detect_export == "sapecc" + when: sap_install_media_detect_export == "sapecc" - name: SAP Install Media Detect - EXPORT files for SAP ECC IDES ansible.builtin.include_tasks: detect_export_sapecc_ides.yml - when: - - sap_install_media_detect_export == "sapecc_ides" + when: sap_install_media_detect_export == "sapecc_ides" - name: SAP Install Media Detect - EXPORT files for SAP S/4HANA ansible.builtin.include_tasks: detect_export_saps4hana.yml @@ -90,13 +109,11 @@ - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (ABAP) platform only ansible.builtin.include_tasks: detect_export_sapnwas_abap.yml - when: - - sap_install_media_detect_export == "sapnwas_abap" + when: sap_install_media_detect_export == "sapnwas_abap" - name: SAP Install Media Detect - EXPORT files for SAP NetWeaver AS (JAVA) platform only ansible.builtin.include_tasks: detect_export_sapnwas_java.yml - when: - - sap_install_media_detect_export == "sapnwas_java" + when: sap_install_media_detect_export == "sapnwas_java" - name: SAP Install Media Detect - EXPORT files for SAP Solution Manager (ABAP) ansible.builtin.include_tasks: detect_export_sapsolman_abap.yml diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml new file mode 100644 index 000000000..aacdb61d6 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -0,0 +1,44 @@ +--- + +- name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_target_directory' + when: + - sap_install_media_detect_target_directory is defined + - sap_install_media_detect_target_directory | string != "None" + - sap_install_media_detect_target_directory | string | length > 0 + block: + + - name: SAP Install Media Detect - Prepare - Get info of 'sap_install_media_detect_target_directory' + ansible.builtin.stat: + path: "{{ sap_install_media_detect_target_directory }}" + register: __sap_install_media_detect_target_directory_stat + + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_target_directory' is writable + ansible.builtin.assert: + that: __sap_install_media_detect_target_directory_stat.stat.writeable + fail_msg: "FAIL: Directory {{ sap_install_media_detect_target_directory }} is not writable!" + success_msg: "PASS: Directory {{ sap_install_media_detect_target_directory }} is writable." + + - name: SAP Install Media Detect - Prepare - Set the variable sap_install_media_detect_source in case of writable remote file system + ansible.builtin.set_fact: + sap_install_media_detect_source: 'remote_dir' + +- name: SAP Install Media Detect - Prepare - Check the status of 'sap_install_media_detect_source_directory' + when: sap_install_media_detect_target_directory is undefined or + sap_install_media_detect_target_directory | string == "None" or + sap_install_media_detect_target_directory | string | length == 0 + block: + + - name: SAP Install Media Detect - Prepare - Get info of 'sap_install_media_detect_source_directory' + ansible.builtin.stat: + path: "{{ sap_install_media_detect_source_directory }}" + register: __sap_install_media_detect_source_directory_stat + + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' is writable + ansible.builtin.assert: + that: __sap_install_media_detect_source_directory_stat.stat.writeable + fail_msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} is not writable!" + success_msg: "PASS: Directory {{ sap_install_media_detect_source_directory }} is writable." + + - name: SAP Install Media Detect - Prepare - Set the variable sap_install_media_detect_source in case of writable local file system + ansible.builtin.set_fact: + sap_install_media_detect_source: 'local_dir' diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml new file mode 100644 index 000000000..b86147eec --- /dev/null +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml @@ -0,0 +1,53 @@ +--- + +- name: SAP Install Media Detect - Prepare - Create list of all files on the top level of 'sap_install_media_detect_source_directory' + ansible.builtin.find: + paths: "{{ sap_install_media_detect_source_directory }}" + patterns: '*' + recurse: false + use_regex: false + register: __sap_install_media_detect_register_find_result + +- name: SAP Install Media Detect - Prepare - Set fact from find result + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result: "{{ __sap_install_media_detect_fact_find_result | d([]) + [item.path] }}" + loop: "{{ __sap_install_media_detect_register_find_result.files }}" + +- name: SAP Install Media Detect - Prepare - Set fact with any file names without extension + ansible.builtin.set_fact: + __sap_install_media_detect_fact_files_without_extension: "{{ __sap_install_media_detect_fact_files_without_extension | d([]) + [item] }}" + when: (item | splitext)[1] | length == 0 + loop: "{{ __sap_install_media_detect_fact_find_result }}" + +- name: SAP Install Media Detect - Prepare - Iterate over files without extension and determine file type + ansible.builtin.shell: set -o pipefail && file {{ line_item }} | cut -d ' ' -f 2- + register: __sap_install_media_detect_register_files_without_extension_file_results + loop: "{{ __sap_install_media_detect_fact_files_without_extension }}" + loop_control: + loop_var: line_item + changed_when: false + +- name: SAP Install Media Detect - Prepare - Set fact with the results of the file command + ansible.builtin.set_fact: + __sap_install_media_detect_fact_files_without_extension_file_results: "{{ __sap_install_media_detect_fact_files_without_extension_file_results | d([]) + [__new_dict] }}" + loop: "{{ __sap_install_media_detect_register_files_without_extension_file_results.results }}" + vars: + __new_dict: + dir: "{{ item.line_item | dirname }}" + file: "{{ item.line_item | basename }}" + file_type: "{{ item.stdout }}" + +- name: SAP Install Media Detect - Prepare - Display the file dict + ansible.builtin.debug: + var: __sap_install_media_detect_fact_files_without_extension_file_results + +- name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR archive data' + ansible.builtin.set_fact: + __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension | d([]) + [item] }}" + when: item.file_type is search 'RAR archive data' +# when: item.file_type is search 'Zip archive data' + loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" + +- name: SAP Install Media Detect - Prepare - Display list of rar files to be renamed + ansible.builtin.debug: + var: __sap_install_media_detect_fact_rar_files_without_extension | d([]) diff --git a/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml b/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml new file mode 100644 index 000000000..52361a73c --- /dev/null +++ b/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml @@ -0,0 +1,12 @@ +--- + +- name: SAP Install Media Detect - Rename - Set fact for 'rar' extension + ansible.builtin.set_fact: + __sap_install_media_detect_fact_rar_extension: 'rar' +# __sap_install_media_detect_fact_rar_extension: 'zip' + +- name: SAP Install Media Detect - Rename - Add 'rar' extension + ansible.builtin.include_tasks: ./add_rar_extension_loop_block.yml + loop: "{{ __sap_install_media_detect_fact_rar_files_without_extension | d([]) }}" + loop_control: + loop_var: line_item diff --git a/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml new file mode 100644 index 000000000..28ee87c31 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml @@ -0,0 +1,15 @@ +--- + +- name: SAP Install Media Detect - Rename - Loop Block - Get info about target file + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }}" + register: __sap_install_media_detect_register_file_stat + +- name: SAP Install Media Detect - Rename - Loop Block - Fail if the target file already exists + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }} already exists!" + when: __sap_install_media_detect_register_file_stat.stat.exists + +- name: SAP Install Media Detect - Rename - Loop Block - Rename the file + ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }} + changed_when: true From 62384ff43e14c036e3df29e4c4e8c431649d404d Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 22 Jun 2023 16:09:05 +0200 Subject: [PATCH 095/128] sap_install_media_detect: Explain the addional tags in README.md --- roles/sap_install_media_detect/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/sap_install_media_detect/README.md b/roles/sap_install_media_detect/README.md index 58cfc2679..32912f80f 100644 --- a/roles/sap_install_media_detect/README.md +++ b/roles/sap_install_media_detect/README.md @@ -25,6 +25,9 @@ This role does not depend on any other Ansible Role. With the following tags, the role can be called to perform certain activities only: - tag `sap_install_media_detect_rar_handling`: Only perform the tasks for enabling the listing and extracting of files of type `RAR`. This includes enabling and disabling the EPEL repo for RHEL systems, if desired. +- tag `sap_install_media_detect_add_rar_extension`: Only add `.rar` to any files in `sap_install_media_detect_source_directory` which are of type `RAR` and have no ending. Needs to be used with tag `sap_install_media_detect_create_file_list`. +- tag `sap_install_media_detect_check_directories`: Find out if the directory `sap_install_media_detect_target_directory` or `sap_install_media_detect_source_directory` is writable. +- tag `sap_install_media_detect_create_file_list`: Only create a list of all files in `sap_install_media_detect_source_directory`, and create a list of any files which have no ending and are of type `RAR`. ## License From 0b1a90d4954c1343e77a5f646dff14e3d4f03552 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 28 Jun 2023 14:04:01 +0200 Subject: [PATCH 096/128] sap_hana_install: Solve issue #213 --- roles/sap_hana_install/defaults/main.yml | 6 ++ .../tasks/post_install/log_mode.yml | 57 ++++++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/roles/sap_hana_install/defaults/main.yml b/roles/sap_hana_install/defaults/main.yml index 9b7124c5c..771c566ba 100644 --- a/roles/sap_hana_install/defaults/main.yml +++ b/roles/sap_hana_install/defaults/main.yml @@ -191,6 +191,12 @@ sap_hana_install_system_restart: 'n' # create_initial_tenant, default: 'y' sap_hana_install_create_initial_tenant: 'y' +# The following variable can be used to modify the log_mode to 'overwrite' after the installation has finished. +# If unset or set to 'normal', the role will leave the log_mode to 'normal', which is required for SAP HANA +# System Replication. The log_mode 'overwrite' is useful for limiting cost or capacity if System Replication +# is not used. +#sap_hana_install_log_mode: 'overwrite' + # If the following variable is specified, the role will perform a scaleout installation or it will add additional # hosts to an existing HANA system. # Corresponding hdblcm parameter: addhosts diff --git a/roles/sap_hana_install/tasks/post_install/log_mode.yml b/roles/sap_hana_install/tasks/post_install/log_mode.yml index 5c7daca66..9590f00f8 100644 --- a/roles/sap_hana_install/tasks/post_install/log_mode.yml +++ b/roles/sap_hana_install/tasks/post_install/log_mode.yml @@ -1,6 +1,6 @@ --- -- name: SAP HANA Post Install - Set log_mode to overwrite +- name: SAP HANA Post Install - Set log_mode to overwrite, no initial tenant ansible.builtin.shell: | LD_LIBRARY_PATH=/usr/sap/{{ sap_hana_install_sid }}/HDB{{ sap_hana_install_number }}/exe \ /usr/sap/{{ sap_hana_install_sid }}/SYS/exe/hdb/hdbsql \ @@ -10,20 +10,61 @@ -u SYSTEM \ -p '{{ sap_hana_install_db_system_password | d(sap_hana_install_master_password) }}' \ -m < Date: Fri, 30 Jun 2023 10:56:44 +0200 Subject: [PATCH 097/128] sap_install_media_detect: Use a variable for the EPEL GPG key --- roles/sap_install_media_detect/defaults/main.yml | 3 +++ .../tasks/cleanup/disable-epel-repo.yml | 2 +- .../tasks/prepare/enable_rar_handling.yml | 8 ++------ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 83bcd56b5..d2b32f37e 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -3,6 +3,9 @@ sap_install_media_detect_rar_package: 'EPEL' #sap_install_media_detect_rar_package: 'linux-rar' +# URL for the EPEL GPG key +sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + # commands for handling rar files sap_install_media_detect_rar_list: '/usr/bin/lsar' sap_install_media_detect_rar_extract: '/usr/bin/unar' diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml index eac79a748..b24b3a19b 100644 --- a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -11,7 +11,7 @@ - name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version ansible.builtin.rpm_key: state: absent - key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + key: "{{ sap_install_media_detect_epel_gpg_key_url }}" # ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" # register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey when: diff --git a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml index cb23ba804..f7795359b 100644 --- a/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml +++ b/roles/sap_install_media_detect/tasks/prepare/enable_rar_handling.yml @@ -20,15 +20,11 @@ when: __sap_install_media_detect_register_rpm_q_epel.stdout != 'epel-release' block: - - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the correct EPEL GPG key - ansible.builtin.set_fact: - sap_install_media_detect_epel_gpg_key: "http://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" - - name: SAP Install Media Detect - Prepare - EPEL - Import the EPEL GPG key ansible.builtin.rpm_key: state: present - key: "{{ sap_install_media_detect_epel_gpg_key }}" -# ansible.builtin.command: "rpm --import {{ sap_install_media_detect_epel_gpg_key }}" + key: "{{ sap_install_media_detect_epel_gpg_key_url }}" +# ansible.builtin.command: "rpm --import {{ eap_install_media_detect_epel_gpg_key_url }}" # changed_when: true # - name: SAP Install Media Detect - Prepare - EPEL - Set fact for the EPEL URL From 50da8a339d50b87260c5348341cd7e4bc8974068 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 3 Jul 2023 14:50:18 +0200 Subject: [PATCH 098/128] sap_install_media_detect: Support rpm -e as an alternative to the rpm_key module for removing the EPEL GPG key --- .../defaults/main.yml | 7 ++++ .../tasks/cleanup/disable-epel-repo.yml | 35 +++++++++++++------ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index d2b32f37e..a18402080 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -6,6 +6,13 @@ sap_install_media_detect_rar_package: 'EPEL' # URL for the EPEL GPG key sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" +# The EPEL GPG key can be removed with the rpm_key module and the URL for the key, or by using the rpm -e command. +# For using the rpm -e command, set this variable to 'false'. +sap_install_media_detect_use_rpm_key_module_for_removing_the_key: true + +# URL for the EPEL GPG key +sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" + # commands for handling rar files sap_install_media_detect_rar_list: '/usr/bin/lsar' sap_install_media_detect_rar_extract: '/usr/bin/unar' diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml index b24b3a19b..71cd6f8ed 100644 --- a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -8,25 +8,38 @@ failed_when: false changed_when: false -- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version +- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version, using the rpm_key module ansible.builtin.rpm_key: state: absent key: "{{ sap_install_media_detect_epel_gpg_key_url }}" -# ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" -# register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey when: + - sap_install_media_detect_use_rpm_key_module_for_removing_the_key - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 -#- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal -# ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})' -# register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal -# failed_when: false +- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version, using the rpm -e command + ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" + register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey + when: + - not sap_install_media_detect_use_rpm_key_module_for_removing_the_key + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 -#- name: SAP Install Media Detect - Cleanup - Report any EPEL GPG key presence for this OS version -# ansible.builtin.fail: -# msg: Not all EPEL GPG keys have been removed! -# when: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal.stdout_lines | length != 0 +- name: SAP Install Media Detect - Cleanup - Get the GPG keys for this OS version after removal, rpm -e + ansible.builtin.shell: set -o pipefail && rpm -q gpg-pubkey --qf '%{NAME}-%{VERSION}-%{RELEASE}\t%{SUMMARY}\n' | grep 'EPEL ({{ ansible_distribution_major_version }})' + register: __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal + failed_when: false + when: + - not sap_install_media_detect_use_rpm_key_module_for_removing_the_key + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 + +- name: SAP Install Media Detect - Cleanup - Report any EPEL GPG key presence for this OS version, rpm -e + ansible.builtin.fail: + msg: Not all EPEL GPG keys have been removed! + when: + - not sap_install_media_detect_use_rpm_key_module_for_removing_the_key + - __sap_install_media_detect_register_rpm_q_gpg_pubkeys_after_removal.stdout_lines | length != 0 - name: SAP Install Media Detect - Cleanup - Remove the EPEL repo ansible.builtin.package: From 413aea069dfde1a2281bef326624fddaf9a9a629 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 3 Jul 2023 15:34:17 +0200 Subject: [PATCH 099/128] sap_install_media_detect: Improve software directory existence detection --- roles/sap_install_media_detect/defaults/main.yml | 4 ---- .../tasks/prepare/check_directories.yml | 13 ++++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index a18402080..3a281c838 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -10,9 +10,6 @@ sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/p # For using the rpm -e command, set this variable to 'false'. sap_install_media_detect_use_rpm_key_module_for_removing_the_key: true -# URL for the EPEL GPG key -sap_install_media_detect_epel_gpg_key_url: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}" - # commands for handling rar files sap_install_media_detect_rar_list: '/usr/bin/lsar' sap_install_media_detect_rar_extract: '/usr/bin/unar' @@ -30,7 +27,6 @@ sap_install_media_detect_source_directory: /software # Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory #sap_install_media_detect_target_directory: /software_local -sap_install_media_detect_target_directory: /software_local # local_dir, remote_dir (e.g. NFS, s3fuse) #sap_install_media_detect_source: local_dir diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index aacdb61d6..48dec60bf 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -12,6 +12,11 @@ path: "{{ sap_install_media_detect_target_directory }}" register: __sap_install_media_detect_target_directory_stat + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_target_directory' exists + ansible.builtin.fail: + msg: "FAIL: Directory {{ sap_install_media_detect_target_directory }} does not exist!" + when: not __sap_install_media_detect_target_directory_stat.stat.exists + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_target_directory' is writable ansible.builtin.assert: that: __sap_install_media_detect_target_directory_stat.stat.writeable @@ -33,12 +38,18 @@ path: "{{ sap_install_media_detect_source_directory }}" register: __sap_install_media_detect_source_directory_stat + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' exists + ansible.builtin.fail: + msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} does not exist!" + when: not __sap_install_media_detect_source_directory_stat.stat.exists + - name: SAP Install Media Detect - Prepare - Check if 'sap_install_media_detect_source_directory' is writable ansible.builtin.assert: that: __sap_install_media_detect_source_directory_stat.stat.writeable fail_msg: "FAIL: Directory {{ sap_install_media_detect_source_directory }} is not writable!" success_msg: "PASS: Directory {{ sap_install_media_detect_source_directory }} is writable." - - name: SAP Install Media Detect - Prepare - Set the variable sap_install_media_detect_source in case of writable local file system + - name: SAP Install Media Detect - Prepare - Set some variables in case of writable local file system ansible.builtin.set_fact: sap_install_media_detect_source: 'local_dir' + sap_install_media_detect_directory: "{{ sap_install_media_detect_source_directory }}" From 7385caf6712141baa7cf5c5530a362df7168b90a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 3 Jul 2023 15:39:29 +0200 Subject: [PATCH 100/128] sap_install_media_detect: Fix a minor ansible-lint error --- .../tasks/cleanup/disable-epel-repo.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml index 71cd6f8ed..606ef0609 100644 --- a/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml +++ b/roles/sap_install_media_detect/tasks/cleanup/disable-epel-repo.yml @@ -17,7 +17,8 @@ - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout | length != 0 - __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout_lines | length == 1 -- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version, using the rpm -e command +# Reason for noqa: The module rpm_key might fail in certain cases, and the use of the 'rpm -e' command is more reliable in these cases. +- name: SAP Install Media Detect - Cleanup - Remove the EPEL GPG key for this OS version, using the rpm -e command # noqa command-instead-of-module ansible.builtin.command: rpm -e "{{ __sap_install_media_detect_register_rpm_q_gpg_pubkeys.stdout.strip().split()[0] }}" register: __sap_install_media_detect_register_rpm_e_epel_gpg_pubkey when: From 1677dd32561caa3feb9ea10baa1d19301fe8e9e2 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 4 Jul 2023 11:11:17 +0200 Subject: [PATCH 101/128] sap_hana_preconfigure: Fix a minor ansible-lint error --- roles/sap_hana_preconfigure/meta/argument_specs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/sap_hana_preconfigure/meta/argument_specs.yml b/roles/sap_hana_preconfigure/meta/argument_specs.yml index f0a008c02..2a25d4515 100644 --- a/roles/sap_hana_preconfigure/meta/argument_specs.yml +++ b/roles/sap_hana_preconfigure/meta/argument_specs.yml @@ -374,4 +374,3 @@ argument_specs: - Set this parameter to `true` on Azure. required: false type: bool - From 8812a216874947fd9c20024e7d49ce4e0ae2a7a5 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 4 Jul 2023 15:12:52 +0200 Subject: [PATCH 102/128] sap_install_media_detect: Set sap_install_media_detect_file_server_only to false by default --- roles/sap_install_media_detect/defaults/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 3a281c838..2a935a0fb 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -20,7 +20,7 @@ sap_install_media_detect_rar_extract: '/usr/bin/unar' # e.g. /software # If this role is running on a file server on which the SAP software is not to be installed, set the following to true. # If this role is running on a system on which the SAP software is to be installed, set the following to false. -sap_install_media_detect_file_server_only: true +sap_install_media_detect_file_server_only: false # Directory where the SAP software is located sap_install_media_detect_source_directory: /software From 0b07a15e691d7645d9fe5cdf9ca17568bfb2a430 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Tue, 4 Jul 2023 15:43:56 +0200 Subject: [PATCH 103/128] sap_install_media_detect: Use new variable __sap_install_media_detect_software_main_directory to replace sap_install_media_detect_directory --- .../tasks/detect_export_sapbw4hana.yml | 6 ++-- .../tasks/detect_export_sapecc.yml | 30 ++++++++-------- .../tasks/detect_export_sapecc_ides.yml | 30 ++++++++-------- .../tasks/detect_export_sapnwas_abap.yml | 30 ++++++++-------- .../tasks/detect_export_sapnwas_java.yml | 30 ++++++++-------- .../tasks/detect_export_saps4hana.yml | 6 ++-- .../tasks/detect_export_sapsolman_abap.yml | 22 ++++++------ .../tasks/detect_sapanydb_ibmdb2.yml | 36 +++++++++---------- .../tasks/detect_sapanydb_oracledb.yml | 28 +++++++-------- .../tasks/detect_sapanydb_sapase.yml | 30 ++++++++-------- .../tasks/detect_sapanydb_sapmaxdb.yml | 18 +++++----- .../tasks/detect_sapcar.yml | 6 ++-- .../tasks/detect_saphana.yml | 10 +++--- .../tasks/detect_saphostagent.yml | 8 ++--- .../tasks/detect_sapswpm.yml | 14 ++++---- .../tasks/prepare/check_directories.yml | 2 +- .../tasks/set_global_vars.yml | 2 +- 17 files changed, 154 insertions(+), 154 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml index dca9a2e72..26748cf71 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapbw4hana.yml @@ -8,11 +8,11 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapbw4hana_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapbw4hana_export/" - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Identify SAP BW/4HANA EXPORT files ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}" + paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: yes file_type: file patterns: '.*BW4.*EXPORT.*' @@ -20,7 +20,7 @@ register: bw4hana_export_files - name: SAP Install Media Detect - SAP BW/4HANA EXPORT - Local Directory source - move SAP BW/4HANA EXPORT files - ansible.builtin.command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/sapbw4hana_export/{{ item.path | basename }}" + ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/sapbw4hana_export/{{ item.path | basename }}" with_items: "{{ bw4hana_export_files.files }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml index 39e44ed91..7d9cbe103 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapecc_export/" - - "{{ sap_install_media_detect_directory }}/sapecc_export_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted/" - name: SAP Install Media Detect - SAP ECC EXPORT - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ECC EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -34,7 +34,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -48,7 +48,7 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when @@ -56,7 +56,7 @@ with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence #- name: SAP Install Media Detect - SAP ECC EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when @@ -64,7 +64,7 @@ # with_items: # - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" # args: -# chdir: "{{ sap_install_media_detect_directory }}" +# chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when @@ -72,11 +72,11 @@ with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP ECC EXPORT - Identify SAP ECC Export extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapecc_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export_extracted" recurse: yes file_type: directory # contains: "DATA_UNITS" @@ -88,7 +88,7 @@ ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false when: - sap_install_media_detect_source == "local_dir" @@ -100,7 +100,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -112,7 +112,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -127,12 +127,12 @@ - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" when: - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC EXPORT - Local Directory source - move SAP ECC EXPORT compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_export/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml index 746eedf93..078b7f049 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapecc_ides.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapecc_ides_export/" - - "{{ sap_install_media_detect_directory }}/sapecc_ides_export_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted/" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -34,7 +34,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -48,7 +48,7 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any ZIP, then extract the SAP ECC Installation Export file (unzip) # noqa no-changed-when @@ -56,7 +56,7 @@ with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence #- name: SAP Install Media Detect - SAP ECC IDES EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when @@ -64,7 +64,7 @@ # with_items: # - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" # args: -# chdir: "{{ sap_install_media_detect_directory }}" +# chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP ECC Installation Export files # noqa no-changed-when @@ -72,11 +72,11 @@ with_items: - "{{ detect_directory_files_ecc_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Identify SAP ECC IDES EXPORT extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapecc_ides_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export_extracted" recurse: yes file_type: directory # contains: "*EXP" @@ -88,7 +88,7 @@ ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false when: - sap_install_media_detect_source == "local_dir" @@ -100,7 +100,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -112,7 +112,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -127,12 +127,12 @@ - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" when: - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP ECC IDES EXPORT - Local Directory source - move SAP ECC IDES EXPORT compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapecc_ides_export/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapecc_ides_export/{{ item }}" with_items: - "{{ detect_directory_files_ecc_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml index 76c2a340b..3439f0ea6 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_abap.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/" - - "{{ sap_install_media_detect_directory }}/sapnwas_abap_export_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: no @@ -34,7 +34,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: no @@ -48,7 +48,7 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when @@ -56,7 +56,7 @@ with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence #- name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when @@ -64,7 +64,7 @@ # with_items: # - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" # args: -# chdir: "{{ sap_install_media_detect_directory }}" +# chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (ABAP) Installation Export files # noqa no-changed-when @@ -72,11 +72,11 @@ with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Identify EXPORT extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapnwas_abap_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export_extracted" recurse: yes file_type: directory # contains: "DATA_UNITS" @@ -88,7 +88,7 @@ ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false when: - sap_install_media_detect_source == "local_dir" @@ -100,7 +100,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -112,7 +112,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -127,12 +127,12 @@ - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" when: - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (ABAP) platform only EXPORT - Local Directory source - move EXPORT compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml index 6a93ca4ea..2075d2ccf 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapnwas_java.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapnwas_java_export/" - - "{{ sap_install_media_detect_directory }}/sapnwas_java_export_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted/" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -34,7 +34,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -48,7 +48,7 @@ - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any ZIP, then extract the SAP NetWeaver (JAVA) Installation Export file (unzip) # noqa no-changed-when @@ -56,7 +56,7 @@ with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence #- name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - If any RAR without file extension, then add file extension # noqa no-changed-when @@ -64,7 +64,7 @@ # with_items: # - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" # args: -# chdir: "{{ sap_install_media_detect_directory }}" +# chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Find self-extracting RAR EXE (parent RAR file) and extract SAP NetWeaver (JAVA) Installation Export files # noqa no-changed-when @@ -72,11 +72,11 @@ with_items: - "{{ detect_directory_files_nwas_java_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Identify EXPORT extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapnwas_java_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export_extracted" recurse: yes file_type: directory # contains: "DATA_UNITS" @@ -88,7 +88,7 @@ ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false when: - sap_install_media_detect_source == "local_dir" @@ -100,7 +100,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -112,7 +112,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -127,12 +127,12 @@ - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_rar_repeated.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" when: - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP NetWeaver AS (JAVA) platform only EXPORT - Local Directory source - move EXPORT compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_java_export/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_java_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_java_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml index f3654b038..9a038d01f 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_saps4hana.yml @@ -8,11 +8,11 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/saps4hana_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/saps4hana_export/" - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Identify SAP S/4HANA EXPORT files ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}" + paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: yes file_type: file patterns: '.*S4.*EXPORT.*' @@ -20,7 +20,7 @@ register: s4hana_export_files - name: SAP Install Media Detect - SAP S/4HANA EXPORT - Local Directory source - move SAP S/4HANA EXPORT files - ansible.builtin.command: mv "{{ item.path }}" "{{ sap_install_media_detect_directory }}/saps4hana_export/{{ item.path | basename }}" + ansible.builtin.command: mv "{{ item.path }}" "{{ __sap_install_media_detect_software_main_directory }}/saps4hana_export/{{ item.path | basename }}" with_items: "{{ s4hana_export_files.files }}" when: - sap_install_media_detect_source == "local_dir" diff --git a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml index bb8d2639a..350ac098a 100644 --- a/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml +++ b/roles/sap_install_media_detect/tasks/detect_export_sapsolman_abap.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/" - - "{{ sap_install_media_detect_directory }}/sapsolman_abap_export_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted/" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -36,7 +36,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - If any ZIP, then extract the SAP NetWeaver (ABAP) Installation Export file (unzip) # noqa no-changed-when @@ -44,11 +44,11 @@ with_items: - "{{ detect_directory_files_nwas_abap_export.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Identify EXPORT extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapsolman_abap_export_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapsolman_abap_export_extracted" recurse: yes file_type: directory # contains: "DATA_UNITS" @@ -60,7 +60,7 @@ ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false when: - sap_install_media_detect_source == "local_dir" @@ -72,7 +72,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true when: - sap_install_media_detect_source == "local_dir" @@ -85,12 +85,12 @@ with_items: - "{{ detect_directory_files_zip_repeated.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" when: - sap_install_media_detect_source == "local_dir" - name: SAP Install Media Detect - SAP Solution Manager (ABAP) EXPORT - Local Directory source - move EXPORT compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapnwas_abap_export/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapnwas_abap_export/{{ item }}" with_items: - "{{ detect_directory_files_nwas_abap_export_repeated.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml index 5aae900f4..16a1b58d8 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_ibmdb2.yml @@ -8,16 +8,16 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/ibmdb2/" - - "{{ sap_install_media_detect_directory }}/ibmdb2_extracted/" - - "{{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/" - - "{{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2/" + - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/" - name: SAP Install Media Detect - IBM Db2 - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - IBM Db2 - Detect ZIP files (including no file extensions), ignore errors @@ -26,7 +26,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -38,7 +38,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client installation media ansible.builtin.shell: | @@ -48,7 +48,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 OEM license file ansible.builtin.shell: | @@ -58,35 +58,35 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 Client installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - IBM Db2 - Extract ZIP files of IBM DB2 OEM license file # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/ibmdb2_license_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_ibmdb2_license.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/ibmdb2_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_extracted" recurse: yes file_type: directory contains: "LINUXX86_64" @@ -94,14 +94,14 @@ - name: SAP Install Media Detect - IBM Db2 - Identify IBM Db2 Client extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/ibmdb2_client_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2_client_extracted" recurse: yes file_type: directory contains: "DATA_UNITS" register: detect_directory_ibmdb2_client_extracted - name: SAP Install Media Detect - IBM Db2 - Local Directory source - move IBM Db2 compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/ibmdb2/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/ibmdb2/{{ item }}" with_items: - "{{ detect_directory_files_ibmdb2.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_ibmdb2_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml index 39cc58a6f..8ad6a37c7 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_oracledb.yml @@ -8,15 +8,15 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/oracledb/" - - "{{ sap_install_media_detect_directory }}/oracledb_extracted/" - - "{{ sap_install_media_detect_directory }}/oracledb_client_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/oracledb/" + - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/" - name: SAP Install Media Detect - Oracle DB - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - Oracle DB - Detect ZIP files (including no file extensions), ignore errors @@ -25,7 +25,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -37,7 +37,7 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client installation media ansible.builtin.shell: | @@ -47,27 +47,27 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - Oracle DB - Extract ZIP files of Oracle DB Client installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/oracledb_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_extracted" recurse: yes file_type: directory contains: "LINUX_X86_64" @@ -75,14 +75,14 @@ - name: SAP Install Media Detect - Oracle DB - Identify Oracle DB Client extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/oracledb_client_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/oracledb_client_extracted" recurse: yes file_type: directory contains: "OCL_LINUX_X86_64" register: detect_directory_oracledb_client_extracted - name: SAP Install Media Detect - Oracle DB - Local Directory source - move Oracle DB compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/oracledb/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/oracledb/{{ item }}" with_items: - "{{ detect_directory_files_oracledb.results | map(attribute='stdout') | select() }}" - "{{ detect_directory_files_oracledb_client.results | map(attribute='stdout') | select() }}" diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml index b0a8aaec4..ea172d636 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapase.yml @@ -8,15 +8,15 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapase/" - - "{{ sap_install_media_detect_directory }}/sapase_extracted/" - - "{{ sap_install_media_detect_directory }}/sapase_client_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapase/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted/" - name: SAP Install Media Detect - SAP ASE - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP ASE - Detect ZIP files (including no file extensions), ignore errors @@ -25,7 +25,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -37,11 +37,11 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client installation media ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}" + paths: "{{ __sap_install_media_detect_software_main_directory }}" recurse: yes file_type: file patterns: '.*ASEBC.*' @@ -50,27 +50,27 @@ # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP ASE - Extract ZIP files of SAP ASE installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapase_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/sapase_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP ASE - Extract SAP ASE 16.0 Client with SAPCAR ansible.builtin.shell: | - {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name }} \ + {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name }} \ -xvf {{ item }} \ -manifest SIGNATURE.SMF \ - -R "{{ sap_install_media_detect_directory }}/sapase_client_extracted" + -R "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" with_items: - "{{ detect_directory_files_sapase_client.files[0].path }}" changed_when: true - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapase_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_extracted" recurse: yes file_type: directory patterns: ".*SYBASE_LINUX.*" # Use patterns to identify directory with this string @@ -79,14 +79,14 @@ - name: SAP Install Media Detect - SAP ASE - Identify SAP ASE Client extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapase_client_extracted" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapase_client_extracted" recurse: yes file_type: directory contains: "sybodbc" # Use contains to find specific filename register: detect_directory_sapase_client_extracted - name: SAP Install Media Detect - SAP ASE - Local Directory source - move SAP ASE compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapase/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapase/{{ item }}" with_items: - "{{ detect_directory_files_sapase.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml index d5582769e..1aac91cab 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapanydb_sapmaxdb.yml @@ -8,14 +8,14 @@ owner: root group: root with_items: - - "{{ sap_install_media_detect_directory }}/sapmaxdb/" - - "{{ sap_install_media_detect_directory }}/sapmaxdb_extracted/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/" + - "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" - name: SAP Install Media Detect - SAP MaxDB - List files in directory ansible.builtin.command: ls -1 register: detect_directory_files args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" changed_when: false - name: SAP Install Media Detect - SAP MaxDB - Detect ZIP files (including no file extensions), ignore errors @@ -24,7 +24,7 @@ with_items: - "{{ detect_directory_files.stdout_lines }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" ignore_errors: true changed_when: false @@ -36,19 +36,19 @@ with_items: - "{{ detect_directory_files_zip.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" # Reason for noqa: Difficult to determine the change status in the shell command sequence - name: SAP Install Media Detect - SAP MaxDB - Extract ZIP files of SAP MaxDB installation media # noqa no-changed-when - ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ sap_install_media_detect_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi + ansible.builtin.shell: set -o pipefail && if [ ! -z "$(file {{ item }} | grep 'Zip archive data')" ]; then unzip {{ item }} -d {{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/{{ item }}_extracted; fi with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" - name: SAP Install Media Detect - SAP MaxDB - Identify SAP MaxDB extracted ansible.builtin.find: - paths: "{{ sap_install_media_detect_directory }}/sapmaxdb_extracted/" + paths: "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb_extracted/" recurse: yes file_type: directory patterns: '.*MaxDB_7.9.*' # Use patterns to identify directory with this string @@ -56,7 +56,7 @@ register: detect_directory_sapmaxdb_extracted - name: SAP Install Media Detect - SAP MaxDB - Local Directory source - move SAP MaxDB compressed archive files - ansible.builtin.command: mv "{{ sap_install_media_detect_directory }}/{{ item }}" "{{ sap_install_media_detect_directory }}/sapmaxdb/{{ item }}" + ansible.builtin.command: mv "{{ __sap_install_media_detect_software_main_directory }}/{{ item }}" "{{ __sap_install_media_detect_software_main_directory }}/sapmaxdb/{{ item }}" with_items: - "{{ detect_directory_files_sapmaxdb.results | map(attribute='stdout') | select() }}" when: diff --git a/roles/sap_install_media_detect/tasks/detect_sapcar.yml b/roles/sap_install_media_detect/tasks/detect_sapcar.yml index 332782e44..a994203f9 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapcar.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapcar.yml @@ -1,9 +1,9 @@ --- -- name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ sap_install_media_detect_directory }} +- name: SAP Install Media Detect - SAPCAR - Get SAPCAR executable file from folder - {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls SAPCAR*.EXE args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_sapcar_file_name_get changed_when: false @@ -13,7 +13,7 @@ - name: SAP Install Media Detect - SAPCAR - Change ownership of SAPCAR ansible.builtin.file: - path: "{{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name }}" + path: "{{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name }}" state: file mode: '0755' owner: root diff --git a/roles/sap_install_media_detect/tasks/detect_saphana.yml b/roles/sap_install_media_detect/tasks/detect_saphana.yml index 573e101fd..24d5f78d3 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphana.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphana.yml @@ -2,7 +2,7 @@ - name: SAP Install Media Detect - SAP HANA - Set fact for install media directory ansible.builtin.set_fact: - sap_hana_install_directory: "{{ sap_install_media_detect_directory }}/sap_hana" + sap_hana_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hana" - name: SAP Install Media Detect - SAP HANA - Create Directory - {{ sap_hana_install_directory }} ansible.builtin.file: @@ -14,14 +14,14 @@ - name: SAP Install Media Detect - SAP HANA - Copy SAPCAR file ansible.builtin.shell: | - cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} + cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_hana_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} changed_when: true # IMDB SAR Files -- name: SAP Install Media Detect - SAP HANA - Get all IMDB SAR files in folder - {{ sap_install_media_detect_directory }} +- name: SAP Install Media Detect - SAP HANA - Get all IMDB SAR files in folder - {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls IMDB*.SAR args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: imdb_sarfiles_list changed_when: false @@ -33,7 +33,7 @@ - name: SAP Install Media Detect - SAP HANA - Copy SAP HANA files ansible.builtin.shell: | - cp {{ sap_install_media_detect_directory }}/{{ item }} {{ sap_install_media_detect_directory }}/sap_hana/{{ item }} + cp {{ __sap_install_media_detect_software_main_directory }}/{{ item }} {{ __sap_install_media_detect_software_main_directory }}/sap_hana/{{ item }} loop: "{{ sap_hana_install_imdb_sar }}" when: - not( imdb_sarfiles_list.stdout == '' ) diff --git a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml index 23f0f8e6f..b9d92b6d2 100644 --- a/roles/sap_install_media_detect/tasks/detect_saphostagent.yml +++ b/roles/sap_install_media_detect/tasks/detect_saphostagent.yml @@ -2,7 +2,7 @@ - name: SAP Install Media Detect - SAP Host Agent - Set fact for install media directory ansible.builtin.set_fact: - sap_hostagent_install_directory: "{{ sap_install_media_detect_directory }}/sap_hostagent" + sap_hostagent_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_hostagent" - name: SAP Install Media Detect - SAP Host Agent - Create Directory - {{ sap_hostagent_install_directory }} ansible.builtin.file: @@ -13,14 +13,14 @@ group: root # SAPHOSTAGENT -- name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ sap_install_media_detect_directory }} +- name: SAP Install Media Detect - SAP Host Agent - Get SAPHOSTAGENT SAR file from folder - {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls SAPHOSTAGENT*SAR args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: saphostagent_sarfile changed_when: false - name: SAP Install Media Detect - SAP Host Agent - Copy SAPHOSTAGENT SAR file ansible.builtin.shell: | - cp {{ sap_install_media_detect_directory }}/{{ saphostagent_sarfile.stdout }} {{ sap_hostagent_install_directory }}/{{ saphostagent_sarfile.stdout }} + cp {{ __sap_install_media_detect_software_main_directory }}/{{ saphostagent_sarfile.stdout }} {{ sap_hostagent_install_directory }}/{{ saphostagent_sarfile.stdout }} changed_when: true diff --git a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml index 057d614ac..e42f0b963 100644 --- a/roles/sap_install_media_detect/tasks/detect_sapswpm.yml +++ b/roles/sap_install_media_detect/tasks/detect_sapswpm.yml @@ -2,9 +2,9 @@ - name: SAP Install Media Detect - SAP SWPM - Set fact for install media directory ansible.builtin.set_fact: - sap_swpm_install_directory: "{{ sap_install_media_detect_directory }}/sap_swpm" - sap_swpm_software_path: "{{ sap_install_media_detect_directory }}" - sap_swpm_swpm_path: "{{ sap_install_media_detect_directory }}/sap_swpm" + sap_swpm_install_directory: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" + sap_swpm_software_path: "{{ __sap_install_media_detect_software_main_directory }}" + sap_swpm_swpm_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" - name: SAP Install Media Detect - SAP SWPM - Create Directory - {{ sap_swpm_install_directory }} ansible.builtin.file: @@ -16,20 +16,20 @@ - name: SAP Install Media Detect - SAP SWPM - Copy SAPCAR file ansible.builtin.shell: | - cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_swpm_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} + cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} {{ sap_swpm_install_directory }}/{{ sap_swpm_sapcar_file_name_get.stdout }} changed_when: true # SWPM -- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ sap_install_media_detect_directory }} +- name: SAP Install Media Detect - SAP SWPM - Get SWPM from {{ __sap_install_media_detect_software_main_directory }} ansible.builtin.shell: ls SWPM*.SAR args: - chdir: "{{ sap_install_media_detect_directory }}" + chdir: "{{ __sap_install_media_detect_software_main_directory }}" register: sap_swpm_swpm_sar_file_name_get changed_when: false - name: SAP Install Media Detect - SAP SWPM - Copy SWPM file ansible.builtin.shell: | - cp {{ sap_install_media_detect_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }} {{ sap_install_media_detect_directory }}/sap_swpm/{{ sap_swpm_swpm_sar_file_name_get.stdout }} + cp {{ __sap_install_media_detect_software_main_directory }}/{{ sap_swpm_swpm_sar_file_name_get.stdout }} {{ __sap_install_media_detect_software_main_directory }}/sap_swpm/{{ sap_swpm_swpm_sar_file_name_get.stdout }} changed_when: true diff --git a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml index 48dec60bf..f949f3957 100644 --- a/roles/sap_install_media_detect/tasks/prepare/check_directories.yml +++ b/roles/sap_install_media_detect/tasks/prepare/check_directories.yml @@ -52,4 +52,4 @@ - name: SAP Install Media Detect - Prepare - Set some variables in case of writable local file system ansible.builtin.set_fact: sap_install_media_detect_source: 'local_dir' - sap_install_media_detect_directory: "{{ sap_install_media_detect_source_directory }}" + __sap_install_media_detect_software_main_directory: "{{ sap_install_media_detect_source_directory }}" diff --git a/roles/sap_install_media_detect/tasks/set_global_vars.yml b/roles/sap_install_media_detect/tasks/set_global_vars.yml index 0fd3aed83..3fcdd37d0 100644 --- a/roles/sap_install_media_detect/tasks/set_global_vars.yml +++ b/roles/sap_install_media_detect/tasks/set_global_vars.yml @@ -96,7 +96,7 @@ - name: SAP Install Media Detection Completed - set facts for SAP SWPM ansible.builtin.set_fact: - sap_swpm_sapcar_path: "{{ sap_install_media_detect_directory }}/sap_swpm" # for sap_swpm Ansible Role + sap_swpm_sapcar_path: "{{ __sap_install_media_detect_software_main_directory }}/sap_swpm" # for sap_swpm Ansible Role ignore_errors: true when: - sap_install_media_detect_swpm From 73f7ddf598cfc0e3d4d050f183698a470847c5dd Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 5 Jul 2023 11:24:41 +0200 Subject: [PATCH 104/128] sap_hana_preconfigure: add sap_hana_preconfigure_assert_all_config to meta/argument_specs.yml --- roles/sap_hana_preconfigure/README.md | 7 +++++++ roles/sap_hana_preconfigure/defaults/main.yml | 4 ++++ roles/sap_hana_preconfigure/meta/argument_specs.yml | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/roles/sap_hana_preconfigure/README.md b/roles/sap_hana_preconfigure/README.md index 0e65509ae..a1462957e 100644 --- a/roles/sap_hana_preconfigure/README.md +++ b/roles/sap_hana_preconfigure/README.md @@ -131,6 +131,13 @@ sap_hana_preconfigure_2382421: true If set to `true`, the role will run in assertion mode instead of the default configuration mode.
+### sap_hana_preconfigure_assert_all_config +- _Type:_ `bool` +- _Default:_ `false` + +In assertion mode, the role will check either tuned or static settings.
+If this parameter is set to to `true`, the role will check both tuned and static settings.
+ ### sap_hana_preconfigure_assert_ignore_errors - _Type:_ `bool` - _Default:_ `false` diff --git a/roles/sap_hana_preconfigure/defaults/main.yml b/roles/sap_hana_preconfigure/defaults/main.yml index 67a8e5f38..16a556a3e 100644 --- a/roles/sap_hana_preconfigure/defaults/main.yml +++ b/roles/sap_hana_preconfigure/defaults/main.yml @@ -17,6 +17,10 @@ sap_hana_preconfigure_assert: false # If set to `true`, the role will run in assertion mode instead of the default configuration mode. +sap_hana_preconfigure_assert_all_config: false +# In assertion mode, the role will check either tuned or static settings. +# If this parameter is set to to `true`, the role will check both tuned and static settings. + sap_hana_preconfigure_assert_ignore_errors: false # In assertion mode, the role will abort when encountering any assertion error. # If this parameter is set to `false`, the role will *not* abort when encountering an assertion error. diff --git a/roles/sap_hana_preconfigure/meta/argument_specs.yml b/roles/sap_hana_preconfigure/meta/argument_specs.yml index 2a25d4515..624686392 100644 --- a/roles/sap_hana_preconfigure/meta/argument_specs.yml +++ b/roles/sap_hana_preconfigure/meta/argument_specs.yml @@ -53,6 +53,14 @@ argument_specs: required: false type: bool + sap_hana_preconfigure_assert_all_config: + default: false + description: + - In assertion mode, the role will check either tuned or static settings. + - If this parameter is set to to `true`, the role will check both tuned and static settings. + required: false + type: bool + sap_hana_preconfigure_assert_ignore_errors: default: false description: From 50a08a4ff76fe16046a8ad29c5bcd7bbe2c35647 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 5 Jul 2023 11:34:24 +0200 Subject: [PATCH 105/128] sap_hana_preconfigure: Do not set sap_hana_preconfigure_db_group_name in defaults/main.yml --- roles/sap_hana_preconfigure/README.md | 7 ++++++- roles/sap_hana_preconfigure/defaults/main.yml | 3 ++- roles/sap_hana_preconfigure/meta/argument_specs.yml | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/roles/sap_hana_preconfigure/README.md b/roles/sap_hana_preconfigure/README.md index a1462957e..863f13e19 100644 --- a/roles/sap_hana_preconfigure/README.md +++ b/roles/sap_hana_preconfigure/README.md @@ -382,11 +382,16 @@ Set this parameter to `false` if this is not desired.
### sap_hana_preconfigure_db_group_name - _Type:_ `str` -- _Default:_ `'dba'` Use this parameter to specify the name of the RHEL group which is used for the database processes.
It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999.
+Example: + +```yaml +sap_hana_preconfigure_db_group_name: dba +``` + ### sap_hana_preconfigure_saptune_version - _Type:_ `str` - _Default:_ `'3.0.2'` diff --git a/roles/sap_hana_preconfigure/defaults/main.yml b/roles/sap_hana_preconfigure/defaults/main.yml index 16a556a3e..da4b64ddb 100644 --- a/roles/sap_hana_preconfigure/defaults/main.yml +++ b/roles/sap_hana_preconfigure/defaults/main.yml @@ -163,9 +163,10 @@ sap_hana_preconfigure_run_grub2_mkconfig: true # By default, the role will run `grub2-mkconfig` to update the Grub configuration if necessary. # Set this parameter to `false` if this is not desired. -sap_hana_preconfigure_db_group_name: 'dba' +# sap_hana_preconfigure_db_group_name: (not defined by default) # Use this parameter to specify the name of the RHEL group which is used for the database processes. # It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999. +# Example: See README.md sap_hana_preconfigure_saptune_version: '3.0.2' # Version of saptune to install (SLES for SAP Applications). diff --git a/roles/sap_hana_preconfigure/meta/argument_specs.yml b/roles/sap_hana_preconfigure/meta/argument_specs.yml index 624686392..bcf189568 100644 --- a/roles/sap_hana_preconfigure/meta/argument_specs.yml +++ b/roles/sap_hana_preconfigure/meta/argument_specs.yml @@ -348,10 +348,11 @@ argument_specs: type: bool sap_hana_preconfigure_db_group_name: - default: 'dba' description: - Use this parameter to specify the name of the RHEL group which is used for the database processes. - It will be used to configure process limits as per step "Configuring Process Resource Limits" of SAP note 2772999. + example: + sap_hana_preconfigure_db_group_name: 'dba' required: false type: str From 48cae4b2d36771730f7eb1f480873e9a2ab86181 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 13 Jul 2023 10:36:22 +0200 Subject: [PATCH 106/128] sap_install_media_detect: Also rename any zip file without extension --- .../tasks/prepare/create_file_list.yml | 33 +++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml index b86147eec..92bce520e 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml @@ -1,5 +1,17 @@ --- +# The fact variables are appended in tasks of this file, so they need to be initialized explicitly. +# With implicit initialization (by using the default filter), the variables would be appended again if the role +# was called more than once in a playbook. +# See https://github.com/sap-linuxlab/community.sap_install/issues/402 . +- name: SAP Install Media Detect - Prepare - Initialize fact variables + ansible.builtin.set_fact: + __sap_install_media_detect_fact_find_result: [] + __sap_install_media_detect_fact_files_without_extension: [] + __sap_install_media_detect_fact_files_without_extension_file_results: [] + __sap_install_media_detect_fact_zip_files_without_extension: [] + __sap_install_media_detect_fact_rar_files_without_extension: [] + - name: SAP Install Media Detect - Prepare - Create list of all files on the top level of 'sap_install_media_detect_source_directory' ansible.builtin.find: paths: "{{ sap_install_media_detect_source_directory }}" @@ -10,12 +22,12 @@ - name: SAP Install Media Detect - Prepare - Set fact from find result ansible.builtin.set_fact: - __sap_install_media_detect_fact_find_result: "{{ __sap_install_media_detect_fact_find_result | d([]) + [item.path] }}" + __sap_install_media_detect_fact_find_result: "{{ __sap_install_media_detect_fact_find_result + [item.path] }}" loop: "{{ __sap_install_media_detect_register_find_result.files }}" - name: SAP Install Media Detect - Prepare - Set fact with any file names without extension ansible.builtin.set_fact: - __sap_install_media_detect_fact_files_without_extension: "{{ __sap_install_media_detect_fact_files_without_extension | d([]) + [item] }}" + __sap_install_media_detect_fact_files_without_extension: "{{ __sap_install_media_detect_fact_files_without_extension + [item] }}" when: (item | splitext)[1] | length == 0 loop: "{{ __sap_install_media_detect_fact_find_result }}" @@ -29,7 +41,7 @@ - name: SAP Install Media Detect - Prepare - Set fact with the results of the file command ansible.builtin.set_fact: - __sap_install_media_detect_fact_files_without_extension_file_results: "{{ __sap_install_media_detect_fact_files_without_extension_file_results | d([]) + [__new_dict] }}" + __sap_install_media_detect_fact_files_without_extension_file_results: "{{ __sap_install_media_detect_fact_files_without_extension_file_results + [__new_dict] }}" loop: "{{ __sap_install_media_detect_register_files_without_extension_file_results.results }}" vars: __new_dict: @@ -41,13 +53,22 @@ ansible.builtin.debug: var: __sap_install_media_detect_fact_files_without_extension_file_results +- name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'Zip archive data' + ansible.builtin.set_fact: + __sap_install_media_detect_fact_zip_files_without_extension: "{{ __sap_install_media_detect_fact_zip_files_without_extension + [item] }}" + when: item.file_type is search 'Zip archive data' + loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" + +- name: SAP Install Media Detect - Prepare - Display list of zip files to be renamed + ansible.builtin.debug: + var: __sap_install_media_detect_fact_zip_files_without_extension + - name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR archive data' ansible.builtin.set_fact: - __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension | d([]) + [item] }}" + __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension + [item] }}" when: item.file_type is search 'RAR archive data' -# when: item.file_type is search 'Zip archive data' loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - name: SAP Install Media Detect - Prepare - Display list of rar files to be renamed ansible.builtin.debug: - var: __sap_install_media_detect_fact_rar_files_without_extension | d([]) + var: __sap_install_media_detect_fact_rar_files_without_extension From db0547fc659eae680131c6c0d6c26fd3445ba35a Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 13 Jul 2023 11:32:42 +0200 Subject: [PATCH 107/128] sap_install_media_detect: Also rename any exe file without extension --- roles/sap_install_media_detect/tasks/main.yml | 8 ++++---- .../tasks/prepare/create_file_list.yml | 13 ++++++------- .../rename/add_exe_extension_loop_block.yml | 15 +++++++++++++++ .../tasks/rename/add_file_extension.yml | 19 +++++++++++++++++++ .../tasks/rename/add_rar_extension.yml | 12 ------------ .../rename/add_rar_extension_loop_block.yml | 16 ++++++++-------- .../rename/add_zip_extension_loop_block.yml | 15 +++++++++++++++ 7 files changed, 67 insertions(+), 31 deletions(-) create mode 100644 roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml create mode 100644 roles/sap_install_media_detect/tasks/rename/add_file_extension.yml delete mode 100644 roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml create mode 100644 roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml diff --git a/roles/sap_install_media_detect/tasks/main.yml b/roles/sap_install_media_detect/tasks/main.yml index 6ded0dde0..15afd825f 100644 --- a/roles/sap_install_media_detect/tasks/main.yml +++ b/roles/sap_install_media_detect/tasks/main.yml @@ -21,12 +21,12 @@ tags: sap_install_media_detect_create_file_list tags: sap_install_media_detect_create_file_list -- name: SAP Install Media Detect - Detect and if necessary rename rar files without extension +- name: SAP Install Media Detect - Detect and if necessary rename zip and rar files without extension ansible.builtin.include_tasks: - file: rename/add_rar_extension.yml + file: rename/add_file_extension.yml apply: - tags: sap_install_media_detect_add_rar_extension - tags: sap_install_media_detect_add_rar_extension + tags: sap_install_media_detect_add_file_extension + tags: sap_install_media_detect_add_file_extension - name: SAP Install Media Detect - Organize SAPCAR ansible.builtin.include_tasks: detect_sapcar.yml diff --git a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml index 92bce520e..11148dae3 100644 --- a/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml +++ b/roles/sap_install_media_detect/tasks/prepare/create_file_list.yml @@ -10,6 +10,7 @@ __sap_install_media_detect_fact_files_without_extension: [] __sap_install_media_detect_fact_files_without_extension_file_results: [] __sap_install_media_detect_fact_zip_files_without_extension: [] + __sap_install_media_detect_fact_exe_files_without_extension: [] __sap_install_media_detect_fact_rar_files_without_extension: [] - name: SAP Install Media Detect - Prepare - Create list of all files on the top level of 'sap_install_media_detect_source_directory' @@ -59,16 +60,14 @@ when: item.file_type is search 'Zip archive data' loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" -- name: SAP Install Media Detect - Prepare - Display list of zip files to be renamed - ansible.builtin.debug: - var: __sap_install_media_detect_fact_zip_files_without_extension +- name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR self-extracting archive' + ansible.builtin.set_fact: + __sap_install_media_detect_fact_exe_files_without_extension: "{{ __sap_install_media_detect_fact_exe_files_without_extension + [item] }}" + when: item.file_type is search 'RAR self-extracting archive' + loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - name: SAP Install Media Detect - Prepare - Set fact with file names without extension and of type 'RAR archive data' ansible.builtin.set_fact: __sap_install_media_detect_fact_rar_files_without_extension: "{{ __sap_install_media_detect_fact_rar_files_without_extension + [item] }}" when: item.file_type is search 'RAR archive data' loop: "{{ __sap_install_media_detect_fact_files_without_extension_file_results }}" - -- name: SAP Install Media Detect - Prepare - Display list of rar files to be renamed - ansible.builtin.debug: - var: __sap_install_media_detect_fact_rar_files_without_extension diff --git a/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml new file mode 100644 index 000000000..3ace35705 --- /dev/null +++ b/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml @@ -0,0 +1,15 @@ +--- + +- name: SAP Install Media Detect - Rename - Loop Block - Get info about target self-extracting rar file '{{ line_item.file }}.exe' + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}.exe" + register: __sap_install_media_detect_register_exe_file_stat + +- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.exe' already exists + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.exe already exists!" + when: __sap_install_media_detect_register_exe_file_stat.stat.exists + +- name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.exe' + ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.exe + changed_when: true diff --git a/roles/sap_install_media_detect/tasks/rename/add_file_extension.yml b/roles/sap_install_media_detect/tasks/rename/add_file_extension.yml new file mode 100644 index 000000000..45abd78fa --- /dev/null +++ b/roles/sap_install_media_detect/tasks/rename/add_file_extension.yml @@ -0,0 +1,19 @@ +--- + +- name: SAP Install Media Detect - Rename - Add 'zip' extension to zip files + ansible.builtin.include_tasks: ./add_zip_extension_loop_block.yml + loop: "{{ __sap_install_media_detect_fact_zip_files_without_extension | d([]) }}" + loop_control: + loop_var: line_item + +- name: SAP Install Media Detect - Rename - Add 'exe' extension to self-extracting rar files + ansible.builtin.include_tasks: ./add_exe_extension_loop_block.yml + loop: "{{ __sap_install_media_detect_fact_exe_files_without_extension | d([]) }}" + loop_control: + loop_var: line_item + +- name: SAP Install Media Detect - Rename - Add 'rar' extension to rar files + ansible.builtin.include_tasks: ./add_rar_extension_loop_block.yml + loop: "{{ __sap_install_media_detect_fact_rar_files_without_extension | d([]) }}" + loop_control: + loop_var: line_item diff --git a/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml b/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml deleted file mode 100644 index 52361a73c..000000000 --- a/roles/sap_install_media_detect/tasks/rename/add_rar_extension.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- - -- name: SAP Install Media Detect - Rename - Set fact for 'rar' extension - ansible.builtin.set_fact: - __sap_install_media_detect_fact_rar_extension: 'rar' -# __sap_install_media_detect_fact_rar_extension: 'zip' - -- name: SAP Install Media Detect - Rename - Add 'rar' extension - ansible.builtin.include_tasks: ./add_rar_extension_loop_block.yml - loop: "{{ __sap_install_media_detect_fact_rar_files_without_extension | d([]) }}" - loop_control: - loop_var: line_item diff --git a/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml index 28ee87c31..c01cb2834 100644 --- a/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml +++ b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml @@ -1,15 +1,15 @@ --- -- name: SAP Install Media Detect - Rename - Loop Block - Get info about target file +- name: SAP Install Media Detect - Rename - Loop Block - Get info about target rar file '{{ line_item.file }}.rar' ansible.builtin.stat: - path: "{{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }}" - register: __sap_install_media_detect_register_file_stat + path: "{{ line_item.dir }}/{{ line_item.file }}.rar" + register: __sap_install_media_detect_register_rar_file_stat -- name: SAP Install Media Detect - Rename - Loop Block - Fail if the target file already exists +- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.rar' already exists ansible.builtin.fail: - msg: "File {{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }} already exists!" - when: __sap_install_media_detect_register_file_stat.stat.exists + msg: "File {{ line_item.dir }}/{{ line_item.file }}.rar already exists!" + when: __sap_install_media_detect_register_rar_file_stat.stat.exists -- name: SAP Install Media Detect - Rename - Loop Block - Rename the file - ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.{{ __sap_install_media_detect_fact_rar_extension }} +- name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.rar' + ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.rar changed_when: true diff --git a/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml new file mode 100644 index 000000000..2b7a663ef --- /dev/null +++ b/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml @@ -0,0 +1,15 @@ +--- + +- name: SAP Install Media Detect - Rename - Loop Block - Get info about target zip file '{{ line_item.file }}.zip' + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}.zip" + register: __sap_install_media_detect_register_zip_file_stat + +- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.zip' already exists + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.zip already exists!" + when: __sap_install_media_detect_register_zip_file_stat.stat.exists + +- name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.zip' + ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.zip + changed_when: true From 2d540d0c8bc8d61cf2f7d33b7ac63dde88adfc70 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 13 Jul 2023 20:09:54 +0200 Subject: [PATCH 108/128] sap_install_media_detect: Use a more sophisticated logic for renaming RAR or ZIP files --- .../defaults/main.yml | 7 +++- .../rename/add_exe_extension_loop_block.yml | 42 ++++++++++++++++--- .../rename/add_rar_extension_loop_block.yml | 42 ++++++++++++++++--- .../rename/add_zip_extension_loop_block.yml | 42 ++++++++++++++++--- 4 files changed, 117 insertions(+), 16 deletions(-) diff --git a/roles/sap_install_media_detect/defaults/main.yml b/roles/sap_install_media_detect/defaults/main.yml index 2a935a0fb..0c954261a 100644 --- a/roles/sap_install_media_detect/defaults/main.yml +++ b/roles/sap_install_media_detect/defaults/main.yml @@ -17,7 +17,6 @@ sap_install_media_detect_rar_extract: '/usr/bin/unar' #sap_install_media_detect_rar_list: '/usr/bin/unrar lb' #sap_install_media_detect_rar_extract: '/usr/bin/unrar x' -# e.g. /software # If this role is running on a file server on which the SAP software is not to be installed, set the following to true. # If this role is running on a system on which the SAP software is to be installed, set the following to false. sap_install_media_detect_file_server_only: false @@ -25,6 +24,12 @@ sap_install_media_detect_file_server_only: false # Directory where the SAP software is located sap_install_media_detect_source_directory: /software +# If there are two files of the same RAR or ZIP type, one with and one without suffix, the following parameter will determine what +# the role will do for such a file: skip the file renaming, fail, or overwrite the file with the suffix by the file without suffix +sap_install_media_detect_rename_target_file_exists: 'skip' +#sap_install_media_detect_rename_target_file_exists: 'fail' +#sap_install_media_detect_rename_target_file_exists: 'overwrite' + # Directory where the SAP software is located after the role is run, if different from sap_install_media_detect_source_directory #sap_install_media_detect_target_directory: /software_local diff --git a/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml index 3ace35705..3a5e565ec 100644 --- a/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml +++ b/roles/sap_install_media_detect/tasks/rename/add_exe_extension_loop_block.yml @@ -3,13 +3,45 @@ - name: SAP Install Media Detect - Rename - Loop Block - Get info about target self-extracting rar file '{{ line_item.file }}.exe' ansible.builtin.stat: path: "{{ line_item.dir }}/{{ line_item.file }}.exe" - register: __sap_install_media_detect_register_exe_file_stat + register: __sap_install_media_detect_register_exe_file_target_stat -- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.exe' already exists - ansible.builtin.fail: - msg: "File {{ line_item.dir }}/{{ line_item.file }}.exe already exists!" - when: __sap_install_media_detect_register_exe_file_stat.stat.exists +- name: SAP Install Media Detect - Rename - Loop Block - Get info about source self-extracting rar file '{{ line_item.file }}' + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}" + register: __sap_install_media_detect_register_exe_file_source_stat + +- name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}.exe' exists + when: __sap_install_media_detect_register_exe_file_target_stat.stat.exists + block: + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is identical - Remove it + ansible.builtin.file: + path: "{{ line_item.dir }}/{{ line_item.file }}" + state: absent + when: __sap_install_media_detect_register_exe_file_source_stat.stat.checksum == + __sap_install_media_detect_register_exe_file_target_stat.stat.checksum + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Fail + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.exe already exists!" + when: + - __sap_install_media_detect_register_exe_file_source_stat.stat.checksum != + __sap_install_media_detect_register_exe_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'fail' + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Skip + ansible.builtin.debug: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.exe already exists. Skipping." + when: + - __sap_install_media_detect_register_exe_file_source_stat.stat.checksum != + __sap_install_media_detect_register_exe_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'skip' - name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.exe' ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.exe changed_when: true + when: not __sap_install_media_detect_register_exe_file_target_stat.stat.exists or + ( + __sap_install_media_detect_register_exe_file_target_stat.stat.exists and + sap_install_media_detect_rename_target_file_exists == 'overwrite' + ) diff --git a/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml index c01cb2834..0f6c3f71d 100644 --- a/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml +++ b/roles/sap_install_media_detect/tasks/rename/add_rar_extension_loop_block.yml @@ -3,13 +3,45 @@ - name: SAP Install Media Detect - Rename - Loop Block - Get info about target rar file '{{ line_item.file }}.rar' ansible.builtin.stat: path: "{{ line_item.dir }}/{{ line_item.file }}.rar" - register: __sap_install_media_detect_register_rar_file_stat + register: __sap_install_media_detect_register_rar_file_target_stat -- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.rar' already exists - ansible.builtin.fail: - msg: "File {{ line_item.dir }}/{{ line_item.file }}.rar already exists!" - when: __sap_install_media_detect_register_rar_file_stat.stat.exists +- name: SAP Install Media Detect - Rename - Loop Block - Get info about source rar file '{{ line_item.file }}' + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}" + register: __sap_install_media_detect_register_rar_file_source_stat + +- name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}.rar' exists + when: __sap_install_media_detect_register_rar_file_target_stat.stat.exists + block: + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is identical - Remove it + ansible.builtin.file: + path: "{{ line_item.dir }}/{{ line_item.file }}" + state: absent + when: __sap_install_media_detect_register_rar_file_source_stat.stat.checksum == + __sap_install_media_detect_register_rar_file_target_stat.stat.checksum + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Fail + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.rar already exists!" + when: + - __sap_install_media_detect_register_rar_file_source_stat.stat.checksum != + __sap_install_media_detect_register_rar_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'fail' + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Skip + ansible.builtin.debug: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.rar already exists. Skipping." + when: + - __sap_install_media_detect_register_rar_file_source_stat.stat.checksum != + __sap_install_media_detect_register_rar_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'skip' - name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.rar' ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.rar changed_when: true + when: not __sap_install_media_detect_register_rar_file_target_stat.stat.exists or + ( + __sap_install_media_detect_register_rar_file_target_stat.stat.exists and + sap_install_media_detect_rename_target_file_exists == 'overwrite' + ) diff --git a/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml b/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml index 2b7a663ef..20892ed68 100644 --- a/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml +++ b/roles/sap_install_media_detect/tasks/rename/add_zip_extension_loop_block.yml @@ -3,13 +3,45 @@ - name: SAP Install Media Detect - Rename - Loop Block - Get info about target zip file '{{ line_item.file }}.zip' ansible.builtin.stat: path: "{{ line_item.dir }}/{{ line_item.file }}.zip" - register: __sap_install_media_detect_register_zip_file_stat + register: __sap_install_media_detect_register_zip_file_target_stat -- name: SAP Install Media Detect - Rename - Loop Block - Fail if '{{ line_item.file }}.zip' already exists - ansible.builtin.fail: - msg: "File {{ line_item.dir }}/{{ line_item.file }}.zip already exists!" - when: __sap_install_media_detect_register_zip_file_stat.stat.exists +- name: SAP Install Media Detect - Rename - Loop Block - Get info about source zip file '{{ line_item.file }}' + ansible.builtin.stat: + path: "{{ line_item.dir }}/{{ line_item.file }}" + register: __sap_install_media_detect_register_zip_file_source_stat + +- name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}.zip' exists + when: __sap_install_media_detect_register_zip_file_target_stat.stat.exists + block: + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is identical - Remove it + ansible.builtin.file: + path: "{{ line_item.dir }}/{{ line_item.file }}" + state: absent + when: __sap_install_media_detect_register_zip_file_source_stat.stat.checksum == + __sap_install_media_detect_register_zip_file_target_stat.stat.checksum + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Fail + ansible.builtin.fail: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.zip already exists!" + when: + - __sap_install_media_detect_register_zip_file_source_stat.stat.checksum != + __sap_install_media_detect_register_zip_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'fail' + + - name: SAP Install Media Detect - Rename - Loop Block - '{{ line_item.file }}' is different - Skip + ansible.builtin.debug: + msg: "File {{ line_item.dir }}/{{ line_item.file }}.zip already exists. Skipping." + when: + - __sap_install_media_detect_register_zip_file_source_stat.stat.checksum != + __sap_install_media_detect_register_zip_file_target_stat.stat.checksum + - sap_install_media_detect_rename_target_file_exists == 'skip' - name: SAP Install Media Detect - Rename - Loop Block - Rename '{{ line_item.file }}' to '{{ line_item.file }}.zip' ansible.builtin.command: mv {{ line_item.dir }}/{{ line_item.file }} {{ line_item.dir }}/{{ line_item.file }}.zip changed_when: true + when: not __sap_install_media_detect_register_zip_file_target_stat.stat.exists or + ( + __sap_install_media_detect_register_zip_file_target_stat.stat.exists and + sap_install_media_detect_rename_target_file_exists == 'overwrite' + ) From a6cc380ca61cecdd89b12233038201ac426c1f86 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 17 Jul 2023 13:10:43 +0200 Subject: [PATCH 109/128] sap_ha_set_netweaver: Solve issue #381 --- roles/sap_ha_set_netweaver/.ansible-lint | 7 ------- roles/sap_ha_set_netweaver/.yamllint.yml | 21 --------------------- 2 files changed, 28 deletions(-) delete mode 100644 roles/sap_ha_set_netweaver/.ansible-lint delete mode 100644 roles/sap_ha_set_netweaver/.yamllint.yml diff --git a/roles/sap_ha_set_netweaver/.ansible-lint b/roles/sap_ha_set_netweaver/.ansible-lint deleted file mode 100644 index 63122b8f9..000000000 --- a/roles/sap_ha_set_netweaver/.ansible-lint +++ /dev/null @@ -1,7 +0,0 @@ ---- -enable_list: - - yaml -skip_list: - - ignore-errors # We use ignore_errors for all the assert tasks, which should be acceptable - - schema # We want to allow single digit version numbers in a role's meta/main.yml file. This is allowed as per https://galaxy.ansible.com/docs/contributing/creating_role.html and https://galaxy.ansible.com/api/v1/platforms/?page=6. - - name[template] # Allow templating inside name. During dev and qa, it should be possible to identify cases where it doesn't work diff --git a/roles/sap_ha_set_netweaver/.yamllint.yml b/roles/sap_ha_set_netweaver/.yamllint.yml deleted file mode 100644 index 57ef427c1..000000000 --- a/roles/sap_ha_set_netweaver/.yamllint.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -# Based on ansible-lint config -extends: default - -rules: - braces: {max-spaces-inside: 1, level: error} - brackets: {max-spaces-inside: 1, level: error} -# colons: {max-spaces-after: -1, level: error} -# commas: {max-spaces-after: -1, level: error} - comments: disable - comments-indentation: disable -# document-start: disable -# empty-lines: {max: 3, level: error} -# hyphens: {level: error} -# indentation: disable -# key-duplicates: enable - line-length: disable -# new-line-at-end-of-file: disable -# new-lines: {type: unix} -# trailing-spaces: disable - truthy: disable From c8915daee9fb6c1409ef3a34bda1498097919180 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Mon, 17 Jul 2023 13:57:59 +0200 Subject: [PATCH 110/128] sap_ha_set_netweaver: Also remove related entries from README.md of the repo --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 31b7586ac..29c342319 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ Within this Ansible Collection, there are various Ansible Roles and no custom An | [sap_general_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_general_preconfigure) | configure general OS settings for SAP software | | [sap_ha_install_hana_hsr](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_install_hana_hsr) | install SAP HANA System Replication | | [sap_ha_pacemaker_cluster](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_pacemaker_cluster) | install and configure pacemaker and SAP resources | -| [sap_ha_set_netweaver](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_set_netweaver) | configure HA/DR for SAP NetWeaver | | [sap_hana_install](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_install) | install SAP HANA via HDBLCM | | [sap_hana_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_preconfigure) | configure settings for SAP HANA database server | | [sap_hostagent](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hostagent) | install SAP Host Agent | @@ -73,7 +72,6 @@ The logic has been separated to support a flexible execution of the different st | [sap_general_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_general_preconfigure) | [![Ansible Lint for sap_general_preconfigure](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_general_preconfigure.yml/badge.svg)](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_general_preconfigure.yml) | | [sap_ha_install_hana_hsr](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_install_hana_hsr) | [![Ansible Lint for sap_ha_install_hana_hsr](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_ha_install_hana_hsr.yml/badge.svg)](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_ha_install_hana_hsr.yml) | | [sap_ha_pacemaker_cluster](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_pacemaker_cluster) | [![Ansible Lint for sap_ha_pacemaker_cluster](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml/badge.svg)](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml) | -| [sap_ha_set_netweaver](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_ha_set_netweaver) | N/A | | [sap_hana_install](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_install) | [![Ansible Lint for sap_hana_install](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_hana_install.yml/badge.svg)](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_hana_install.yml) | | [sap_hana_preconfigure](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hana_preconfigure) | [![Ansible Lint for sap_hana_preconfigure](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_hana_preconfigure.yml/badge.svg)](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_hana_preconfigure.yml) | | [sap_hostagent](https://github.com/sap-linuxlab/community.sap_install/tree/main/roles/sap_hostagent) | N/A | From c24d769bf41b7aed84c1a8184ec5de9318fe62f9 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:43:46 +0100 Subject: [PATCH 111/128] collection: docs update --- roles/sap_ha_pacemaker_cluster/README.md | 116 +++++++++++++++++++---- roles/sap_storage_setup/README.md | 18 ++-- 2 files changed, 107 insertions(+), 27 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index a90114166..e432b9feb 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -3,46 +3,124 @@ ![Ansible Lint for sap_ha_pacemaker_cluster](https://github.com/sap-linuxlab/community.sap_install/actions/workflows/ansible-lint-sap_ha_pacemaker_cluster.yml/badge.svg) -This role installs pacemaker cluster packages and configures the cluster and SAP cluster resources in a new pacemaker cluster. -The pacemaker installation and cluster setup is done through the `ha_cluster` Linux System Role. -Ansible role `sap_ha_pacemaker_cluster` is acting as a wrapper and takes care of the SAP environment parameter definitions, platform specific variables and additional steps to complete the SAP HA configuration in the pacemaker cluster. +Ansible Role for installation and configuration of Linux Pacemaker for High Availability of SAP Systems run on various Infrastructure Platforms. -:warning: Do **not** execute this role against already configured cluster nodes, -:warning: unless you know what you are doing and have prepared the role input variables accordingly! +## Scope -## Requirements +This Ansible Role provides: +- installation of Linux Pacemaker packages and dependencies +- configuration of Linux Pacemaker cluster with all relevant fencing agent and resource agent for an Infrastructure Platform and SAP Software (SAP HANA or SAP NetWeaver) +- setup and instantiation of Linux Pacemaker cluster (using `ha_cluster` Linux System Role) + +This Ansible Role has been tested for the following SAP Software Solution scenario deployments: +- SAP HANA Scale-up High Availability +- `Beta:` SAP NetWeaver (ABAP) AS ASCS and ERS High Availability +- `Experimental:` SAP NetWeaver (ABAP) AS PAS and AAS High Availability +- `Experimental:` SAP NetWeaver (JAVA) AS SCS and ERS High Availability -Target Systems: +This Ansible Role contains Infrastructure Platform specific alterations for: +- AWS EC2 Virtual Servers +- `Beta:` Microsoft Azure Virtual Machines +- `Experimental:` Google Cloud Compute Engine Virtual Machine +- `Experimental:` IBM Cloud Virtual Server +- `Experimental:` IBM Power Virtual Server from IBM Cloud +- `Experimental:` IBM PowerVC hypervisor Virtual Machine -- Supported OS: RHEL 8.3+ -- access to High-Availability repository -- SAP HANA is installed and configured, for instance using the provided `sap_hana_*` Ansible roles in this repository +Please note, this Ansible Role `sap_ha_pacemaker_cluster` is acting as a wrapper and generates the parameter definitions for a given SAP System, Infrastructure Platform specific variables and other additional steps to complete the SAP High Availability setup using Linux Pacemaker clusters. -Ansible Control System: +### Warnings :warning: -- Ansible 2.9+ -- **Linux System Roles** collection from either source and minimum version: - - RHEL package: `rhel-system-roles-1.13.0-1` or later - - Red Hat Automation Hub: `rhel_system_roles 1.12.1` or later - - Ansible Galaxy: `fedora.linux_system_roles:1.13.0` or later +- :warning: Do **not** execute this Ansible Role against already configured Linux Pacemaker cluster nodes; unless you know what you are doing and have prepared the input variables for the Ansible Role according to / matching to the existing Linux Pacemaker setup! +- :warning: Infrastructure Platforms not explicitly listed as available/tested are very unlikely to work. ## Functionality _All of the following functionality is provided as **Technology Preview**._ -:warning: Platforms not explicitly listed may not work as expected. +### SAP HANA scale-up (performance-optimized) with SAP HANA System Replication, High Availability using Linux Pacemaker 2-node cluster + +| Platform | Usability | +| -------- | --------- | +| :heavy_check_mark: physical server | expected to work with any fencing method that is supported by the `ha_cluster` Linux System Role | +| :heavy_check_mark: OVirt VM | tested and working | +| :heavy_check_mark: AWS EC2 VS | platform detection and awscli setup included, tested and expected to work | -### 2-node pacemaker cluster with SAP HANA System Replication +### SAP NetWeaver (ABAP) ASCS and ERS, High Availability using Linux Pacemaker 2-node cluster | Platform | Usability | | -------- | --------- | | :heavy_check_mark: physical server | expected to work with any fencing method that is supported by the `ha_cluster` Linux System Role | | :heavy_check_mark: OVirt VM | tested and working | | :heavy_check_mark: AWS EC2 VS | platform detection and awscli setup included, tested and expected to work | -| IBM Cloud VS | platform detection included, tested and working (unsupported at this point in time) | + +## Requirements + +The Ansible Role requires the SAP HANA Database Server or SAP NetWeaver Application Server software installation to already exist on the target host/s. + +The target host must have: +- OS version and license - RHEL4SAP (HA and US) 8.4+ +- OS package repositories enabled - SAP and High Availability + +> _N.B. At this time SLES4SAP functionality is not available, until `crmsh` commands are provided in dependency Ansible Role [`ha_cluster`](https://github.com/linux-system-roles/ha_cluster)_ + +The Ansible Control System (where Ansible is executed from) must have: +- Ansible Core 2.9+ +- Access to dependency Ansible Collections and Ansible Roles: + - **Upstream**: + - Ansible Collection [`community.sap_install` from Ansible Galaxy](https://galaxy.ansible.com/community/sap_install) version `1.3.0` or later + - Ansible Collection [`fedora.linux_system_roles` from Ansible Galaxy](https://galaxy.ansible.com/fedora/linux_system_roles) version `1.20.0` or later + - **Supported (Downstream)** via Red Hat Ansible Automation Platform (AAP) license: + - Ansible Collection [`redhat.sap_install` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/sap_install) version `1.3.0` or later + - Ansible Collection [`redhat.rhel_system_roles` from Red Hat Ansible Automation Platform Hub](https://console.redhat.com/ansible/automation-hub/repo/published/redhat/rhel_system_roles) version `1.20.0` or later + - **Supported (Downstream)** via RHEL4SAP license: + - RHEL System Roles for SAP RPM Package `rhel-system-roles-3.6.0` or later + - RHEL System Roles RPM Package `rhel-system-roles-1.20.0` or later + +## Prerequisites + +All SAP Software must be installed, and all remote/file storage mounts must be available with correct permissions defined by SAP documentation. For SAP HANA High Availability, SAP HANA System Replication must already be installed. + +In addition, the following network ports must be available: + +| **SAP Technical Application** | **Component** | **Port** | +| --- | --- | --- | +| SAP HANA Sytem Replication | | | +| | hdbnameserver, used for log and data shipping from a primary site to a secondary site.
System DB port number plus 10,000 | 4``01 | +| | hdbnameserver, unencrypted metadata communication between sites.
System DB port number plus 10,000 | 4``02 | +| | hdbnameserver, used for encrypted metadata communication between sites.
System DB port number plus 10,000 | 4``06 | +| | hdbindexserver, used for first MDC Tenant database schema | 4``03 | +| | hdbxsengine, used for SAP HANA XSC/XSA | 4``07 | +| | hdbscriptserver, used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000 | 4``40-97 | +| | hdbxsengine, used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000 | 4``40-97 | +| Linux Pacemaker | | | +| | pcsd | 2224 (TCP), cluster nodes requirement for node-to-node communication | +| | pacemaker | 3121 (TCP), cluster nodes requirement for Pacemaker Remote service daemon | +| | corosync | 5404-5412 (UDP), cluster nodes requirement for node-to-node communcation | + +## Execution Flow + +The Ansible Role is sequential: +- Validate input Ansible Variables +- Identify host's Infrastructure Platform +- Generate Linux Pacemaker definition for given Infrastructure Platform and SAP Software +- Execute `ha_cluster` Ansible Role with Linux Pacemaker definition +- Instantiate Linux Pacemaker cluster + +## Sample + +Please see a full sample using multiple hosts to create an SAP S/4HANA Distributed deployment in the [/playbooks](../../playbooks/) directory of the Ansible Collection `sap_install`. + +## License + +Apache 2.0 + +## Author Information + +Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions +--- ## Role Input Parameters diff --git a/roles/sap_storage_setup/README.md b/roles/sap_storage_setup/README.md index 86b4cea60..67b76cc1b 100644 --- a/roles/sap_storage_setup/README.md +++ b/roles/sap_storage_setup/README.md @@ -2,10 +2,6 @@ Ansible Role for preparing a host with the storage requirements of an SAP System (prior to software installation) -## Requirements - -The Ansible Role requires the `community.general` Ansible Collection (uses the `lvg`, `lvol` and `filesystem` Ansible modules). Before using this role, please make sure that the required collections are installed, for example by using the following command: `ansible-galaxy install community.general` - ## Scope This Ansible Role provides: @@ -13,13 +9,19 @@ This Ansible Role provides: - remote/file storage mount (and subdirectories as required) - swap file or swap partition -This role has been tested for the following SAP software deployment types: +This Ansible Role has been tested for the following SAP software deployment types: - SAP HANA Scale-up, Scale-out and Scale-up High Availability - SAP NetWeaver AS in Sandbox (Two-Tier/OneHost), Standard (Three-Tier/DualHost), Distributed (Multi-Tier) and Distributed High Availability This Ansible Role is agnostic, and will run on any Infrastructure Platform. Only LVM is used for local/block storage, to allow for further expansion if the SAP System requires further storage space in the future. -Please note, while this Ansible Role has protection against overwrite of existing disks and filesystems - sensibile review and care is required for any automation of disk storage. Please review the documentation and samples/examples carefully. It is strongly suggested to run the Ansible Playbook calling this Ansible Role, with `ansible-playbook --check` for Check Mode. +Please note, while this Ansible Role has protection against overwrite of existing disks and filesystems - sensibile review and care is required for any automation of disk storage. Please review the documentation and samples/examples carefully. It is strongly suggested to initially execute the Ansible Playbook calling this Ansible Role, with `ansible-playbook --check` for Check Mode - this will perform no changes to the host and show which changes would be made. + +## Requirements + +The Ansible Role requires the `community.general` Ansible Collection (uses the `lvg`, `lvol` and `filesystem` Ansible Modules). + +Before using this Ansible Role, please make sure that the required collections are installed; for example, by using the command `ansible-galaxy install community.general` ## Prerequisites @@ -27,7 +29,7 @@ All local/block storage volumes must be attached to the host, and all remote/fil ## Variables and Parameters -There are 3 critical variables are: +The 3 critical variables are: - `sap_storage_setup_definition` - a list with a dictionary for each mountpoint (e.g. /hana/data) for the host - `sap_storage_setup_host_type` - a list which defines SAP Software on the host (e.g. list containing both hana_primary and nwas_abap_ascs values if creating a Sandbox Two-Tier/OneHost) - `sap_storage_setup_sid` - a string with the SAP System ID of the logical system (e.g. D01) @@ -48,7 +50,7 @@ Please see a full sample using multiple hosts to create an SAP S/4HANA Distribut ## License -Apache license 2.0 +Apache 2.0 ## Author Information From 97d6840c37e257261a9ddee658466f88beb13198 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 17 Jul 2023 17:53:12 +0100 Subject: [PATCH 112/128] collection: table text resize --- roles/sap_ha_pacemaker_cluster/README.md | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index e432b9feb..8d9858c63 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -82,20 +82,20 @@ All SAP Software must be installed, and all remote/file storage mounts must be a In addition, the following network ports must be available: -| **SAP Technical Application** | **Component** | **Port** | -| --- | --- | --- | -| SAP HANA Sytem Replication | | | -| | hdbnameserver, used for log and data shipping from a primary site to a secondary site.
System DB port number plus 10,000 | 4``01 | -| | hdbnameserver, unencrypted metadata communication between sites.
System DB port number plus 10,000 | 4``02 | -| | hdbnameserver, used for encrypted metadata communication between sites.
System DB port number plus 10,000 | 4``06 | -| | hdbindexserver, used for first MDC Tenant database schema | 4``03 | -| | hdbxsengine, used for SAP HANA XSC/XSA | 4``07 | -| | hdbscriptserver, used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000 | 4``40-97 | -| | hdbxsengine, used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000 | 4``40-97 | -| Linux Pacemaker | | | -| | pcsd | 2224 (TCP), cluster nodes requirement for node-to-node communication | -| | pacemaker | 3121 (TCP), cluster nodes requirement for Pacemaker Remote service daemon | -| | corosync | 5404-5412 (UDP), cluster nodes requirement for node-to-node communcation | +| **SAP Technical Application and Component** | **Port** | +| --- | --- | +| **_SAP HANA Sytem Replication_** | | +| hdbnameserver
used for log and data shipping from a primary site to a secondary site.
System DB port number plus 10,000
| 4``01 | +| hdbnameserver
unencrypted metadata communication between sites.
System DB port number plus 10,000
| 4``02 | +| hdbnameserver
used for encrypted metadata communication between sites.
System DB port number plus 10,000
| 4``06 | +| hdbindexserver
used for first MDC Tenant database schema | 4``03 | +| hdbxsengine
used for SAP HANA XSC/XSA | 4``07| +| hdbscriptserver
used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000
| 4``40-97 | +| hdbxsengine
used for log and data shipping from a primary site to a secondary site.
Tenant port number plus 10,000
| 4``40-97 | +| **_Linux Pacemaker_** | | +| pcsd
cluster nodes requirement for node-to-node communication | 2224 (TCP)| +| pacemaker
cluster nodes requirement for Pacemaker Remote service daemon | 3121 (TCP) | +| corosync
cluster nodes requirement for node-to-node communcation | 5404-5412 (UDP) | ## Execution Flow From bb5fe6c276ab8e2251e7e073f1fda26ad91e2dd7 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Mon, 17 Jul 2023 18:18:08 +0100 Subject: [PATCH 113/128] collection: samples append install media var examples --- playbooks/sample-sap-swpm-default-mode.yml | 4 ++-- ...p-swpm-advanced-mode-s4hana-onehost-install.yml} | 11 +++++++++++ ...e-variables-sap-swpm-advanced-templates-mode.yml | 12 ++++++++++++ ...ap-swpm-default-mode-bw4hana-onehost-install.yml | 10 ++++++++++ ...default-mode-s4hana-distributed-ascs-install.yml | 9 +++++++++ ...fault-mode-s4hana-distributed-dbload-install.yml | 11 +++++++++++ ...-default-mode-s4hana-distributed-ers-install.yml | 9 +++++++++ ...-default-mode-s4hana-distributed-pas-install.yml | 9 +++++++++ ...sap-swpm-default-mode-s4hana-onehost-install.yml | 10 ++++++++++ ...sap-swpm-default-mode-s4hana-onehost-restore.yml | 13 +++++++++++++ ...fault-mode-solman-hana-abap-onehost-install.yml} | 11 +++++++++++ ...fault-mode-solman-hana-java-onehost-install.yml} | 11 +++++++++++ ...swpm-default-mode-webdisp-standalone-install.yml | 9 +++++++++ ...le-variables-sap-swpm-default-templates-mode.yml | 11 +++++++++++ 14 files changed, 138 insertions(+), 2 deletions(-) rename playbooks/vars/{sample-variables-sap-swpm-advanced-mode-s4hana-install.yml => sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml} (87%) rename playbooks/vars/{sample-variables-sap-swpm-default-mode-solman-abap-onehost-install.yml => sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml} (82%) rename playbooks/vars/{sample-variables-sap-swpm-default-mode-solman-java-onehost-install.yml => sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml} (85%) diff --git a/playbooks/sample-sap-swpm-default-mode.yml b/playbooks/sample-sap-swpm-default-mode.yml index d16fe750d..e0056b3ed 100644 --- a/playbooks/sample-sap-swpm-default-mode.yml +++ b/playbooks/sample-sap-swpm-default-mode.yml @@ -19,8 +19,8 @@ # file: ./sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install # file: ./sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml # file: ./sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml -# file: ./sample-variables-sap-swpm-default-mode-solman-abap-onehost-install.yml -# file: ./sample-variables-sap-swpm-default-mode-solman-java-onehost-install.yml +# file: ./sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml +# file: ./sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml # file: ./sample-variables-sap-swpm-default-mode-system-rename.yml # file: ./sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml diff --git a/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-install.yml b/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml similarity index 87% rename from playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-install.yml rename to playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml index c7aeabadd..de9130313 100644 --- a/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-advanced-mode-s4hana-onehost-install.yml @@ -1,5 +1,16 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: "saphana" + + # NOTE: Values in Dictionary Keys for instance numbers must be string using '01' single quote, otherwise SAP SWPM will crash sap_swpm_ansible_role_mode: "advanced" diff --git a/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml b/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml index 24aba9806..98d1b61ac 100644 --- a/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml +++ b/playbooks/vars/sample-variables-sap-swpm-advanced-templates-mode.yml @@ -1,5 +1,17 @@ --- +# Detect SAP HANA and SAP NetWeaver software +# Set vars: on each Ansible Task depending on chosen template +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +#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: "saphana" + + # NOTE: Values in Dictionary Keys for instance numbers must be string using '01' single quote, otherwise SAP SWPM will crash sap_swpm_templates_install_dictionary: diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml index 0c21ecaf9..7e68405ae 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-bw4hana-onehost-install.yml @@ -1,5 +1,15 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: "saphana" + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_OneHost:BW4HANA20.CORE.HDB.ABAP diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml index 96f8e65a1..ca0e37761 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ascs-install.yml @@ -1,5 +1,14 @@ --- +# Detect SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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 + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_ASCS:S4HANA2020.CORE.HDB.ABAP #NW_ABAP_ASCS:S4HANA2020.CORE.HDB.ABAPHA diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml index 8ca2b0bab..44fcf69d0 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-dbload-install.yml @@ -1,5 +1,16 @@ --- +# Detect SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: "saphana" +#- sap_install_media_detect_export: "s4hana" # Not required for SAP S/4HANA when using archive download basket + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_DB:S4HANA2020.CORE.HDB.ABAP #NW_ABAP_DB:S4HANA2020.CORE.HDB.ABAPHA diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml index 725eb005f..094e7b8f7 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-ers-install.yml @@ -1,5 +1,14 @@ --- +# Detect SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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 + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ERS:S4HANA2020.CORE.HDB.ABAPHA diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml index 8c8c2d091..414285f8a 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-distributed-pas-install.yml @@ -1,5 +1,14 @@ --- +# Detect SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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 + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_CI:S4HANA2020.CORE.HDB.ABAP #NW_ABAP_CI:S4HANA2020.CORE.HDB.ABAPHA diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml index 593dfed2a..ffe0bd345 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-install.yml @@ -1,5 +1,15 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: "saphana" + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_OneHost:S4HANA2020.CORE.HDB.ABAP diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml index cb6f5a2b3..2706037ce 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-s4hana-onehost-restore.yml @@ -1,5 +1,18 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: "saphana" +#sap_install_media_detect_export: +#sap_install_media_detect_backup_directory: +#sap_install_media_detect_backup: + # Product ID for New Installation sap_swpm_product_catalog_id: NW_ABAP_OneHost:S4HANA2020.CORE.HDB.CP diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-abap-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml similarity index 82% rename from playbooks/vars/sample-variables-sap-swpm-default-mode-solman-abap-onehost-install.yml rename to playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml index 7a9df6d33..7e017b89f 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-abap-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-abap-onehost-install.yml @@ -1,5 +1,16 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +sap_install_media_detect_db: "saphana" +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_export: "sapsolman_abap" + # Product ID for Solman New Installation sap_swpm_product_catalog_id: NW_ABAP_OneHost:SOLMAN72SR2.ABAP.HDB.PD diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-java-onehost-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml similarity index 85% rename from playbooks/vars/sample-variables-sap-swpm-default-mode-solman-java-onehost-install.yml rename to playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml index f6b040adf..96e9a8116 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-java-onehost-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-solman-hana-java-onehost-install.yml @@ -1,5 +1,16 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +sap_install_media_detect_db: "saphana" +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_export: "sapnwas_java" + # Product ID for Solman New Installation sap_swpm_product_catalog_id: NW_Java_OneHost:SOLMAN72SR2.JAVA.HDB.PD diff --git a/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml b/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml index f0f9be133..d9f7b48d2 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-mode-webdisp-standalone-install.yml @@ -1,5 +1,14 @@ --- +# Detect SAP HANA and SAP NetWeaver software +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +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: true + # Product ID for New Installation sap_swpm_product_catalog_id: NW_Webdispatcher:NW750.IND.PD diff --git a/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml b/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml index 94e068d71..ac5bfc753 100644 --- a/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml +++ b/playbooks/vars/sample-variables-sap-swpm-default-templates-mode.yml @@ -1,5 +1,16 @@ --- +# Detect SAP HANA and SAP NetWeaver software +# Set vars: on each Ansible Task depending on chosen template +sap_install_media_detect_directory: "/software" +sap_install_media_detect_source: local_dir +#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: "saphana" + # Override any variable set in sap_swpm_inifile_dictionary sap_swpm_master_password: NewPass$321 sap_swpm_ddic_000_password: "NewPass$321" From 4b1d0efb1c2080816cd5973f2b946b4f9e812c0d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Tue, 18 Jul 2023 17:21:01 +0000 Subject: [PATCH 114/128] sap_ha_pacemaker_cluster: ibmpower updates --- .../platform/ascertain_platform_type.yml | 4 +- ...ct_vars_vip_resources_cloud_aws_ec2_vs.yml | 2 +- ...s_vip_resources_cloud_ibmcloud_powervs.yml | 20 +++++++ ...ct_vars_vip_resources_cloud_msazure_vm.yml | 2 +- ...uct_vars_vip_resources_hyp_ibmpower_vm.yml | 20 +++++++ .../vars/platform_hyp_ibmpower_lpar.yml | 6 --- .../vars/platform_hyp_ibmpower_vm.yml | 52 +++++++++++++++++++ 7 files changed, 96 insertions(+), 10 deletions(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml delete mode 100644 roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_lpar.yml create mode 100644 roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml index 4c242c0f7..b35399f91 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/ascertain_platform_type.yml @@ -41,7 +41,7 @@ # TODO: detection based on multiple facts and providing one standard # name for use as platform type in related include files -# cloud_aliyun_ecs_vm, cloud_aws_ec2_vs, cloud_gcp_ce_vm, cloud_ibmcloud_powervs, cloud_ibmcloud_vs, cloud_msazure_vm, hyp_ibmpower_lpar, hyp_redhat_ocp_virt_vm, hyp_redhat_rhel_kvm_vm, hyp_vmware_vsphere_vm +# cloud_aliyun_ecs_vm, cloud_aws_ec2_vs, cloud_gcp_ce_vm, cloud_ibmcloud_powervs, cloud_ibmcloud_vs, cloud_msazure_vm, hyp_ibmpower_vm, hyp_redhat_ocp_virt_vm, hyp_redhat_rhel_kvm_vm, hyp_vmware_vsphere_vm - name: "SAP HA Prepare Pacemaker - Check if platform is Amazon Web Services EC2 Virtual Server" @@ -102,7 +102,7 @@ # - ansible_architecture == "ppc64le" # - '"ibmcloud" not in __sap_ha_pacemaker_cluster_power_rsct_hscid.stdout' # ansible.builtin.set_fact: -# __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_lpar +# __sap_ha_pacemaker_cluster_platform: hyp_ibmpower_vm #- name: "SAP HA Prepare Pacemaker - Check if platform is VMware vSphere" # when: diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml index 290f726eb..6e99cef8f 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_aws_ec2_vs.yml @@ -1,7 +1,7 @@ --- # Reminder: This file is included in a loop over a dictionary. -- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS floating IP (dev/test only)" +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP (dev/test only)" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml new file mode 100644 index 000000000..306036c53 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_ibmcloud_powervs.yml @@ -0,0 +1,20 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __resource_vip: + id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" + instance_attrs: + - attrs: + - name: ip + value: "{{ vip_list_item.value }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or + (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and + 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml index e61061d9e..de0a728ed 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_msazure_vm.yml @@ -1,7 +1,7 @@ --- # Reminder: This file is included in a loop over a dictionary. -- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS floating IP (dev/test only)" +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" ansible.builtin.set_fact: __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml new file mode 100644 index 000000000..306036c53 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_hyp_ibmpower_vm.yml @@ -0,0 +1,20 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __resource_vip: + id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" + instance_attrs: + - attrs: + - name: ip + value: "{{ vip_list_item.value }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or + (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and + 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_lpar.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_lpar.yml deleted file mode 100644 index 4b75948e9..000000000 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_lpar.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# Variables specific on IBM Power hypervisor -# TODO: rename this file to match the actual "chassis_asset_tag" output -# TODO: make sure to first respect 'ha_cluster' native variables -sap_ha_pacemaker_cluster_fence_agent_packages: - - fence-agents-ibm-powervs diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml new file mode 100644 index 000000000..1cba10cae --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml @@ -0,0 +1,52 @@ +--- +# Variables specific on IBM PowerVM hypervisor, Virtual Machines (LPAR) +# TODO: rename this file to match the actual "chassis_asset_tag" output +# TODO: make sure to first respect 'ha_cluster' native variables + +sap_ha_pacemaker_cluster_fence_agent_packages: + - fence-agents-lpar + +#sap_ha_pacemaker_cluster_platform_extra_packages: +# - + +__sap_ha_pacemaker_cluster_repos: + - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-e4s-rpms" + name: High Availability E4S (4-Year) for Power, little endian +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-eus-rpms" +# name: High Availability EUS (2-Year) for Power, little endian +# - id: "rhel-{{ ansible_distribution_major_version }}-for-{{ ansible_architecture }}-highavailability-rpms" +# name: High Availability for Power, little endian + +# Predefine +__sap_ha_pacemaker_cluster_ibmpower_vm_hosts: [] + + +sap_ha_pacemaker_cluster_stonith_default: + agent: "stonith:fence_lpar" + options: + ipaddr: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host }}" + ipport: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_port }}" + login: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login }}" + password: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_login_password }}" + hmc_version: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host_version | default('4') }}" + plug: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_uuid }}" + + +sap_ha_pacemaker_cluster_fence_options: + pcmk_reboot_retries: 4 + pcmk_reboot_timeout: 600 + pcmk_monitor_timeout: 600 + pcmk_status_timeout: 60 + power_timeout: 240 + + +# Platform specific VIP handling +sap_ha_pacemaker_cluster_vip_method: ipaddr +sap_ha_pacemaker_cluster_vip_resource_group_name: vipgroup + +__sap_ha_pacemaker_cluster_available_vip_agents: + + # IPaddr2 requires a Virtual IP within a common Network (i.e. 1 VLAN / 1 VPC / 1 VNet), one or more Subnets may be used + # With this design restriction, IPaddr2 is only to be used for High Availability within a single location (i.e. 1 Availability Zone / Datacenter / Location within 1 Region) + ipaddr: + agent: "ocf:heartbeat:IPaddr2" From 5e61931f4e0f8c3b4bedc0ef56b1efd50760d49e Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 19 Jul 2023 10:10:03 +0200 Subject: [PATCH 115/128] sap_hana_preconfigure: use the ibm-power-managed-X package instead of a detailed package list for ppc64le --- roles/sap_hana_preconfigure/vars/RedHat_8.yml | 24 +------------------ roles/sap_hana_preconfigure/vars/RedHat_9.yml | 24 +------------------ 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/roles/sap_hana_preconfigure/vars/RedHat_8.yml b/roles/sap_hana_preconfigure/vars/RedHat_8.yml index 0c14deb62..d87d7d1f0 100644 --- a/roles/sap_hana_preconfigure/vars/RedHat_8.yml +++ b/roles/sap_hana_preconfigure/vars/RedHat_8.yml @@ -268,29 +268,7 @@ __sap_hana_preconfigure_packages_min_install: __sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' __sap_hana_preconfigure_required_ppc64le: - - librtas - - src - - rsct.core.utils - - rsct.core - - rsct.basic - - rsct.opt.storagerm - - devices.chrp.base.ServiceRM - - DynamicRM - - ncurses-libs - - readline - - sqlite - - sg3_utils - - libgcc - - libstdc++ - - zlib - - iprutils - - lsvpd - - libvpd - - libservicelog - - servicelog - - powerpc-utils - - ppc64-diag - - IBMinvscout + - ibm-power-managed-8 # Network related kernel parameters as set in SAP Note 2382421: __sap_hana_preconfigure_kernel_parameters_default: diff --git a/roles/sap_hana_preconfigure/vars/RedHat_9.yml b/roles/sap_hana_preconfigure/vars/RedHat_9.yml index 342913caa..373b22e41 100644 --- a/roles/sap_hana_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_hana_preconfigure/vars/RedHat_9.yml @@ -238,29 +238,7 @@ __sap_hana_preconfigure_packages_min_install: __sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' __sap_hana_preconfigure_required_ppc64le: - - librtas - - src - - rsct.core.utils - - rsct.core - - rsct.basic - - rsct.opt.storagerm - - devices.chrp.base.ServiceRM - - DynamicRM - - ncurses-libs - - readline - - sqlite - - sg3_utils - - libgcc - - libstdc++ - - zlib - - iprutils - - lsvpd - - libvpd - - libservicelog - - servicelog - - powerpc-utils - - ppc64-diag - - IBMinvscout + - ibm-power-managed-9 # Network related kernel parameters as set in SAP Note 2382421: __sap_hana_preconfigure_kernel_parameters_default: From 44037f817b7d50d961f30ecdfc5bbef9a41e572c Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 19 Jul 2023 15:09:58 +0200 Subject: [PATCH 116/128] sap_general_preconfigure, sap_hana_preconfigure: Solve issue #407 --- roles/sap_general_preconfigure/README.md | 21 +++++++++++++ .../defaults/main.yml | 12 ++++++++ .../meta/argument_specs.yml | 24 +++++++++++++++ .../tasks/RedHat/assert-installation.yml | 17 +++++++++++ .../tasks/RedHat/installation.yml | 30 +++++++++++++++++-- .../vars/RedHat_7.yml | 27 +++++++++++++++++ .../vars/RedHat_8.0.yml | 3 ++ .../vars/RedHat_8.1.yml | 3 ++ .../vars/RedHat_8.2.yml | 3 ++ .../vars/RedHat_8.yml | 3 ++ .../vars/RedHat_9.yml | 3 ++ roles/sap_hana_preconfigure/vars/RedHat_8.yml | 2 +- roles/sap_hana_preconfigure/vars/RedHat_9.yml | 2 +- 13 files changed, 146 insertions(+), 4 deletions(-) diff --git a/roles/sap_general_preconfigure/README.md b/roles/sap_general_preconfigure/README.md index 5ddf95e2b..60a120d95 100644 --- a/roles/sap_general_preconfigure/README.md +++ b/roles/sap_general_preconfigure/README.md @@ -183,6 +183,27 @@ The default for this variable is set in the vars file which corresponds to the d The default is to install or check if the minimum package versions are installed as defined in the vars files.
Set to `false` if you do not install or check these minimum package versions.
+### sap_general_preconfigure_install_ibm_power_tools +- _Type:_ `bool` +- _Default:_ `true` + +Set this parameter to `false` to not install the IBM Power Systems service and productivity tools.
+See also SAP note 2679703.
+ +### sap_general_preconfigure_add_ibm_power_repo +- _Type:_ `bool` +- _Default:_ `true` + +Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages
+are already available on the local network). The IBM Power Systems service and productivity tools will only
+be installed if the variable `sap_general_preconfigure_install_ibm_power_tools` is set to `true`, which is the default.
+ +### sap_general_preconfigure_ibm_power_repo_url +- _Type:_ `str` +- _Default:_ `'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm'` + +URL for the IBM Power Systems service and productivity tools, see https://www.ibm.com/support/pages/service-and-productivity-tools
+ ### sap_general_preconfigure_update - _Type:_ `bool` - _Default:_ `false` diff --git a/roles/sap_general_preconfigure/defaults/main.yml b/roles/sap_general_preconfigure/defaults/main.yml index d2c70a552..e5a1829e9 100644 --- a/roles/sap_general_preconfigure/defaults/main.yml +++ b/roles/sap_general_preconfigure/defaults/main.yml @@ -82,6 +82,18 @@ sap_general_preconfigure_min_package_check: true # The default is to install or check if the minimum package versions are installed as defined in the vars files. # Set to `false` if you do not install or check these minimum package versions. +sap_general_preconfigure_install_ibm_power_tools: true +# Set this parameter to `false` to not install the IBM Power Systems service and productivity tools. +# See also SAP note 2679703. + +sap_general_preconfigure_add_ibm_power_repo: true +# Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages +# are already available on the local network). The IBM Power Systems service and productivity tools will only +# be installed if the variable `sap_general_preconfigure_install_ibm_power_tools` is set to `true`, which is the default. + +sap_general_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' +# URL for the IBM Power Systems service and productivity tools, see https://www.ibm.com/support/pages/service-and-productivity-tools + sap_general_preconfigure_update: false # By default, the role will not update the system, for avoiding an unintentional minor OS release update. # Set this parameter to `true` if you want to update your system to the latest package versions. diff --git a/roles/sap_general_preconfigure/meta/argument_specs.yml b/roles/sap_general_preconfigure/meta/argument_specs.yml index 86ed14dd9..ce48ec90d 100644 --- a/roles/sap_general_preconfigure/meta/argument_specs.yml +++ b/roles/sap_general_preconfigure/meta/argument_specs.yml @@ -179,6 +179,30 @@ argument_specs: required: false type: bool + sap_general_preconfigure_install_ibm_power_tools: + default: true + description: + - Set this parameter to `false` to not install the IBM Power Systems service and productivity tools. + - See also SAP note 2679703. + required: false + type: bool + + sap_general_preconfigure_add_ibm_power_repo: + default: true + description: + - Set this parameter to `false` if you do not want to add the IBM Power tools repository (e.g. because the packages + - are already available on the local network). The IBM Power Systems service and productivity tools will only + - be installed if the variable `sap_general_preconfigure_install_ibm_power_tools` is set to `true`, which is the default. + required: false + type: bool + + sap_general_preconfigure_ibm_power_repo_url: + default: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' + description: + - URL for the IBM Power Systems service and productivity tools, see https://www.ibm.com/support/pages/service-and-productivity-tools + required: false + type: str + sap_general_preconfigure_update: default: false description: diff --git a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml index dcdff29c6..74386b626 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml @@ -156,6 +156,23 @@ loop_var: line_item ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" +- name: Get install status of required IBM packages + ansible.builtin.shell: set -o pipefail && yum info installed {{ __sap_general_preconfigure_required_ppc64le | map('quote') | join(' ') }} | awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' + register: __sap_general_preconfigure_register_required_ppc64le_packages_assert + changed_when: no + +- name: Assert that all required IBM packages are installed + ansible.builtin.assert: + that: "'{{ line_item }}' in __sap_general_preconfigure_register_required_ppc64le_packages_assert.stdout_lines" + fail_msg: "FAIL: Package '{{ line_item }}' is not installed!" + success_msg: "PASS: Package '{{ line_item }}' is installed." + with_items: + - "{{ __sap_general_preconfigure_required_ppc64le }}" + loop_control: + loop_var: line_item + when: ansible_architecture == "ppc64le" + ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" + - name: Minimum required package version check when: - sap_general_preconfigure_min_package_check|bool diff --git a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml index 60789c18f..655cd4e8b 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml @@ -132,10 +132,36 @@ name: "{{ sap_general_preconfigure_packages }}" state: present +- name: Install the ibm-power-repo package + ansible.builtin.package: + name: "{{ sap_general_preconfigure_ibm_power_repo_url }}" + state: present + disable_gpg_check: True + when: + - ansible_architecture == "ppc64le" + - sap_general_preconfigure_install_ibm_power_tools | d(true) + - sap_general_preconfigure_add_ibm_power_repo | d(true) + +- name: Accept the license for the IBM Service and Productivity Tools + ansible.builtin.shell: LESS=+q /opt/ibm/lop/configure <<<'y' + when: + - ansible_architecture == "ppc64le" + - sap_general_preconfigure_install_ibm_power_tools | d(true) + - sap_general_preconfigure_add_ibm_power_repo | d(true) + +# Reason for noqa: Both yum and dnf support "state: latest" +- name: Install the IBM Service and Productivity Tools # noqa package-latest + ansible.builtin.package: + state: latest + name: "{{ __sap_general_preconfigure_required_ppc64le }}" + when: + - ansible_architecture == "ppc64le" + - sap_general_preconfigure_install_ibm_power_tools | d(true) + - name: Ensure that the minimum required package versions are installed when: - - sap_general_preconfigure_min_package_check|bool - - __sap_general_preconfigure_min_pkgs|d([]) + - sap_general_preconfigure_min_package_check | bool + - __sap_general_preconfigure_min_pkgs | d([]) block: - name: Create a list of minimum required package versions to be installed diff --git a/roles/sap_general_preconfigure/vars/RedHat_7.yml b/roles/sap_general_preconfigure/vars/RedHat_7.yml index 345f641eb..429c2ff39 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_7.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_7.yml @@ -116,6 +116,33 @@ __sap_general_preconfigure_packages_s390x: __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" +# As per https://www14.software.ibm.com/support/customercare/sas/f/lopdiags/home.html : +__sap_general_preconfigure_required_ppc64le: + - librtas + - src + - rsct.core.utils + - rsct.core + - rsct.basic + - rsct.opt.storagerm + - devices.chrp.base.ServiceRM + - DynamicRM + - ncurses-libs + - readline + - sqlite + - sg3_utils + - libgcc + - libstdc++ + - zlib + - iprutils + - lsvpd + - libvpd + - libservicelog + - servicelog + - powerpc-utils + - powerpc-utils-python + - ppc64-diag + - IBMinvscout + __sap_general_preconfigure_min_packages_7_2: __sap_general_preconfigure_min_packages_7_3: diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.0.yml b/roles/sap_general_preconfigure/vars/RedHat_8.0.yml index bd6eca124..b04e188b8 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.0.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.0.yml @@ -47,6 +47,9 @@ __sap_general_preconfigure_packages: - nfs-utils - bind-utils +__sap_general_preconfigure_required_ppc64le: + - ibm-power-managed-rhel8 + # SAP notes 2772999 (setup) and 2812427 (kernel): __sap_general_preconfigure_min_pkgs: - [ 'setup', '2.12.2-2.el8_0.1' ] diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.1.yml b/roles/sap_general_preconfigure/vars/RedHat_8.1.yml index dfb6b1558..a665d8d78 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.1.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.1.yml @@ -69,6 +69,9 @@ __sap_general_preconfigure_packages_s390x: __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" +__sap_general_preconfigure_required_ppc64le: + - ibm-power-managed-rhel8 + __sap_general_preconfigure_min_pkgs: - [ 'setup', '2.12.2-2.el8_1.1' ] diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.2.yml b/roles/sap_general_preconfigure/vars/RedHat_8.2.yml index d722756e2..61453a3b8 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.2.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.2.yml @@ -69,5 +69,8 @@ __sap_general_preconfigure_packages_s390x: __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" +__sap_general_preconfigure_required_ppc64le: + - ibm-power-managed-rhel8 + __sap_general_preconfigure_kernel_parameters_default: - { name: vm.max_map_count, value: '2147483647' } diff --git a/roles/sap_general_preconfigure/vars/RedHat_8.yml b/roles/sap_general_preconfigure/vars/RedHat_8.yml index 9112e5253..416cef098 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_8.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_8.yml @@ -81,5 +81,8 @@ __sap_general_preconfigure_packages_s390x: __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" +__sap_general_preconfigure_required_ppc64le: + - ibm-power-managed-rhel8 + __sap_general_preconfigure_kernel_parameters_default: - { name: vm.max_map_count, value: '2147483647' } diff --git a/roles/sap_general_preconfigure/vars/RedHat_9.yml b/roles/sap_general_preconfigure/vars/RedHat_9.yml index 1c1afd0e6..1b025cc48 100644 --- a/roles/sap_general_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_general_preconfigure/vars/RedHat_9.yml @@ -89,5 +89,8 @@ __sap_general_preconfigure_packages_s390x: __sap_general_preconfigure_packages: "{{ lookup('vars', '__sap_general_preconfigure_packages_' + ansible_architecture) }}" +__sap_general_preconfigure_required_ppc64le: + - ibm-power-managed-rhel9 + __sap_general_preconfigure_kernel_parameters_default: - { name: vm.max_map_count, value: '2147483647' } diff --git a/roles/sap_hana_preconfigure/vars/RedHat_8.yml b/roles/sap_hana_preconfigure/vars/RedHat_8.yml index d87d7d1f0..6982ceae3 100644 --- a/roles/sap_hana_preconfigure/vars/RedHat_8.yml +++ b/roles/sap_hana_preconfigure/vars/RedHat_8.yml @@ -268,7 +268,7 @@ __sap_hana_preconfigure_packages_min_install: __sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' __sap_hana_preconfigure_required_ppc64le: - - ibm-power-managed-8 + - ibm-power-managed-rhel8 # Network related kernel parameters as set in SAP Note 2382421: __sap_hana_preconfigure_kernel_parameters_default: diff --git a/roles/sap_hana_preconfigure/vars/RedHat_9.yml b/roles/sap_hana_preconfigure/vars/RedHat_9.yml index 373b22e41..58e2863d0 100644 --- a/roles/sap_hana_preconfigure/vars/RedHat_9.yml +++ b/roles/sap_hana_preconfigure/vars/RedHat_9.yml @@ -238,7 +238,7 @@ __sap_hana_preconfigure_packages_min_install: __sap_hana_preconfigure_ibm_power_repo_url: 'https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm' __sap_hana_preconfigure_required_ppc64le: - - ibm-power-managed-9 + - ibm-power-managed-rhel9 # Network related kernel parameters as set in SAP Note 2382421: __sap_hana_preconfigure_kernel_parameters_default: From 38cb703403e3fe7f7221fed5da11d14572c99427 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 19 Jul 2023 15:33:08 +0200 Subject: [PATCH 117/128] sap_swpm: Solve issue #353 --- .../tasks/swpm/swpm_inifile_generate_inifile_reuse.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 92698ea14..003a24130 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 @@ -8,15 +8,17 @@ mode: '0640' tags: sap_swpm_generate_inifile -# Check inifile for des25 +# 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" | grep des25 | wc -l + 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 -- name: SAP SWPM inifile_reuse mode - Check if inifile is reusable +# 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' From cdf0cd3a68ac33f57269ae87cfddebdb2024557d Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 19 Jul 2023 14:30:07 +0000 Subject: [PATCH 118/128] sap_ha_pacemaker_cluster: README adjustment and sync with arg specs --- roles/sap_ha_pacemaker_cluster/README.md | 37 +++++++++--------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index 8d9858c63..bcdc01acf 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -106,6 +106,15 @@ The Ansible Role is sequential: - Execute `ha_cluster` Ansible Role with Linux Pacemaker definition - Instantiate Linux Pacemaker cluster +## Tips + +### Disable automatic cluster start on boot + +By default the cluster services will automatically start on system boot. This can be disabled, for instance for the purpose of troubleshooting after a node had failed.
+The `ha_cluster` Linux System Role, which is used to configure the pacemaker cluster, provides a parameter to control this behavior.
+ +Permanently disable the automated start by adding `ha_cluster_start_on_boot: false` to the input variables when executing the role `sap_ha_pacemaker_cluster`. + ## Sample Please see a full sample using multiple hosts to create an SAP S/4HANA Distributed deployment in the [/playbooks](../../playbooks/) directory of the Ansible Collection `sap_install`. @@ -127,18 +136,8 @@ Red Hat for SAP Community of Practice, Janine Fuchs, IBM Lab for SAP Solutions Minimum required parameters: - [ha_cluster_hacluster_password](#ha_cluster_hacluster_password) -- [sap_hana_cluster_nodes](#sap_hana_cluster_nodes) - [sap_hana_instance_number](#sap_hana_instance_number) -- [sap_hana_sid](#sap_hana_sid) -- [sap_hana_vip](#sap_hana_vip) - -On cloud platforms additional parameters are required: -- AWS: `sap_ha_pacemaker_cluster_aws_*` variables -- AWS: `sap_ha_pacemaker_cluster_vip_update_rt` -- IBM Cloud: `sap_ha_pacemaker_cluster_ibmcloud_*` variables - ---- ### ha_cluster @@ -324,14 +323,6 @@ sap_ha_pacemaker_cluster_resource_defaults: resource-stickiness: 1000 ``` -### sap_ha_pacemaker_cluster_sap_type - -- _Type:_ `str` -- _Default:_ `saphana_scaleup` - -The SAP landscape to be installed.
-_Currently only SAP HANA scale-up is supported_
- ### sap_ha_pacemaker_cluster_vip_client_interface - _Type:_ `str` @@ -354,7 +345,7 @@ Customize the name of the resource managing the Virtual IP.
List one more routing table IDs for managing Virtual IP failover through routing table changes.
Required for VIP configuration in AWS EC2 environments.
-### sap_hana_cluster_nodes required +### sap_hana_cluster_nodes - _Type:_ `list` @@ -390,14 +381,14 @@ sap_hana_cluster_nodes: The instance number of the SAP HANA database which is role will configure in the cluster.
-### sap_hana_sid required +### sap_hana_sid - _Type:_ `str` -The SAP System ID of the instance that will be configured in the cluster.
-The SAP SID must follow SAP specifications - see SAP Note 1979280.
+The SAP HANA SID of the instance that will be configured in the cluster.
+The SID must follow SAP specifications - see SAP Note 1979280.
-### sap_hana_vip required +### sap_hana_vip - _Type:_ `dict` From 9cd304f6c25d32036c68d8a0585a58a47a40ef13 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Wed, 19 Jul 2023 14:51:03 +0000 Subject: [PATCH 119/128] sap_ha_pacemaker_cluster: issue-364 --- roles/sap_ha_pacemaker_cluster/README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/README.md b/roles/sap_ha_pacemaker_cluster/README.md index bcdc01acf..fa336e05c 100644 --- a/roles/sap_ha_pacemaker_cluster/README.md +++ b/roles/sap_ha_pacemaker_cluster/README.md @@ -108,12 +108,10 @@ The Ansible Role is sequential: ## Tips -### Disable automatic cluster start on boot +Check out the [role variables of the `ha_cluster` Linux System Role](https://github.com/linux-system-roles/ha_cluster/blob/main/README.md) for additional possible settings that can be applied when using the `sap_ha_pacemaker_cluster` role. -By default the cluster services will automatically start on system boot. This can be disabled, for instance for the purpose of troubleshooting after a node had failed.
-The `ha_cluster` Linux System Role, which is used to configure the pacemaker cluster, provides a parameter to control this behavior.
- -Permanently disable the automated start by adding `ha_cluster_start_on_boot: false` to the input variables when executing the role `sap_ha_pacemaker_cluster`. +For example:
+Adding `ha_cluster_start_on_boot: false` to disable the automatic start of cluster services on boot. ## Sample From fd47a59b63ea54ab82813f23d3effa15c281bd70 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Wed, 19 Jul 2023 17:47:31 +0200 Subject: [PATCH 120/128] sap_general_preconfigure, sap_hana_preconfigure: skip installation verification task for non-pp64le. --- .../tasks/RedHat/assert-installation.yml | 5 ++++- .../tasks/RedHat/assert-installation.yml | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml index 74386b626..e6edbefd7 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/assert-installation.yml @@ -157,9 +157,12 @@ ignore_errors: "{{ sap_general_preconfigure_assert_ignore_errors | d(false) }}" - name: Get install status of required IBM packages - ansible.builtin.shell: set -o pipefail && yum info installed {{ __sap_general_preconfigure_required_ppc64le | map('quote') | join(' ') }} | awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' + ansible.builtin.shell: | + set -o pipefail && yum info installed {{ __sap_general_preconfigure_required_ppc64le | map('quote') | join(' ') }} | + awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' register: __sap_general_preconfigure_register_required_ppc64le_packages_assert changed_when: no + when: ansible_architecture == "ppc64le" - name: Assert that all required IBM packages are installed ansible.builtin.assert: diff --git a/roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml b/roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml index 38d8025ba..b7a451869 100644 --- a/roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml +++ b/roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml @@ -82,9 +82,12 @@ ### # yum -y install ibm-power-managed-rhel7 ### - name: Get install status of required IBM packages - ansible.builtin.shell: set -o pipefail && yum info installed {{ __sap_hana_preconfigure_required_ppc64le | map('quote') | join(' ') }} | awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' + ansible.builtin.shell: | + set -o pipefail && yum info installed {{ __sap_hana_preconfigure_required_ppc64le | map('quote') | join(' ') }} | + awk '/Name/{n=$NF}/Version/{v=$NF}/Release/{r=$NF}/Description/{printf ("%s\n", n)}' register: __sap_hana_preconfigure_register_required_ppc64le_packages_assert changed_when: no + when: ansible_architecture == "ppc64le" - name: Assert that all required IBM packages are installed ansible.builtin.assert: From 72102df8ef764025a0abdf7283e2c1cc347fe331 Mon Sep 17 00:00:00 2001 From: sean-freeman <1815807+sean-freeman@users.noreply.github.com> Date: Thu, 20 Jul 2023 00:25:18 +0100 Subject: [PATCH 121/128] collection: prepare for v1.3.0 --- CHANGELOG.rst | 24 ++++++++++++++++--- README.md | 64 ++++++++++++++++++++++----------------------------- galaxy.yml | 2 +- 3 files changed, 49 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6291cdbd9..d5abe53ac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,13 +6,31 @@ community.sap_install Release Notes +v1.3.0 +====== + +Release Summary +--------------- + +| Release Date: 2023-04-25 +| sap_general_preconfigure: Updates for new IBM Power packages with RHEL +| sap_hana_preconfigure: Updates for new IBM Power packages with RHEL +| sap_hana_install: Default Log Mode to normal and not Overwrite +| sap_ha_pacemaker_cluster: Detection of and compatibility for additional Infrastructure Platforms +| sap_ha_pacemaker_cluster: SAP NetWeaver compatibility added +| sap_install_media_detect: Restructure and add execution controls +| sap_storage_setup: Overhaul/Rewrite with breaking changes +| sap_storage_setup: SAP NetWeaver and NFS compatibility added +| sap_swpm: Minor alterations from High Availability test scenarios +| collection: Sample Playbooks updated + v1.2.3 ====== Release Summary --------------- -| Release Date: 2022-04-25 +| Release Date: 2023-04-25 | sap_hana_preconfigure: Some modifications for HANA on RHEL 9 | sap_ha_pacemaker_cluster: Support for custom stonith resource definitions containing more than one element | sap_hana_preconfigure: Be more flexible with IBM service and productivity tools @@ -24,7 +42,7 @@ v1.2.2 Release Summary --------------- -| Release Date: 2022-02-01 +| Release Date: 2023-02-01 | Fix for sap_hana_preconfigure on SLES when tuned is not installed @@ -34,7 +52,7 @@ v1.2.1 Release Summary --------------- -| Release Date: 2022-01-26 +| Release Date: 2023-01-26 | A few minor fixes diff --git a/README.md b/README.md index 29c342319..22041e047 100644 --- a/README.md +++ b/README.md @@ -91,13 +91,32 @@ The logic has been separated to support a flexible execution of the different st There are various methods to execute the Ansible Collection, dependant on the use case. For more information, see [Execution examples with code samples](./docs/getting_started) and the summary below: -| Execution Scenario | Use Case | Target | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- | ------------------- | +| Execution Scenario | Use Case | Target | +| ---- | ---- | ---- | | Ansible Playbook
-> source Ansible Collection
-> execute Ansible Task
--> run Ansible Role
---> run Ansible Module for Shell (built-in)
---> ... | Complex executions with various interlinked activities;
run in parallel or sequentially | Localhost or Remote | ## Requirements, Dependencies and Testing -### Operating System requirements +## Testing with SAP Software Provisioning Manager (SWPM) + +Various SAP Software solutions have been extensively tested: + +- SAP HANA +- SAP NetWeaver AS (ABAP or JAVA) +- SAP S/4HANA AnyPremise 1809, 1909, 2020, 2021 + - One Host installation + - Dual Host installation + - Distributed installation + - High Availability installation + - System Copy (Homogeneous with SAP HANA Backup / Recovery) installation + - System Rename +- SAP BW/4HANA +- SAP Solution Manager 7.2 +- SAP Business Suite (i.e. ECC) +- SAP NetWeaver applications (e.g. GRC) +- SAP Web Dispatcher + +### Target host - Operating System requirements Designed for Linux operating systems, e.g. RHEL (7.x and 8.x) and SLES (15.x). @@ -113,41 +132,12 @@ N.B. The Ansible Collection works with SLES from version 15 SP3 and upwards, for - firewalld is used within the Ansible Collection. In SLES 15 SP3, firewalld became the replacement for nftables. See changelog [SLE-16300](https://www.suse.com/releasenotes/x86_64/SUSE-SLES/15-SP3/index.html#jsc-SLE-16300) - SELinux is used within the Ansible Collection. While introduced earlier with community support, full support for SELinux was provided as of SLES 15 SP3. See changelog [SLE-17307](https://www.suse.com/releasenotes/x86_64/SUSE-SLES/15-SP3/index.html#jsc-SLE-17307) -### Python requirements - -Python 3 from the execution/controller host. - -### Testing on execution/controller host - -**Tests with Ansible Core release versions:** - -- Ansible Core 2.11.5 community edition +### Execution/Controller host - Operating System requirements -**Tests with Python release versions:** - -- Python 3.9.7 (i.e. CPython distribution) - -**Tests with Operating System release versions:** - -- RHEL 8.4 -- macOS 11.6 (Big Sur), with Homebrew used for Python 3.x via PyEnv - -### Testing with SAP Software Provisioning Manager (SWPM) - -SAP SWPM Catalog Products which have been tested: - -- SAP S/4HANA AnyPremise 1809, 1909, 2020, 2021 - - One Host installation - - Dual Host installation - - Distributed installation - - High Availability installation - - System Copy (Homogeneous with SAP HANA Backup / Recovery) installation - - System Rename -- SAP B/4HANA -- SAP Solution Manager 7.2 -- SAP Business Suite (i.e. ECC) -- SAP NetWeaver applications (e.g. GRC) -- SAP Web Dispatcher +Execution of Ansible Playbooks using this Ansible Collection have been tested with: +- Python 3.9.7 and above (i.e. CPython distribution) +- Ansible Core 2.11.5 and above (included with optional installation of Ansible Community Edition 4.0 and above) +- OS: macOS with Homebrew, RHEL, SLES, and containers in Task Runners (e.g. Azure DevOps) ## License diff --git a/galaxy.yml b/galaxy.yml index f477709ca..45d526643 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -10,7 +10,7 @@ namespace: community name: sap_install # The version of the collection. Must be compatible with semantic versioning -version: 1.2.3 +version: 1.3.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md From 10e452dba402f9f2d9250acfe72998a9c3b11d14 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 11:28:03 +0200 Subject: [PATCH 122/128] sap_ha_pacemaker_cluster: GCP tasks --- ...uct_vars_vip_resources_cloud_gcp_ce_vm.yml | 42 +++++++++++++++++++ .../platform/preconfigure_cloud_gcp_ce_vm.yml | 39 +++++++++++++++++ .../vars/platform_cloud_gcp_ce_vm.yml | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml create mode 100644 roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_gcp_ce_vm.yml diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml new file mode 100644 index 000000000..54e21147a --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -0,0 +1,42 @@ +--- +# Reminder: This file is included in a loop over a dictionary. + +- name: "SAP HA Prepare Pacemaker - ipaddr resource agent - Add resource: OS network interface Virtual IP" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__resource_vip] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __resource_vip: + id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents['ipaddr'].agent }}" + instance_attrs: + - attrs: + - name: ip + value: "{{ vip_list_item.value }}" + when: + - sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - (sap_ha_pacemaker_cluster_vip_method == 'ipaddr') or + (__sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with is defined and + 'ipaddr' in __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].with) + +- name: "SAP HA Prepare Pacemaker - haproxy resource agent - Add resource: Google Cloud Load Balancing Internal passthrough Network Load Balancer (NLB L-4) for VIP routing when SAP HANA scale-up HA" + ansible.builtin.set_fact: + __sap_ha_pacemaker_cluster_resource_primitives: "{{ __sap_ha_pacemaker_cluster_resource_primitives + [__health_check] }}" + __sap_ha_pacemaker_cluster_vip_resource_id: "{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + vars: + __health_check: + id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" + agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" + instance_attrs: + - attrs: + - name: service + value: "haproxy" + - name: interval + value: "10s" + - name: timeout + value: "20s" + when: + - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) + - sap_ha_pacemaker_cluster_vip_method == 'gcp_nlb_reserved_ip_haproxy' + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_gcp_ce_vm.yml new file mode 100644 index 000000000..47b401867 --- /dev/null +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/preconfigure_cloud_gcp_ce_vm.yml @@ -0,0 +1,39 @@ +--- +# Requirement to enable the fencing resource to function. + +- name: "SAP HA Prepare Pacemaker - GCP Compute VM - haproxy package install" + ansible.builtin.package: + name: "haproxy" + state: present + +- name: "SAP HA Prepare Pacemaker - GCP Compute VM - haproxy listener configuration" + ansible.builtin.blockinfile: + state: present + insertafter: EOF + dest: /etc/haproxy/haproxy.cfg + marker_begin: "---- haproxy health check listener for SAP HANA ----" + marker_end: "----" + content: | + listen healthcheck_vip_hana + bind *:60000 + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 + +- name: "SAP HA Prepare Pacemaker - GCP Compute VM - haproxy service start and enable" + ansible.builtin.service: + name: "haproxy" + state: started + +- name: "SAP HA Prepare Pacemaker - haproxy resource agent - Verify haproxy binary path" + ansible.builtin.shell: | + which haproxy + register: __sap_ha_pacemaker_cluster_register_haproxy_path + changed_when: false + +- name: "SAP HA Prepare Pacemaker - haproxy resource agent - Verify haproxy config file listener (/etc/haproxy/haproxy.cfg) for SAP HANA" + ansible.builtin.shell: | + grep 'listen healthcheck_vip_hana' /etc/haproxy/haproxy.cfg + register: __sap_ha_pacemaker_cluster_register_haproxy_config + changed_when: false + when: + - sap_ha_pacemaker_cluster_host_type | select('search', 'hana') | length > 0 diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index af182b504..d2775d7d4 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -42,7 +42,7 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # Recommended method gcp_nlb_reserved_ip_haproxy: - agent: "ocf:heartbeat:haproxy" + agent: "ocf:service:haproxy" with: ipaddr # Alternative method From 06dd16c7fe940760f645fd23e9165d41079beb59 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 12:57:12 +0200 Subject: [PATCH 123/128] sap_ha_pacemaker_cluster: GCP haproxy resource fix --- .../construct_vars_vip_resources_cloud_gcp_ce_vm.yml | 11 +++++------ .../vars/platform_cloud_gcp_ce_vm.yml | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml index 54e21147a..5434e770b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/platform/construct_vars_vip_resources_cloud_gcp_ce_vm.yml @@ -27,14 +27,13 @@ __health_check: id: "hc_{{ sap_ha_pacemaker_cluster_vip_resource_name }}_{{ vip_list_item.key }}" agent: "{{ __sap_ha_pacemaker_cluster_available_vip_agents[sap_ha_pacemaker_cluster_vip_method].agent }}" - instance_attrs: - - attrs: - - name: service - value: "haproxy" + operations: + - action: monitor + attrs: - name: interval - value: "10s" + value: 10 - name: timeout - value: "20s" + value: 20 when: - __health_check.id is not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) - ('hc_' ~ sap_ha_pacemaker_cluster_vip_resource_name ~ '_' ~ vip_list_item.key) not in (__sap_ha_pacemaker_cluster_resource_primitives | map(attribute='id')) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index d2775d7d4..eeb44e738 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -42,7 +42,7 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # Recommended method gcp_nlb_reserved_ip_haproxy: - agent: "ocf:service:haproxy" + agent: "service:haproxy" with: ipaddr # Alternative method @@ -53,4 +53,4 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # heartbeat:gcp-vpc-move-route is the replacement of heartbeat:gcp-vpc-move-ip (which uses execution via GCloud CLI, and is itself a fork of external/gcp:route) gcp_vpc_move_route: agent: "ocf:heartbeat:gcp-vpc-move-route" - with: haproxy + with: gcp_nlb_reserved_ip_haproxy From 7b49038db5cf02bc07fc76f0edd9b771f7201d77 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 13:14:03 +0200 Subject: [PATCH 124/128] sap_ha_pacemaker_cluster: comment enhancement for more clarity --- .../sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index eeb44e738..0ad2a0c21 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -41,6 +41,9 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # Refer to SAP NetWeaver guidance, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address # Recommended method + # Use Linux Pacemaker resource class/standard (pcs resource standards) as + # 'service:' because this is an alias for selecting LSB/Systemd/Upstart dependent on OS + # https://clusterlabs.org/pacemaker/doc/2.1/Pacemaker_Explained/singlehtml/#system-services gcp_nlb_reserved_ip_haproxy: agent: "service:haproxy" with: ipaddr From a63728d4216b39cb43cbacf6c5716c4449e4c4a1 Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 13:24:35 +0200 Subject: [PATCH 125/128] sap_ha_pacemaker_cluster: GCP VIP preference adjustment --- .../vars/platform_cloud_gcp_ce_vm.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index 0ad2a0c21..42e98d609 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -32,14 +32,6 @@ __sap_ha_pacemaker_cluster_available_vip_agents: ipaddr: agent: "ocf:heartbeat:IPaddr2" - # Recommended method is to use an internal passthrough Network Load Balancer (NLB for TCP/UDP) and Reserved Static Internal IP Address, with host health check response using socat or HAProxy - # Alternative method is to use static route Virtual IP (outside VPC Subnet ranges) using VPC Routing Table - # Refer to Google Cloud Compute Engine Reserved Static Internal IP Address, https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address - # Refer to Google Cloud Load Balancing - Internal passthrough Network Load Balancer overview, https://cloud.google.com/load-balancing/docs/internal - # Refer to SAP HANA guidance 1, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address - # Refer to SAP HANA guidance 2, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#vip_implementation - # Refer to SAP NetWeaver guidance, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address - # Recommended method # Use Linux Pacemaker resource class/standard (pcs resource standards) as # 'service:' because this is an alias for selecting LSB/Systemd/Upstart dependent on OS @@ -56,4 +48,4 @@ __sap_ha_pacemaker_cluster_available_vip_agents: # heartbeat:gcp-vpc-move-route is the replacement of heartbeat:gcp-vpc-move-ip (which uses execution via GCloud CLI, and is itself a fork of external/gcp:route) gcp_vpc_move_route: agent: "ocf:heartbeat:gcp-vpc-move-route" - with: gcp_nlb_reserved_ip_haproxy + with: ipaddr From c907b02b1384eadb133150450b8a9d413ce464fa Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 15:08:19 +0200 Subject: [PATCH 126/128] sap_ha_pacemaker_cluster: separate stonith agent name from resource id --- .../sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml | 2 +- .../vars/platform_cloud_aws_ec2_vs.yml | 1 + .../sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml | 3 ++- .../vars/platform_cloud_ibmcloud_powervs.yml | 1 + .../vars/platform_cloud_ibmcloud_vs.yml | 1 + .../vars/platform_cloud_msazure_vm.yml | 1 + .../sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml | 1 + 7 files changed, 8 insertions(+), 2 deletions(-) diff --git a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml index c65140216..726792c9b 100644 --- a/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml +++ b/roles/sap_ha_pacemaker_cluster/tasks/construct_vars_stonith.yml @@ -40,7 +40,7 @@ __sap_ha_pacemaker_cluster_stonith_resource: "{{ __sap_ha_pacemaker_cluster_stonith_resource | default([]) + [__stonith_resource_element] }}" vars: __stonith_resource_element: - id: "res_{{ sap_ha_pacemaker_cluster_stonith_default.agent | split(':') | last }}" + id: "res_{{ sap_ha_pacemaker_cluster_stonith_default.id }}" agent: "{{ sap_ha_pacemaker_cluster_stonith_default.agent }}" instance_attrs: - attrs: |- diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml index fb531772f..9f226fb13 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_aws_ec2_vs.yml @@ -17,6 +17,7 @@ __sap_ha_pacemaker_cluster_repos: __sap_ha_pacemaker_cluster_aws_instances: [] sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_aws" agent: "stonith:fence_aws" options: access_key: "{{ sap_ha_pacemaker_cluster_aws_access_key_id }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index 42e98d609..e570ccd82 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -17,11 +17,12 @@ __sap_ha_pacemaker_cluster_repos: __sap_ha_pacemaker_cluster_gcp_hosts: [] sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_gce_{{ ansible_hostname }}" agent: "stonith:fence_gce" options: project: "{{ sap_ha_pacemaker_cluster_gcp_project }}" zone: "{{ sap_ha_pacemaker_cluster_gcp_region_zone }}" -# port: "{{ hostvars[node].ansible_hostname }}" + port: "{{ ansible_hostname }}" # Platform specific VIP handling sap_ha_pacemaker_cluster_vip_method: gcp_nlb_reserved_ip_haproxy # gcp_vpc_move_route diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml index 54b09937c..af35b0202 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_powervs.yml @@ -22,6 +22,7 @@ __sap_ha_pacemaker_cluster_ibmcloud_powervs_hosts: [] sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_ibm_powervs" agent: "stonith:fence_ibm_powervs" options: token: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml index f7e7c62da..5430a4608 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_ibmcloud_vs.yml @@ -21,6 +21,7 @@ __sap_ha_pacemaker_cluster_repos: __sap_ha_pacemaker_cluster_ibmcloud_hosts: [] sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_ibm_vpc" agent: "stonith:fence_ibm_vpc" options: apikey: "{{ sap_ha_pacemaker_cluster_ibmcloud_api_key }}" diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml index dab111f39..2d056bf12 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_msazure_vm.yml @@ -20,6 +20,7 @@ __sap_ha_pacemaker_cluster_msazure_hosts: [] # Fencing via MS Azure Managed Service Identity (MSI) per cluster node sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_azure_arm" agent: "stonith:fence_azure_arm" options: msi: true diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml index 1cba10cae..806d5eb42 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_hyp_ibmpower_vm.yml @@ -22,6 +22,7 @@ __sap_ha_pacemaker_cluster_ibmpower_vm_hosts: [] sap_ha_pacemaker_cluster_stonith_default: + id: "res_fence_lpar" agent: "stonith:fence_lpar" options: ipaddr: "{{ sap_ha_pacemaker_cluster_ibmpower_vm_hmc_host }}" From e0139066ea31767f495dad3be27fbd2577fc7a6e Mon Sep 17 00:00:00 2001 From: Janine Fuchs Date: Thu, 20 Jul 2023 15:14:10 +0200 Subject: [PATCH 127/128] sap_ha_pacemaker_cluster: restore GCP doc references --- .../vars/platform_cloud_gcp_ce_vm.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml index e570ccd82..160f6135d 100644 --- a/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml +++ b/roles/sap_ha_pacemaker_cluster/vars/platform_cloud_gcp_ce_vm.yml @@ -33,6 +33,14 @@ __sap_ha_pacemaker_cluster_available_vip_agents: ipaddr: agent: "ocf:heartbeat:IPaddr2" + # Recommended method is to use an internal passthrough Network Load Balancer (NLB for TCP/UDP) and Reserved Static Internal IP Address, with host health check response using socat or HAProxy + # Alternative method is to use static route Virtual IP (outside VPC Subnet ranges) using VPC Routing Table + # Refer to Google Cloud Compute Engine Reserved Static Internal IP Address, https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address + # Refer to Google Cloud Load Balancing - Internal passthrough Network Load Balancer overview, https://cloud.google.com/load-balancing/docs/internal + # Refer to SAP HANA guidance 1, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address + # Refer to SAP HANA guidance 2, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#vip_implementation + # Refer to SAP NetWeaver guidance, https://cloud.google.com/solutions/sap/docs/sap-hana-ha-planning-guide#virtual_ip_address + # Recommended method # Use Linux Pacemaker resource class/standard (pcs resource standards) as # 'service:' because this is an alias for selecting LSB/Systemd/Upstart dependent on OS From 507f2920379270a7cbaa74563dee4b7f8675f25e Mon Sep 17 00:00:00 2001 From: berndfinger <49749572+berndfinger@users.noreply.github.com> Date: Fri, 21 Jul 2023 12:18:33 +0200 Subject: [PATCH 128/128] Update CHANGELOG.rst Co-authored-by: Rainer Leber <39616583+rainerleber@users.noreply.github.com> --- CHANGELOG.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d5abe53ac..ac14c5a94 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,7 +12,7 @@ v1.3.0 Release Summary --------------- -| Release Date: 2023-04-25 +| Release Date: 2023-07-21 | sap_general_preconfigure: Updates for new IBM Power packages with RHEL | sap_hana_preconfigure: Updates for new IBM Power packages with RHEL | sap_hana_install: Default Log Mode to normal and not Overwrite