From 6534ecaa83a3a8b63efb7c5fb6d1583414a24244 Mon Sep 17 00:00:00 2001 From: David Putzolu Date: Sat, 30 May 2020 08:21:34 -0700 Subject: [PATCH 1/3] Fix to make work on Raspbian64 --- roles/raspbian/tasks/main.yml | 41 ++++++++++++++++------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 9fcd127..845e43e 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -1,47 +1,44 @@ --- - - name: Test for Raspbian - stat: - path: /boot/cmdline.txt - register: cmdline + set_fact: + raspbian: '{% if + ( ansible_facts.architecture is search("arm") and + ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") ) or + ( ansible_facts.architecture is search("aarch64") and + ansible_facts.lsb.description is match("Debian.*buster") ) %}true{% else %}false{% endif %}' -- name: Activating cgroup on Raspbian +- name: Activating cgroup support lineinfile: path: /boot/cmdline.txt - regexp: '^(.*rootwait)$' + regexp: '^((?!.*\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).*)$' line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory' backrefs: true when: - - cmdline.stat.path is defined - - ansible_facts.architecture is search("arm") - register: boot_cmdline + - raspbian is true -- name: Flush iptables before changing iptables-legacy +- name: Flush iptables before changing to iptables-legacy iptables: flush: true when: - - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") + - raspbian is true -- name: Changing to iptables-legacy for Raspbian Buster +- name: Changing to iptables-legacy alternatives: path: /usr/sbin/iptables-legacy name: iptables - register: ip6_legacy + register: ip4_legacy when: - - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") + - raspbian is true -- name: Changing to ip6tables-legacy for Raspbian Buster +- name: Changing to ip6tables-legacy alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables - register: ip4_legacy + register: ip6_legacy when: - - ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") + - raspbian is true -- name: Rebooting on Raspbian +- name: Rebooting reboot: when: - - boot_cmdline is changed - - ansible_facts.architecture is search("arm") - - ip6_legacy is changed - - ip4_legacy is changed + - raspbian is true \ No newline at end of file From 3911f28d2a2060db7538112632288416ce2e9146 Mon Sep 17 00:00:00 2001 From: David Putzolu Date: Sat, 30 May 2020 09:54:34 -0700 Subject: [PATCH 2/3] Fix image downloading for Raspbian64 --- roles/download/tasks/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index f1aa998..e0f2c90 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -22,8 +22,9 @@ group: root mode: 0755 when: - - ansible_facts.architecture is search("arm") - - ansible_facts.userspace_bits == "64" + - ( ansible_facts.architecture is search("arm") and + ansible_facts.userspace_bits == "64" ) or + ansible_facts.architecture is search("aarch64") - name: Download k3s binary armhf get_url: From afbe4aceb69c14795f4389942096857545b4819b Mon Sep 17 00:00:00 2001 From: David Putzolu Date: Sat, 30 May 2020 12:07:35 -0700 Subject: [PATCH 3/3] Add missing newline at eof --- roles/raspbian/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/raspbian/tasks/main.yml b/roles/raspbian/tasks/main.yml index 845e43e..a857249 100644 --- a/roles/raspbian/tasks/main.yml +++ b/roles/raspbian/tasks/main.yml @@ -41,4 +41,4 @@ - name: Rebooting reboot: when: - - raspbian is true \ No newline at end of file + - raspbian is true