--- - 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: - __kernel_server_restart - name: Disable cgroup v2 configuration command: grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" when: - __kernel_cgroup_exception.rc == 0 - not kernel_cgroup_v2_enabled | bool notify: - __kernel_server_restart