Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sap_hana_preconfigure: update kernel parameters for SLES #638

Merged
merged 7 commits into from
Mar 5, 2024
45 changes: 45 additions & 0 deletions roles/sap_hana_preconfigure/tasks/SLES/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,51 @@
ansible.builtin.debug:
var: __sap_hana_preconfigure_fact_solution_configured

- name: Set GRUB entries
when: __sap_hana_preconfigure_run_saptune
handlers:
- name: GRUB_post-update_configuration
block:
- name: GRUB mkconfig
ansible.builtin.shell:
cmd: grub2-mkconfig -o /boot/grub2/grub.cfg

- name: GRUB.cfg permissions
ansible.builtin.file:
path: /boot/grub2/grub.cfg
mode: "0600"
block:
# Reason for noqa:
# no-changed-when: the regex do a check on the element before apply the
# changed item, this prevent a replace to an element that is already in
# the configuration
- name: Set GRUB entries # noqa no-changed-when
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^(GRUB_CMDLINE_LINUX_DEFAULT=(?!.* {{ item }}).*). *$'
line: "\\1 {{ item }}\""
register: set_grub_entries
with_items:
- "splash=silent"
- "mitigations=auto"
- "quiet"
- "numa_balancing=disable"
- "transparent_hugepage=never"
- "intel_idle.max_cstate=1"
- "processor.max_cstate=1"
- "audit=1"

# Reason for noqa:
# no-changed-when: there is already a check on the `when` argument that
# loop over all the results of the previous task and if some of the results
# changed the grub configuration file the `GRUB_post-update_configuration`
# handler will be notify, in the other hands if none of the item changed
# the configuration file no handler will be notify
- name: Trigger grub update if necessary # noqa no-changed-when
ansible.builtin.command: /bin/true
when: set_grub_entries.results | selectattr('changed', 'equalto', true) | list | length > 0
notify: GRUB_post-update_configuration

- name: Enable sapconf
when: not __sap_hana_preconfigure_run_saptune
block:
Expand Down
Loading