Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
---
- name: Update grub
become: true
ansible.builtin.command: update-grub
changed_when: true

- name: Reload sysctl
become: true
ansible.builtin.command: sysctl --system
Expand Down
24 changes: 5 additions & 19 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@
path: /sys/fs/cgroup/cgroup.controllers
register: cgroupfs

- name: Enable cgroupv2 in grub
become: true
when: not cgroupfs.stat.exists
ansible.builtin.lineinfile:
dest: /etc/default/grub
state: present
backrefs: true
regexp: '^GRUB_CMDLINE_LINUX=\"(?P<pre>.*)systemd.unified_cgroup_hierarchy=[0-1]+ (?P<post>.+)\"$'
line: 'GRUB_CMDLINE_LINUX="\g<pre>systemd.unified_cgroup_hierarchy=1 \g<post>"'
notify: Update grub

- name: Create cgroupv2 delegation configuration folder
become: true
ansible.builtin.file:
Expand All @@ -35,6 +24,11 @@
mode: "0755"
state: directory

- name: Ensure we only progress if cgroupsv2 are available right now
when: not cgroupfs.stat.exists
ansible.builtin.fail:
msg: cgroupsv2 are not enabled. Please enable cgroupsv2 according to the instructions of your distribution!

- name: Configure cgroupv2 delegation
become: true
ansible.builtin.template:
Expand All @@ -44,14 +38,6 @@
group: root
mode: "0644"

- name: Flush handlers
ansible.builtin.meta: flush_handlers

- name: Ensure we can only progress if cgroupsv2 are available right now
when: not cgroupfs.stat.exists
ansible.builtin.fail:
msg: cgroupsv2 are not enabled. We've changed the configuration, but you will need to reboot the machine!

- name: Apply sysctl settings
become: true
ansible.builtin.template:
Expand Down