File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ k3s_cluster:
2626 # Optional vars
2727 # extra_server_args: ""
2828 # extra_agent_args: ""
29+ # extra_install_envs: { 'INSTALL_K3S_SKIP_SELINUX_RPM': 'true' }
2930 # cluster_context: k3s-ansible
3031 # api_port: 6443
3132 # k3s_server_location: /var/lib/rancher/k3s
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ k3s_server_location: "/var/lib/rancher/k3s" # noqa var-naming[no-role-prefix]
44systemd_dir : " /etc/systemd/system" # noqa var-naming[no-role-prefix]
55api_port : 6443 # noqa var-naming[no-role-prefix]
66extra_agent_args : " " # noqa var-naming[no-role-prefix]
7+ extra_install_envs : {} # noqa var-naming[no-role-prefix]
Original file line number Diff line number Diff line change 2929 - name : Download K3s binary
3030 ansible.builtin.command :
3131 cmd : /usr/local/bin/k3s-install.sh
32- environment :
33- INSTALL_K3S_SKIP_START : " true"
34- INSTALL_K3S_VERSION : " {{ k3s_version }}"
35- INSTALL_K3S_EXEC : " agent"
32+ # Ensures that extra_install_envs are combined with required env vars
33+ environment : >-
34+ {{ extra_install_envs | combine({
35+ "INSTALL_K3S_SKIP_START": "true",
36+ "INSTALL_K3S_SYSTEMD_DIR": systemd_dir,
37+ "INSTALL_K3S_VERSION": k3s_version,
38+ "INSTALL_K3S_EXEC": "agent"
39+ }) }}
3640 changed_when : true
3741
3842- name : Setup optional config file
Original file line number Diff line number Diff line change @@ -9,3 +9,4 @@ server_group: server # noqa var-naming[no-role-prefix]
99agent_group : agent # noqa var-naming[no-role-prefix]
1010use_external_database : false # noqa var-naming[no-role-prefix]
1111extra_server_args : " " # noqa var-naming[no-role-prefix]
12+ extra_install_envs : {} # noqa var-naming[no-role-prefix]
Original file line number Diff line number Diff line change 2929 - name : Download K3s binary
3030 ansible.builtin.command :
3131 cmd : /usr/local/bin/k3s-install.sh
32- environment :
33- INSTALL_K3S_SKIP_START : " true"
34- INSTALL_K3S_VERSION : " {{ k3s_version }}"
32+ # Ensures that extra_install_envs are combined with required env vars
33+ environment : >-
34+ {{ extra_install_envs | combine({
35+ "INSTALL_K3S_SKIP_START": "true",
36+ "INSTALL_K3S_VERSION": k3s_version,
37+ }) }}
3538 changed_when : true
3639
3740- name : Add K3s autocomplete to user bashrc
Original file line number Diff line number Diff line change 22systemd_dir : /etc/systemd/system # noqa var-naming[no-role-prefix]
33server_group : server # noqa var-naming[no-role-prefix]
44agent_group : agent # noqa var-naming[no-role-prefix]
5+ extra_install_envs : {} # noqa var-naming[no-role-prefix]
Original file line number Diff line number Diff line change 3535 - name : Install new K3s Version
3636 ansible.builtin.command :
3737 cmd : /usr/local/bin/k3s-install.sh
38- environment :
39- INSTALL_K3S_SKIP_START : " true"
40- INSTALL_K3S_VERSION : " {{ k3s_version }}"
38+ environment : >-
39+ {{ extra_install_envs | combine({
40+ "INSTALL_K3S_SKIP_START": "true",
41+ "INSTALL_K3S_VERSION": k3s_version,
42+ }) }}
4143 changed_when : true
4244
4345 - name : Restore K3s service
You can’t perform that action at this time.
0 commit comments