mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 10:24:30 +00:00
Add preflight checks for cgroup kernel params in k3s setup
- Ensure cgroup kernel parameters are present before k3s installation. - Introduce playbook changes to integrate cgroup prerequisites role.
This commit is contained in:
parent
11a1a32677
commit
7ecc69c969
@ -23,6 +23,13 @@
|
|||||||
- local_user
|
- local_user
|
||||||
- rsyslog
|
- rsyslog
|
||||||
|
|
||||||
|
- name: K3s cgroup prerequisites
|
||||||
|
hosts: k3s_hosts
|
||||||
|
become: true
|
||||||
|
serial: 1
|
||||||
|
roles:
|
||||||
|
- cgroups
|
||||||
|
|
||||||
- name: K3s Cluster Setup
|
- name: K3s Cluster Setup
|
||||||
hosts: k3s_hosts
|
hosts: k3s_hosts
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@ -35,6 +35,16 @@
|
|||||||
changed_when: false
|
changed_when: false
|
||||||
failed_when: rancher_mounted.rc != 0
|
failed_when: rancher_mounted.rc != 0
|
||||||
|
|
||||||
|
- name: Preflight - ensure cgroup kernel params are present
|
||||||
|
ansible.builtin.command: "cat /proc/cmdline"
|
||||||
|
register: k3s_proc_cmdline
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
|
- name: Fail if cgroup params are missing (reboot required)
|
||||||
|
ansible.builtin.fail:
|
||||||
|
msg: "Missing cgroup params in /proc/cmdline: {{ ['cgroup_memory=1', 'cgroup_enable=memory'] | reject('in', k3s_proc_cmdline.stdout) | list }}. Reboot required before k3s install."
|
||||||
|
when: (['cgroup_memory=1', 'cgroup_enable=memory'] | reject('in', k3s_proc_cmdline.stdout) | list) | length > 0
|
||||||
|
|
||||||
- name: Guardrail - ensure rancher mountpoint is not on SD/rootfs
|
- name: Guardrail - ensure rancher mountpoint is not on SD/rootfs
|
||||||
ansible.builtin.command: "findmnt -n -o SOURCE {{ k3s_rancher_mountpoint | default('/var/lib/rancher') }}"
|
ansible.builtin.command: "findmnt -n -o SOURCE {{ k3s_rancher_mountpoint | default('/var/lib/rancher') }}"
|
||||||
register: rancher_source
|
register: rancher_source
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user