fix: ensure grub config rgeneration after grubby changes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Robert Kaussow 2022-03-21 08:59:10 +01:00
parent 6d855b224d
commit 2181685e50
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
4 changed files with 23 additions and 3 deletions

View File

@ -11,3 +11,5 @@ kernel_blacklist_modules:
kernel_namespace_support_enabled: False
kernel_coredump_enabled: True
kernel_cgroup_v2_enabled: False
kernel_grub_rebuild_force: False

View File

@ -5,6 +5,15 @@
become: True
become_user: root
- name: Rebuild grub config
command: "{{ item }}"
listen: __kernel_grub_rebuild
loop:
- grub2-mkconfig -o /boot/grub2/grub.cfg
- grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
become: True
become_user: root
- name: Reboot server
reboot:
reboot_timeout: 600

View File

@ -35,7 +35,7 @@ def test_coredump_config(host):
def test_cgroup_config(host):
grub = host.file("/boot/grub2/grubenv")
proc = host.run("grep cgroup /proc/filesystems")
proc = host.run("mount -l | grep cgroup")
assert grub.contains("systemd.unified_cgroup_hierarchy=1")
assert "cgroup2" in proc.stdout
assert "cgroup2 on /sys/fs/cgroup type cgroup2" in proc.stdout

View File

@ -17,12 +17,21 @@
- __kernel_cgroup_exception.rc != 0
- kernel_cgroup_v2_enabled | bool
notify:
- __kernel_grub_rebuild
- __kernel_server_restart
- name: Disable cgroup v2 configuration
command: grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
command: grubby --update-kernel=ALL --remove-args="systemd.unified_cgroup_hierarchy"
when:
- __kernel_cgroup_exception.rc == 0
- not kernel_cgroup_v2_enabled | bool
notify:
- __kernel_grub_rebuild
- __kernel_server_restart
- name: Force rebuild grub config and reboot
command: /bin/true
notify:
- __kernel_grub_rebuild
- __kernel_server_restart
when: kernel_grub_rebuild_force | bool