Inject installation envs for install script (#433)

Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
Derek Nola
2025-08-26 09:57:53 -07:00
committed by GitHub
parent 5a194381b0
commit cd543a660d
7 changed files with 32 additions and 13 deletions

View File

@@ -9,3 +9,4 @@ server_group: server # noqa var-naming[no-role-prefix]
agent_group: agent # noqa var-naming[no-role-prefix]
use_external_database: false # noqa var-naming[no-role-prefix]
extra_server_args: "" # noqa var-naming[no-role-prefix]
extra_install_envs: {} # noqa var-naming[no-role-prefix]

View File

@@ -27,11 +27,16 @@
mode: "0755"
- name: Download K3s binary
ansible.builtin.command:
# For some reason, ansible-lint thinks using enviroment with command is an error
# even though its valid https://ansible.readthedocs.io/projects/lint/rules/inline-env-var/#correct-code
ansible.builtin.command: # noqa inline-env-var
cmd: /usr/local/bin/k3s-install.sh
environment:
INSTALL_K3S_SKIP_START: "true"
INSTALL_K3S_VERSION: "{{ k3s_version }}"
# Ensures that extra_install_envs are combined with required env vars
environment: >-
{{ extra_install_envs | combine({
"INSTALL_K3S_SKIP_START": "true",
"INSTALL_K3S_VERSION": k3s_version,
}) }}
changed_when: true
- name: Add K3s autocomplete to user bashrc