k3s-io / k3s-ansible

Apache License 2.0
2.01k stars 802 forks source link

fix: yaml conditional logic #273

Closed danihodovic closed 9 months ago

danihodovic commented 10 months ago

Running the playbook with version 2.16.1 I get a templating error in the conditional checks. I don't think '&&' can be used a logical AND.

Linked Issues

https://github.com/k3s-io/k3s-ansible/issues/276

TASK [k3s_server : Merge with any existing kube config] *********************************************************************************************************************
fatal: [78.47.92.188 -> 127.0.0.1]: FAILED! => {"msg": "The conditional check 'kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0' failed. The error was: template error while templating string: unexpected char '&' at 41. String: {% if kubeconfig == \"~/.kube/config.new\" && kubectl_installed.rc == 0 %} True {% else %} False {% endif %}. unexpected char '&' at 41\n\nThe error appears to be in '/home/dani/repos/my-cluster/k3s-ansible/roles/k3s_server/tasks/main.yml': line 128, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Merge with any existing kube config\n      ^ here\n"}