community.sap_install
community.sap_install copied to clipboard
sap_hana_preconfigure: Wrong OS version detection
I just run in the follwoing bug: -> deployed RHEL with 8.5 image -> set the release to 8.6 prior to run sap_hana_preconfigure
==> after the update the variable ansible_distribution_version is still set to 8.5, although the system has been updated to 8.6 in the role ==> This is leading to the following error:
TASK [community.sap_install.sap_hana_preconfigure : include_tasks] *************
included: /runner/requirements_collections/ansible_collections/community/sap_install/roles/sap_hana_preconfigure/tasks/RedHat/installation.yml for uc10hana => (item=/runner/requirements_collections/ansible_collections/community/sap_install/roles/sap_hana_preconfigure/tasks/RedHat)
TASK [community.sap_install.sap_hana_preconfigure : Ensure that the system is running a RHEL release which is supported for SAP HANA] ***
fatal: [uc10hana]: FAILED! => {
"assertion": "ansible_distribution_version in \"['8.0', '8.1', '8.2', '8.4', '8.6']\"",
"changed": false,
"evaluated_to": false,
"msg": "The RHEL release 8.5 is not supported for SAP HANA!"
}
Suggested fix: run setup module before for the final check, or even better, after the system has been updated - there might be other facts changed after a reboot or an update
We are currently determining the current RHEL minor release as the first task of the role. After that, the system might be updated by the role - dependent on the role variables. The destination release of the update is currently outside of the control of the role. We decided to verify against the supported RHEL minor release for SAP HANA but the role can be configured to skip this check. If we perform the RHEL minor release check after all installation activities or after even after all configuration activities, the system could have been updated to an unsupported RHEL minor release already, which we probably want to avoid. We might as well decide to explain this in the documentation instead of modifying the order of the RHEL minor version check.
Hence I would put the following task immediately before the version check is done and after a (possible) update and reboot
- name: update current os-version variable
setup:
gather_subset: distribution_version
Then the current OS release after all changes are made is read into the facts and we can do the check reliably.
TASK Which version of the OS is detected by the setup module after an update: the running version or the installed version? If the installed version is detected it can be useful to introduce a new variable to pin the OS not only on the running minor release but also on any higher than the running minor-release
A workaround is to allow a reboot at the end of the sap_general_preconfigure role, so that role sap_hana_preconfigure detects the RHEL minor release right at the beginning of its execution, and after the managed node has been rebooted and so it would be on the desired RHEL minor release.
TASK Which version of the OS is detected by the setup module after an update: the running version or the installed version? If the installed version is detected it can be useful to introduce a new variable to pin the OS not only on the running minor release but also on any higher than the running minor-release
If I recall right it's parsing the /etc/redhat-release file, so if you only want to know the minor version you should be good with just rerunning the setup module to get the new values after yum/dnf update. But if you want to know the 8.6 kernel version for example you'll need to reboot before continuing. From an admin perspective: I would handle all this in the role that updates the system. Update system, reboot it if needed (dnf needs-restarting -r), rerun setup module, continue with rest.
Good point. I agree that would simplify the role dramatically.
From an admin perspective: I would handle all this in the role that updates the system. Update system, reboot it if needed (dnf needs-restarting -r), rerun setup module, continue with rest.
We probably do not want to verify the RHEL minor release compliance in the sap_general_preconfigure role, as this is not needed for SAP NetWeaver/ABAP Platform. The purpose of the RHEL minor release check is to verify its compliance with SAP note 2235581. Re-running the setup module for getting the latest contents of /etc/redhat-release right before the RHEL minor release check in role sap_hana_preconfigure is certainly a good idea. This role might install further packages, update certain packages (e.g. the Linux kernel) and perform some system modifications which require a reboot but it won't change the RHEL minor release so at the beginning of the sap_hana_preconfigure role, the RHEL minor release will not be changed any more. And of course if someone wants to prepare a RHEL 8.X system for SAP HANA which has not yet or will never be validated, this is also possible by just disabling the minor release check.
I just tested and found that just modifying the file /etc/redhat-release is not sufficient to get the RHEL release into ansible_distribution_version. Will now check an update without rebooting.
It seems that the update of package redhat-release-8.6-0.1.el8.x86_64 caused the variable ansible_distribution_version to be updated. At around the time this package was installed, the output of the test playbook changed from 8.5 to 8.6.
Now the question is: Do we want to implement a desired minor release as part of the sap_general_preconfigure role? This role is already capable of setting the RHEL minor release lock (default is not to do so), and it is currently setting it to the content of ansible_distribution_version if it differs from the output of the subscription-manager release --show command.
No further comment and not urgent -> moving to backlog