Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion roles/sap_hana_preconfigure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ List of interfaces for which the MTU size will be set to `9000`.<br>

### sap_hana_preconfigure_ppcle_tso_if
- _Type:_ `list` with elements of type `str`
- _Default:_ `'{{ ansible_interfaces | difference([''lo'']) }}'`
- _Default:_ `'{{ ansible_facts['interfaces'] | difference([''lo'']) }}'`

List of interfaces for which the tso flag will be set.<br>

Expand Down
2 changes: 1 addition & 1 deletion roles/sap_hana_preconfigure/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ sap_hana_preconfigure_ibm_power_repo_url: "{{ __sap_hana_preconfigure_ibm_power_
sap_hana_preconfigure_ppcle_mtu9000_if: ''

# (Red Hat specific) List of interfaces for which the tso flag will be set.
sap_hana_preconfigure_ppcle_tso_if: "{{ ansible_interfaces | difference(['lo']) }}"
sap_hana_preconfigure_ppcle_tso_if: "{{ ansible_facts['interfaces'] | difference(['lo']) }}"

# (Red Hat specific) Use tuned for configuring most of the kernel settings for SAP HANA
# Set this parameter to `false` to use static kernel settings
Expand Down
6 changes: 3 additions & 3 deletions roles/sap_hana_preconfigure/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
__sap_hana_preconfigure_uefi_boot_dir: /boot/efi/EFI/redhat/grub.cfg
listen: __sap_hana_preconfigure_regenerate_grub2_conf_handler
when:
- ansible_distribution == 'RedHat'
- ansible_facts['distribution'] == 'RedHat'

- name: "Set the grub.cfg location SLES"
ansible.builtin.set_fact:
__sap_hana_preconfigure_uefi_boot_dir: /boot/efi/EFI/BOOT/grub.cfg
listen: __sap_hana_preconfigure_regenerate_grub2_conf_handler
when:
- ansible_distribution == 'SLES' or ansible_distribution == 'SLES_SAP'
- ansible_facts['distribution'] == 'SLES' or ansible_facts['distribution'] == 'SLES_SAP'

- name: "Run grub-mkconfig (UEFI mode)"
ansible.builtin.command:
Expand Down Expand Up @@ -104,7 +104,7 @@
timeout: 30
listen: __sap_hana_preconfigure_reboot_handler
when:
- ansible_os_family == 'Suse'
- ansible_facts['os_family'] == 'Suse'
- sap_hana_preconfigure_reboot_ok | d(false)
changed_when: false

Expand Down
2 changes: 1 addition & 1 deletion roles/sap_hana_preconfigure/meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ argument_specs:
type: str

sap_hana_preconfigure_ppcle_tso_if:
default: "{{ ansible_interfaces | difference(['lo']) }}"
default: "{{ ansible_facts['interfaces'] | difference(['lo']) }}"
description:
- List of interfaces for which the tso flag will be set.
required: false
Expand Down
42 changes: 21 additions & 21 deletions roles/sap_hana_preconfigure/tasks/RedHat/assert-installation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@

- name: Assert that the system is running a RHEL release which is supported for SAP HANA
ansible.builtin.assert:
that: ansible_distribution_version in sap_hana_preconfigure_supported_rhel_minor_releases
that: ansible_facts['distribution_version'] in sap_hana_preconfigure_supported_rhel_minor_releases
fail_msg:
- "FAIL: The RHEL release '{{ ansible_distribution_version }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "FAIL: The RHEL release '{{ ansible_facts['distribution_version'] }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "NOTE: If necessary, adapt role parameter `sap_hana_preconfigure_supported_rhel_minor_releases` accordingly."
success_msg: "PASS: The RHEL release {{ ansible_distribution_version }} is supported for SAP HANA."
success_msg: "PASS: The RHEL release {{ ansible_facts['distribution_version'] }} is supported for SAP HANA."
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
when: sap_hana_preconfigure_min_rhel_release_check

- name: Report if the RHEL release is supported for SAP HANA
ansible.builtin.assert:
that: ansible_distribution_version in sap_hana_preconfigure_supported_rhel_minor_releases
that: ansible_facts['distribution_version'] in sap_hana_preconfigure_supported_rhel_minor_releases
fail_msg:
- "WARN: The RHEL release '{{ ansible_distribution_version }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "WARN: The RHEL release '{{ ansible_facts['distribution_version'] }}' may not (yet) be supported for SAP HANA. Please check SAP note 2235581!"
- "NOTE: If necessary, adapt role parameter `sap_hana_preconfigure_supported_rhel_minor_releases` accordingly."
success_msg: "INFO: The RHEL release {{ ansible_distribution_version }} is supported for SAP HANA."
success_msg: "INFO: The RHEL release {{ ansible_facts['distribution_version'] }} is supported for SAP HANA."
ignore_errors: yes
when: not sap_hana_preconfigure_min_rhel_release_check

# repos required for SAP HANA on RHEL 7 and RHEL 8:
- name: Fill the variable for the generic list of required repos
ansible.builtin.set_fact:
__sap_hana_preconfigure_required_repos: "{{ lookup('vars', '__sap_hana_preconfigure_req_repos_redhat_' +
ansible_distribution_version | string | replace(\".\", \"_\") + '_' + ansible_architecture | string) }}"
ansible_facts['distribution_version'] | string | replace(\".\", \"_\") + '_' + ansible_facts['architecture'] | string) }}"

- name: Get info about enabled repos
ansible.builtin.shell: set -o pipefail && subscription-manager repos --list-enabled | awk '/Repo ID:/{print $NF}'
Expand Down Expand Up @@ -58,18 +58,18 @@

- name: Assert that the RHEL release is locked correctly
ansible.builtin.assert:
that: __sap_hana_preconfigure_register_subscription_manager_release_assert.stdout == ansible_distribution_version
that: __sap_hana_preconfigure_register_subscription_manager_release_assert.stdout == ansible_facts['distribution_version']
fail_msg: "FAIL: The RHEL release lock status is '{{ __sap_hana_preconfigure_register_subscription_manager_release_assert.stdout }}'
but the expected value is '{{ ansible_distribution_version }}'!"
success_msg: "PASS: The RHEL release is correctly locked to '{{ ansible_distribution_version }}'."
but the expected value is '{{ ansible_facts['distribution_version'] }}'!"
success_msg: "PASS: The RHEL release is correctly locked to '{{ ansible_facts['distribution_version'] }}'."
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"
when: "ansible_distribution_version != '7.9'"
when: "ansible_facts['distribution_version'] != '7.9'"

- name: Report that checking the release lock is not necessary if the system is on RHEL 7.9
ansible.builtin.debug:
msg: "INFO: No need to check the release lock setting as the RHEL release {{ ansible_distribution_version }}
is the last RHEL {{ ansible_distribution_major_version }} minor release"
when: "ansible_distribution_version == '7.9'"
msg: "INFO: No need to check the release lock setting as the RHEL release {{ ansible_facts['distribution_version'] }}
is the last RHEL {{ ansible_facts['distribution_major_version'] }} minor release"
when: "ansible_facts['distribution_version'] == '7.9'"

- name: Assert that all required packages are installed
ansible.builtin.assert:
Expand All @@ -96,7 +96,7 @@
register: __sap_hana_preconfigure_register_required_ppc64le_packages_assert
changed_when: false
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"

Expand All @@ -110,7 +110,7 @@
loop_control:
loop_var: line_item
when:
- ansible_architecture == "ppc64le"
- ansible_facts['architecture'] == "ppc64le"
- sap_general_preconfigure_install_ibm_power_tools
ignore_errors: "{{ sap_hana_preconfigure_assert_ignore_errors | d(false) }}"

Expand Down Expand Up @@ -208,22 +208,22 @@
ansible.builtin.set_fact:
__sap_hana_preconfigure_fact_needs_restarting_command_assert: "needs-restarting -r"
when:
- ansible_distribution_major_version == '7'
- ansible_facts['distribution_major_version'] == '7'

- name: "Assert - Set needs-restarting command in case of RHEL 8 or greater, except RHEL 8.0"
ansible.builtin.set_fact:
__sap_hana_preconfigure_fact_needs_restarting_command_assert: "yum needs-restarting -r"
when:
- ansible_distribution_major_version | int >= 8
- ansible_distribution_version != '8.0'
- ansible_facts['distribution_major_version'] | int >= 8
- ansible_facts['distribution_version'] != '8.0'

- name: "Assert - Set customized needs-restarting command in case of RHEL 8.0"
ansible.builtin.set_fact:
__sap_hana_preconfigure_fact_needs_restarting_command_assert: "_IKRNL=$(rpm -q --last kernel | awk 'NR==1{sub(/kernel-/,\"\"); print $1}');
_CKRNL=$(uname -r); if [ ${_IKRNL} != ${_CKRNL} ]; then exit 1; else exit 0; fi"
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_version == '8.0'
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_version'] == '8.0'

- name: Assert - Display the command for checking a reboot requirement
ansible.builtin.debug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# can be configured by tuned profile sap-hana, entry "force_latency=70"
- name: Assert - Perform steps for checking the required C-State configuration
when: ansible_architecture == 'x86_64' and
when: ansible_facts['architecture'] == 'x86_64' and
(not sap_hana_preconfigure_use_tuned or
sap_hana_preconfigure_modify_grub_cmdline_linux or
sap_hana_preconfigure_assert_all_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# can be configured by tuned profile sap-hana, entry "governor=performance"
# in included tuned profile throughput-performance
- name: Assert - Perform steps for checking the CPU Governor for performance
when: ansible_architecture == 'x86_64' and
when: ansible_facts['architecture'] == 'x86_64' and
(not sap_hana_preconfigure_use_tuned or
sap_hana_preconfigure_assert_all_config)
block:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# in included tuned profile throughput-performance
# More details on EPB are in: https://github.com/torvalds/linux/blob/be1fcde604e429691771ce70230668af8097e29b/arch/x86/kernel/cpu/intel_epb.c
- name: Assert - Perform steps for checking EPB
when: ansible_architecture == 'x86_64' and
when: ansible_facts['architecture'] == 'x86_64' and
(not sap_hana_preconfigure_use_tuned or
sap_hana_preconfigure_assert_all_config)
block:
Expand Down
12 changes: 6 additions & 6 deletions roles/sap_hana_preconfigure/tasks/RedHat/generic/assert-thp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
__sap_hana_preconfigure_fact_thp_boot_command_line_arg: "transparent_hugepage=never"
when:
- sap_hana_preconfigure_thp is undefined or sap_hana_preconfigure_thp | length == 0
- ansible_distribution_major_version == '7' or
ansible_distribution_major_version == '8' or
ansible_distribution_version == '9.0' or
ansible_distribution_version == '9.1'
- ansible_facts['distribution_major_version'] == '7' or
ansible_facts['distribution_major_version'] == '8' or
ansible_facts['distribution_version'] == '9.0' or
ansible_facts['distribution_version'] == '9.1'

- name: Set fact for THP, RHEL 9.2 and later
ansible.builtin.set_fact:
__sap_hana_preconfigure_fact_thp: 'madvise'
__sap_hana_preconfigure_fact_thp_boot_command_line_arg: "transparent_hugepage=madvise"
when:
- sap_hana_preconfigure_thp is undefined or sap_hana_preconfigure_thp | length == 0
- ansible_distribution_major_version | int >= 10 or
(ansible_distribution_major_version == '9' and
- ansible_facts['distribution_major_version'] | int >= 10 or
(ansible_facts['distribution_major_version'] == '9' and
__sap_hana_preconfigure_fact_ansible_distribution_minor_version | int >= 2)

# TODO: Replace with full validations for accepted values ['always', 'madvise', 'never']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

- name: Assert - Perform steps for checking TSX
when:
- ansible_architecture == 'x86_64'
- ansible_distribution == 'RedHat'
- ansible_distribution_major_version | int >= 9 or
(ansible_distribution_major_version == '8' and
- ansible_facts['architecture'] == 'x86_64'
- ansible_facts['distribution'] == 'RedHat'
- ansible_facts['distribution_major_version'] | int >= 9 or
(ansible_facts['distribution_major_version'] == '8' and
__sap_hana_preconfigure_fact_ansible_distribution_minor_version | int >= 3)
block:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
loop_var: __sap_hana_preconfigure_kernel_arg_line_item
when:
- __sap_hana_preconfigure_boot_command_line_args['c-states']['arch'] is defined
- ansible_architecture in __sap_hana_preconfigure_boot_command_line_args['c-states']['arch']
- ansible_facts['architecture'] in __sap_hana_preconfigure_boot_command_line_args['c-states']['arch']
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# in included tuned profile throughput-performance
- name: Perform steps for configuring the CPU Governor for performance
when:
- ansible_architecture == 'x86_64'
- ansible_facts['architecture'] == 'x86_64'
- not sap_hana_preconfigure_use_tuned
block:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# More details on EPB are in: https://github.com/torvalds/linux/blob/be1fcde604e429691771ce70230668af8097e29b/arch/x86/kernel/cpu/intel_epb.c
- name: Perform steps for configuring EPB
when:
- ansible_architecture == 'x86_64'
- ansible_facts['architecture'] == 'x86_64'
- not sap_hana_preconfigure_use_tuned
block:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# the value of the 'mode' member ('permissive' or 'enforcing')
- name: SELinux - Set an SELinux mode variable
ansible.builtin.set_fact:
__sap_hana_preconfigure_fact_selinux_mode: "{{ (ansible_selinux.status == 'disabled') | ternary(ansible_selinux.status, ansible_selinux.mode) }}"
__sap_hana_preconfigure_fact_selinux_mode: "{{ (ansible_facts['selinux'].status == 'disabled') | ternary(ansible_facts['selinux'].status, ansible_facts['selinux'].mode) }}"

- name: SELinux - Warn if the SELinux file contexts cannot be set
ansible.builtin.debug:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
__sap_hana_preconfigure_fact_thp: "{{ __sap_hana_preconfigure_boot_command_line_args['thp']['args'][0].split('=')[1] }}"
when:
- __sap_hana_preconfigure_boot_command_line_args['thp']['arch'] is defined
- ansible_architecture in __sap_hana_preconfigure_boot_command_line_args['thp']['arch']
- ansible_facts['architecture'] in __sap_hana_preconfigure_boot_command_line_args['thp']['arch']
- sap_hana_preconfigure_thp is undefined
or not sap_hana_preconfigure_thp is string
or sap_hana_preconfigure_thp | length == 0
Expand All @@ -27,7 +27,7 @@
or
(
__sap_hana_preconfigure_boot_command_line_args['thp']['arch'] is defined and
ansible_architecture in __sap_hana_preconfigure_boot_command_line_args['thp']['arch']
ansible_facts['architecture'] in __sap_hana_preconfigure_boot_command_line_args['thp']['arch']
)
block:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
- name: Perform specific steps for tuned profile on RHEL 8.0 ppc64le
when:
- sap_hana_preconfigure_use_tuned
- ansible_architecture == "ppc64le"
- ansible_distribution_version == "8.0"
- ansible_facts['architecture'] == "ppc64le"
- ansible_facts['distribution_version'] == "8.0"
block:

- name: RHEL 8.0 ppc64le - Create directory /etc/tuned/sap-hana-ppc64le
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
loop_var: __sap_hana_preconfigure_kernel_arg_line_item
when:
- __sap_hana_preconfigure_boot_command_line_args['tsx']['arch'] is defined
- ansible_architecture in __sap_hana_preconfigure_boot_command_line_args['tsx']['arch']
- ansible_facts['architecture'] in __sap_hana_preconfigure_boot_command_line_args['tsx']['arch']
Loading
Loading