2020-05-22 18:01:03 +02:00
|
|
|
---
|
2020-05-22 20:11:00 +02:00
|
|
|
- name: Enable cgroup via boot commandline if not already enabled
|
2020-05-22 18:01:03 +02:00
|
|
|
lineinfile:
|
|
|
|
path: /boot/firmware/cmdline.txt
|
|
|
|
backrefs: yes
|
2020-05-23 18:31:40 +02:00
|
|
|
regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$'
|
2020-05-22 18:01:03 +02:00
|
|
|
line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory'
|
|
|
|
when:
|
2020-05-22 20:11:00 +02:00
|
|
|
- ansible_distribution == 'Ubuntu'
|
2020-05-22 18:01:03 +02:00
|
|
|
|
2020-05-23 18:31:40 +02:00
|
|
|
- name: Read /proc/cmdline to check for cgroups already running
|
2020-05-24 00:40:59 +02:00
|
|
|
slurp:
|
|
|
|
src: /proc/cmdline
|
|
|
|
register: slurped_cmdline
|
2020-05-22 18:01:03 +02:00
|
|
|
when:
|
2020-05-23 18:31:40 +02:00
|
|
|
- ansible_distribution == 'Ubuntu'
|
2020-05-22 18:01:03 +02:00
|
|
|
|
2020-05-24 00:40:59 +02:00
|
|
|
- name: Decode slurped command line
|
|
|
|
set_fact:
|
|
|
|
cmdline: "{{ slurped_cmdline.content | b64decode }}"
|
|
|
|
when:
|
|
|
|
- ansible_distribution == 'Ubuntu'
|
|
|
|
|
|
|
|
- name: Reboot to enable cgroups if not already enabled
|
2020-05-22 18:01:03 +02:00
|
|
|
reboot:
|
|
|
|
when:
|
2020-05-22 20:11:00 +02:00
|
|
|
- ansible_distribution == 'Ubuntu'
|
2020-05-24 00:40:59 +02:00
|
|
|
- '"cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory" not in cmdline'
|