Refactor k3s version installation logic to use a ternary filter for cleaner syntax in main.yml.

This commit is contained in:
chrisfu 2026-01-28 13:42:09 -08:00
parent 887c485c32
commit 852b1f8949

View File

@ -87,7 +87,7 @@
curl -sfL https://get.k3s.io | sh -
environment:
INSTALL_K3S_EXEC: "{{ k3s_role }}"
INSTALL_K3S_VERSION: "{{ k3s_version if (k3s_version | length > 0) else omit }}"
{{ (k3s_version | length > 0) | ternary({'INSTALL_K3S_VERSION': k3s_version}, {}) }}
args:
creates: /usr/local/bin/k3s
when: k3s_needs_install