mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2026-03-10 12:12:12 +01:00
Enforce similar cgroup replacement pattern across OSes, fix lint naming
Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: Check for boot configuration files
|
||||
ansible.builtin.stat:
|
||||
ansible.builtin.stat: # noqa var-naming[no-role-prefix]
|
||||
path: "{{ item }}"
|
||||
loop:
|
||||
- /boot/boot.txt
|
||||
@@ -9,25 +9,12 @@
|
||||
|
||||
- name: Set boot_file fact
|
||||
ansible.builtin.set_fact:
|
||||
rpi_boot_file: "{{ (boot_files.results | selectattr('stat.exists') | map(attribute='item') | list | first) | default('') }}"
|
||||
raspberrypi_boot_file: "{{ (boot_files.results | selectattr('stat.exists') | map(attribute='item') | list | first) | default('') }}"
|
||||
|
||||
- name: Enable cgroup via boot commandline (boot.txt)
|
||||
# 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: /boot/boot.txt
|
||||
regexp: '^(setenv bootargs console=ttyS1,115200 console=tty0 root=PARTUUID=\${uuid} rw rootwait smsc95xx.macaddr="\${usbethaddr}"(?!.*\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
|
||||
when: rpi_boot_file == '/boot/boot.txt'
|
||||
notify: Regenerate bootloader image
|
||||
|
||||
- name: Enable cgroup via boot commandline (cmdline.txt)
|
||||
ansible.builtin.replace:
|
||||
path: /boot/cmdline.txt
|
||||
path: "{{ raspberrypi_boot_file }}"
|
||||
regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$'
|
||||
replace: '\1 {{ cgroup_item }}'
|
||||
with_items:
|
||||
@@ -36,5 +23,4 @@
|
||||
- "cgroup_enable=memory"
|
||||
loop_control:
|
||||
loop_var: cgroup_item
|
||||
when: rpi_boot_file == '/boot/cmdline.txt'
|
||||
notify: Reboot Pi
|
||||
notify: "{{ (raspberrypi_boot_file == '/boot/boot.txt') | ternary('Regenerate bootloader image', 'Reboot Pi') }}"
|
||||
|
||||
Reference in New Issue
Block a user