mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2024-11-18 10:55:21 +01:00
22 lines
710 B
YAML
22 lines
710 B
YAML
---
|
|
- name: Enable cgroup via boot commandline if not already enabled
|
|
lineinfile:
|
|
path: /boot/firmware/cmdline.txt
|
|
backrefs: yes
|
|
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'
|
|
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
|
|
when:
|
|
- ansible_distribution == 'Ubuntu'
|
|
|
|
- name: Read /proc/cmdline to check for cgroups already running
|
|
shell: cat /proc/cmdline
|
|
register: cmdline
|
|
when:
|
|
- ansible_distribution == 'Ubuntu'
|
|
|
|
- name: Reboot to enable cgroups if not already running
|
|
reboot:
|
|
when:
|
|
- ansible_distribution == 'Ubuntu'
|
|
- '"cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory" not in cmdline.stdout'
|