k3s-ansible
k3s-ansible copied to clipboard
Raspbian Task main.yml generates a syntax error
The 'when' conditionals (bolded below) in the raspbian task main.yml generate a syntax error (see below). Update them to 'raspbian == true' to resolve the syntax.
-
name: Activating cgroup support lineinfile: path: /boot/cmdline.txt regexp: '^((?!.\bcgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory\b).)$' line: '\1 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory' backrefs: true notify: reboot **when:
- raspbian is true**
-
name: Flush iptables before changing to iptables-legacy iptables: flush: true when: raspbian changed_when: false # iptables flush always returns changed
-
name: Changing to iptables-legacy alternatives: path: /usr/sbin/iptables-legacy name: iptables register: ip4_legacy when: raspbian
-
name: Changing to ip6tables-legacy alternatives: path: /usr/sbin/ip6tables-legacy name: ip6tables register: ip6_legacy when: raspbian
syntax error:
"The conditional check 'raspbian is true' failed. The error was: template error while templating string: no test named 'true'. String: {% if raspbian is true %} True {% else %} False {% endif %}
Same issue, but the set_fact code:
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") or
ansible_facts.lsb.description is match("[Rr]aspbian.*[Bb]uster") ) %}true{% else %}false{% endif %}'
led me to try this patch in the 4 steps below:
when:
- raspbian == 'true'
Untested, except on x86 where it didn't obviously break anything.
Fixed with https://github.com/k3s-io/k3s-ansible/pull/151