k3s-ansible icon indicating copy to clipboard operation
k3s-ansible copied to clipboard

Fix raspbian role on centos

Open miff2000 opened this issue 4 years ago • 1 comments

CentOS based OSes don't have the contents of ansible_facts.lsb.description populated by Ansible facts gathering, so the detection of Raspbian causes the playbook to fail with this on Ansible 2.8.11:

TASK [raspbian : Test for Raspbian] ******************************************************************************************************************************************
fatal: [k3s-node-01]: FAILED! => {}

MSG:

Unexpected templating type error occurred on ({% 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 %}): expected string or bytes-like object

on Ansible 2.9.13 this is the error:

TASK [raspbian : Test for Raspbian] *******************************************************************************************************************************************************
fatal: [k3s-node-01]: FAILED! => {}

MSG:

The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'description'

The error appears to be in '/home/matt.calvert/git/ansible/k3s/roles/raspbian/tasks/main.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

---
- name: Test for Raspbian
  ^ here

This MR changes the logic so that raspbian is set to false by default, and it gets set to true by the existing set_fact task if a raspbian OS is detected.

miff2000 avatar Sep 04 '20 15:09 miff2000

Those linting issues are not my doing. I can fix though if you want?

miff2000 avatar Sep 04 '20 15:09 miff2000

Overridden by https://github.com/k3s-io/k3s-ansible/pull/79

dereknola avatar Nov 07 '23 17:11 dereknola