Add cgroup checks

This commit is contained in:
Xan Manning 2021-04-03 20:42:44 +01:00
parent a3c4d9cfae
commit e5c69ec894
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,15 @@
---
- name: Check if {{ cgroup.name }} cgroup is enabled
ansible.builtin.command: grep -E "^{{ cgroup.name }}\s+.*\s+1$" /proc/cgroups
failed_when: false
changed_when: false
register: k3s_check_cgroup_option
- name: Fail if {{ cgroup.name }} cgroup is not enabled
ansible.builtin.assert:
that:
- k3s_check_cgroup_option.rc == 0
fail_msg: |
{{ cgroup.name }} cgroup disabled. {{ cgroup.documentation }}
success_msg: "{{ cgroup.name }} cgroup enabled."

View File

@ -13,12 +13,20 @@
- not k3s_skip_validation
- not k3s_skip_env_checks
- include_tasks: environment/remote/cgroups.yml
loop: "{{ k3s_cgroup_subsys }}"
loop_control:
loop_var: cgroup
when:
- not k3s_skip_validation
- not k3s_skip_env_checks
- include_tasks: environment/remote/packages.yml
loop: "{{ k3s_check_packages }}"
loop_control:
loop_var: package
when:
- k3s_skip_validation
- not k3s_skip_validation
- not k3s_skip_env_checks
- include_tasks: environment/local/issue-data.yml

View File

@ -143,3 +143,13 @@ k3s_deprecated_config:
- setting: docker
correction: "docker: false"
when: 1.20.0
k3s_cgroup_subsys:
- name: memory
documentation: |
If you are running on a Raspberry Pi, see:
https://rancher.com/docs/k3s/latest/en/advanced/#enabling-cgroups-for-raspbian-buster
- name: cpuset
documentation: |
If you are running Alpine Linux, see:
https://rancher.com/docs/k3s/latest/en/advanced/#additional-preparation-for-alpine-linux-setup