From 581605475ea59d063167c402db74fe83068c5563 Mon Sep 17 00:00:00 2001 From: Bernd Finger Date: Thu, 10 Jul 2025 14:54:39 +0200 Subject: [PATCH] sap_*_preconfigure: Define needs-restarting also for RHEL 10 Fixes issue #1069. Signed-off-by: Bernd Finger --- .../tasks/RedHat/installation.yml | 6 ++---- .../tasks/RedHat/installation.yml | 11 +++-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml index c79e58d2c..1c75d5da1 100644 --- a/roles/sap_general_preconfigure/tasks/RedHat/installation.yml +++ b/roles/sap_general_preconfigure/tasks/RedHat/installation.yml @@ -241,13 +241,11 @@ __sap_general_preconfigure_fact_needs_restarting_command: "needs-restarting -r" when: ansible_distribution_major_version == '7' -- name: "Set needs-restarting command in case of RHEL 8 or RHEL 9, except RHEL 8.0" +- name: "Set needs-restarting command in case of RHEL 8 or greater, except RHEL 8.0" ansible.builtin.set_fact: __sap_general_preconfigure_fact_needs_restarting_command: "yum needs-restarting -r" when: - - (ansible_distribution_major_version == '8' or - ansible_distribution_major_version == '9' - ) + - ansible_distribution_major_version | int >= 8 - ansible_distribution_version != '8.0' - name: "Set customized needs-restarting command in case of RHEL 8.0" diff --git a/roles/sap_hana_preconfigure/tasks/RedHat/installation.yml b/roles/sap_hana_preconfigure/tasks/RedHat/installation.yml index cf37af46e..0e8a2271f 100644 --- a/roles/sap_hana_preconfigure/tasks/RedHat/installation.yml +++ b/roles/sap_hana_preconfigure/tasks/RedHat/installation.yml @@ -202,24 +202,19 @@ ansible.builtin.set_fact: __sap_hana_preconfigure_fact_needs_restarting_command: "needs-restarting -r" when: - - ansible_os_family == 'RedHat' - ansible_distribution_major_version == '7' -- name: "Set needs-restarting command in case of RHEL 8 or RHEL 9, except RHEL 8.0" +- name: "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: "yum needs-restarting -r" when: - - ansible_os_family == 'RedHat' - - (ansible_distribution_major_version == '8' or - ansible_distribution_major_version == '9' - ) + - ansible_distribution_major_version | int >= 8 - ansible_distribution_version != '8.0' - name: "Set customized needs-restarting command in case of RHEL 8.0" ansible.builtin.set_fact: __sap_hana_preconfigure_fact_needs_restarting_command: "_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' - name: Display the command for checking a reboot requirement @@ -227,7 +222,7 @@ var: __sap_hana_preconfigure_fact_needs_restarting_command # Reason for noqa: The command to be executed might contain pipes -- name: Determine if system needs to be restarted # noqa command-instead-of-shell +- name: Determine if the system needs to be restarted # noqa command-instead-of-shell ansible.builtin.shell: "{{ __sap_hana_preconfigure_fact_needs_restarting_command }}" register: __sap_hana_preconfigure_register_needs_restarting ignore_errors: true