mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Inject installation envs for install script (#433)
Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
@@ -26,6 +26,7 @@ k3s_cluster:
|
|||||||
# Optional vars
|
# Optional vars
|
||||||
# extra_server_args: ""
|
# extra_server_args: ""
|
||||||
# extra_agent_args: ""
|
# extra_agent_args: ""
|
||||||
|
# extra_install_envs: { 'INSTALL_K3S_SKIP_SELINUX_RPM': 'true' }
|
||||||
# cluster_context: k3s-ansible
|
# cluster_context: k3s-ansible
|
||||||
# api_port: 6443
|
# api_port: 6443
|
||||||
# k3s_server_location: /var/lib/rancher/k3s
|
# k3s_server_location: /var/lib/rancher/k3s
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ k3s_server_location: "/var/lib/rancher/k3s" # noqa var-naming[no-role-prefix]
|
|||||||
systemd_dir: "/etc/systemd/system" # noqa var-naming[no-role-prefix]
|
systemd_dir: "/etc/systemd/system" # noqa var-naming[no-role-prefix]
|
||||||
api_port: 6443 # noqa var-naming[no-role-prefix]
|
api_port: 6443 # noqa var-naming[no-role-prefix]
|
||||||
extra_agent_args: "" # noqa var-naming[no-role-prefix]
|
extra_agent_args: "" # noqa var-naming[no-role-prefix]
|
||||||
|
extra_install_envs: {} # noqa var-naming[no-role-prefix]
|
||||||
|
|||||||
@@ -27,12 +27,18 @@
|
|||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Download K3s binary
|
- 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
|
cmd: /usr/local/bin/k3s-install.sh
|
||||||
environment:
|
# Ensures that extra_install_envs are combined with required env vars
|
||||||
INSTALL_K3S_SKIP_START: "true"
|
environment: >-
|
||||||
INSTALL_K3S_VERSION: "{{ k3s_version }}"
|
{{ extra_install_envs | combine({
|
||||||
INSTALL_K3S_EXEC: "agent"
|
"INSTALL_K3S_SKIP_START": "true",
|
||||||
|
"INSTALL_K3S_SYSTEMD_DIR": systemd_dir,
|
||||||
|
"INSTALL_K3S_VERSION": k3s_version,
|
||||||
|
"INSTALL_K3S_EXEC": "agent"
|
||||||
|
}) }}
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|
||||||
- name: Setup optional config file
|
- name: Setup optional config file
|
||||||
|
|||||||
@@ -9,3 +9,4 @@ server_group: server # noqa var-naming[no-role-prefix]
|
|||||||
agent_group: agent # 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]
|
use_external_database: false # noqa var-naming[no-role-prefix]
|
||||||
extra_server_args: "" # noqa var-naming[no-role-prefix]
|
extra_server_args: "" # noqa var-naming[no-role-prefix]
|
||||||
|
extra_install_envs: {} # noqa var-naming[no-role-prefix]
|
||||||
|
|||||||
@@ -27,11 +27,16 @@
|
|||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Download K3s binary
|
- 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
|
cmd: /usr/local/bin/k3s-install.sh
|
||||||
environment:
|
# Ensures that extra_install_envs are combined with required env vars
|
||||||
INSTALL_K3S_SKIP_START: "true"
|
environment: >-
|
||||||
INSTALL_K3S_VERSION: "{{ k3s_version }}"
|
{{ extra_install_envs | combine({
|
||||||
|
"INSTALL_K3S_SKIP_START": "true",
|
||||||
|
"INSTALL_K3S_VERSION": k3s_version,
|
||||||
|
}) }}
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|
||||||
- name: Add K3s autocomplete to user bashrc
|
- name: Add K3s autocomplete to user bashrc
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
systemd_dir: /etc/systemd/system # noqa var-naming[no-role-prefix]
|
systemd_dir: /etc/systemd/system # noqa var-naming[no-role-prefix]
|
||||||
server_group: server # noqa var-naming[no-role-prefix]
|
server_group: server # noqa var-naming[no-role-prefix]
|
||||||
agent_group: agent # noqa var-naming[no-role-prefix]
|
agent_group: agent # noqa var-naming[no-role-prefix]
|
||||||
|
extra_install_envs: {} # noqa var-naming[no-role-prefix]
|
||||||
|
|||||||
@@ -33,11 +33,15 @@
|
|||||||
loop: "{{ k3s_service_files.files }}"
|
loop: "{{ k3s_service_files.files }}"
|
||||||
|
|
||||||
- name: Install new K3s Version
|
- name: Install new K3s Version
|
||||||
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
|
cmd: /usr/local/bin/k3s-install.sh
|
||||||
environment:
|
environment: >-
|
||||||
INSTALL_K3S_SKIP_START: "true"
|
{{ extra_install_envs | combine({
|
||||||
INSTALL_K3S_VERSION: "{{ k3s_version }}"
|
"INSTALL_K3S_SKIP_START": "true",
|
||||||
|
"INSTALL_K3S_VERSION": k3s_version,
|
||||||
|
}) }}
|
||||||
changed_when: true
|
changed_when: true
|
||||||
|
|
||||||
- name: Restore K3s service
|
- name: Restore K3s service
|
||||||
|
|||||||
Reference in New Issue
Block a user