2022-03-20 21:03:26 +00:00
|
|
|
---
|
|
|
|
- name: Ensure grubby is installed
|
|
|
|
package:
|
|
|
|
name: grubby
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Check current state of cgroup
|
|
|
|
command: grep -Eq '^kernelopts=.* systemd\.unified_cgroup_hierarchy=1' /boot/grub2/grubenv
|
|
|
|
register: __kernel_cgroup_exception
|
|
|
|
check_mode: False
|
|
|
|
failed_when: False
|
|
|
|
changed_when: False
|
|
|
|
|
|
|
|
- name: Enabled cgroup v2 configuration
|
|
|
|
command: grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=1"
|
|
|
|
when:
|
|
|
|
- __kernel_cgroup_exception.rc != 0
|
|
|
|
- kernel_cgroup_v2_enabled | bool
|
|
|
|
notify:
|
2022-03-21 07:59:10 +00:00
|
|
|
- __kernel_grub_rebuild
|
2022-03-20 21:03:26 +00:00
|
|
|
- __kernel_server_restart
|
|
|
|
|
|
|
|
- name: Disable cgroup v2 configuration
|
2022-03-21 07:59:10 +00:00
|
|
|
command: grubby --update-kernel=ALL --remove-args="systemd.unified_cgroup_hierarchy"
|
2022-03-20 21:03:26 +00:00
|
|
|
when:
|
|
|
|
- __kernel_cgroup_exception.rc == 0
|
|
|
|
- not kernel_cgroup_v2_enabled | bool
|
|
|
|
notify:
|
2022-03-21 07:59:10 +00:00
|
|
|
- __kernel_grub_rebuild
|
2022-03-20 21:03:26 +00:00
|
|
|
- __kernel_server_restart
|
2022-03-21 07:59:10 +00:00
|
|
|
|
|
|
|
- name: Force rebuild grub config and reboot
|
|
|
|
command: /bin/true
|
|
|
|
notify:
|
|
|
|
- __kernel_grub_rebuild
|
|
|
|
- __kernel_server_restart
|
|
|
|
when: kernel_grub_rebuild_force | bool
|