mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2026-03-09 12:02:11 +01:00
27 lines
952 B
YAML
27 lines
952 B
YAML
---
|
|
- name: Check for boot configuration files
|
|
ansible.builtin.stat: # noqa var-naming[no-role-prefix]
|
|
path: "{{ item }}"
|
|
loop:
|
|
- /boot/boot.txt
|
|
- /boot/cmdline.txt
|
|
register: boot_files
|
|
|
|
- name: Set boot_file fact
|
|
ansible.builtin.set_fact:
|
|
raspberrypi_boot_file: "{{ (boot_files.results | selectattr('stat.exists') | map(attribute='item') | list | first) | default('') }}"
|
|
|
|
# Arch ARM64 boots via /boot/boot.txt (UBoot), /boot/cmdline.txt only exists on legacy 32-bit systems
|
|
- name: Enable cgroup via boot commandline
|
|
ansible.builtin.replace:
|
|
path: "{{ raspberrypi_boot_file }}"
|
|
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
|
|
replace: '\1 {{ cgroup_item }}'
|
|
with_items:
|
|
- "cgroup_enable=cpuset"
|
|
- "cgroup_memory=1"
|
|
- "cgroup_enable=memory"
|
|
loop_control:
|
|
loop_var: cgroup_item
|
|
notify: "{{ (raspberrypi_boot_file == '/boot/boot.txt') | ternary('Regenerate bootloader image', 'Reboot Pi') }}"
|