Files
k3s-ansible/roles/raspberrypi/tasks/prereq/Archlinux.yml
Gilles H. 34073379ce Fix regex archlinux boot.txt (cgroup) (#499)
Update the regular expression to have a more specific match search term
for cgroup flags

Issue #495

Signed-off-by: Gilles Habran <gilleshabran@protonmail.com>
2026-01-20 12:19:20 -08:00

42 lines
1.3 KiB
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 (boot.txt)
ansible.builtin.replace:
path: "{{ raspberrypi_boot_file }}"
regexp: '^(setenv bootargs(?!.*{{ cgroup_item }}).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"
loop_control:
loop_var: cgroup_item
when: raspberrypi_boot_file == '/boot/boot.txt'
notify: Regenerate bootloader image
- name: Enable cgroup via boot commandline (cmdline.txt)
ansible.builtin.replace:
path: "{{ raspberrypi_boot_file }}"
regexp: '^(\S(?!.*{{ cgroup_item }}).*)$'
replace: '\1 {{ cgroup_item }}'
with_items:
- "cgroup_enable=cpuset"
- "cgroup_memory=1"
- "cgroup_enable=memory"
loop_control:
loop_var: cgroup_item
when: raspberrypi_boot_file == '/boot/cmdline.txt'
notify: Reboot Pi