Loading roles/raspberrypi/tasks/prereq/Archlinux.yml +6 −20 Original line number Diff line number Diff line --- - name: Check for boot configuration files ansible.builtin.stat: ansible.builtin.stat: # noqa var-naming[no-role-prefix] path: "{{ item }}" loop: - /boot/boot.txt Loading @@ -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: Loading @@ -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') }}" roles/raspberrypi/tasks/prereq/Debian.yml +2 −4 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading Loading @@ -41,10 +41,8 @@ community.general.alternatives: path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy - name: Changing to ip6tables-legacy community.general.alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy roles/raspberrypi/tasks/prereq/Raspbian.yml +2 −4 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading Loading @@ -41,10 +41,8 @@ community.general.alternatives: path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy - name: Changing to ip6tables-legacy community.general.alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy roles/raspberrypi/tasks/prereq/Ubuntu.yml +2 −2 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/firmware/current/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/firmware/current/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading Loading
roles/raspberrypi/tasks/prereq/Archlinux.yml +6 −20 Original line number Diff line number Diff line --- - name: Check for boot configuration files ansible.builtin.stat: ansible.builtin.stat: # noqa var-naming[no-role-prefix] path: "{{ item }}" loop: - /boot/boot.txt Loading @@ -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: Loading @@ -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') }}"
roles/raspberrypi/tasks/prereq/Debian.yml +2 −4 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading Loading @@ -41,10 +41,8 @@ community.general.alternatives: path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy - name: Changing to ip6tables-legacy community.general.alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy
roles/raspberrypi/tasks/prereq/Raspbian.yml +2 −4 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading Loading @@ -41,10 +41,8 @@ community.general.alternatives: path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy - name: Changing to ip6tables-legacy community.general.alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy
roles/raspberrypi/tasks/prereq/Ubuntu.yml +2 −2 Original line number Diff line number Diff line Loading @@ -2,11 +2,11 @@ - name: Check if /boot/firmware/cmdline.txt exists ansible.builtin.stat: path: /boot/firmware/cmdline.txt register: boot_firmware_cmdline_txt register: raspberrypi_boot_file - name: Enable cgroup via boot commandline if not already enabled ansible.builtin.replace: path: "{{ (boot_firmware_cmdline_txt.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/firmware/current/cmdline.txt') }}" path: "{{ (raspberrypi_boot_file.stat.exists) | ternary('/boot/firmware/cmdline.txt', '/boot/firmware/current/cmdline.txt') }}" regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' replace: '\1 {{ cgroup_item }}' loop: Loading