mirror of
https://github.com/k3s-io/k3s-ansible.git
synced 2025-12-25 00:12:37 +01:00
Move k3s_server_location to inventory vars
- All environemt variables are now in one place - Add --data-dir option to agent and init service Signed-off-by: Derek Nola <derek.nola@suse.com>
This commit is contained in:
committed by
Derek Nola
parent
5b3e2a5db6
commit
cd725780f5
@@ -1,2 +0,0 @@
|
||||
---
|
||||
k3s_server_location: /var/lib/rancher/k3s
|
||||
@@ -10,7 +10,8 @@
|
||||
ansible.builtin.command:
|
||||
cmd: >
|
||||
systemd-run -p RestartSec=2 -p Restart=on-failure --unit=k3s-init k3s server
|
||||
--cluster-init --tls-san {{ api_endpoint }} {{ extra_server_args | default('') }}
|
||||
--cluster-init --tls-san {{ api_endpoint }} --data-dir {{ k3s_server_location }}
|
||||
{{ extra_server_args | default('') }}
|
||||
creates: "{{ systemd_dir }}/k3s-init.service"
|
||||
when: groups['server'] | length > 1
|
||||
|
||||
@@ -18,7 +19,7 @@
|
||||
ansible.builtin.command:
|
||||
cmd: >
|
||||
systemd-run -p RestartSec=2 -p Restart=on-failure --unit=k3s-init k3s server
|
||||
--tls-san {{ api_endpoint }} { extra_server_args | default('') }}
|
||||
--tls-san {{ api_endpoint }} --data-dir {{ k3s_server_location }} { extra_server_args | default('') }}
|
||||
creates: "{{ systemd_dir }}/k3s-init.service"
|
||||
when: groups['server'] | length == 1
|
||||
|
||||
@@ -84,7 +85,7 @@
|
||||
cmd: >
|
||||
systemd-run -p RestartSec=2 -p Restart=on-failure --unit=k3s-init k3s server --token "{{ hostvars[groups['server'][0]]['token'] }}"
|
||||
--server https://{{ hostvars[groups['server'][0]]['ansible_host'] | default(groups['server'][0]) }}:{{ api_port }}
|
||||
{{ extra_server_args | default('') }}
|
||||
--data-dir {{ k3s_server_location }} {{ extra_server_args | default('') }}
|
||||
creates: "{{ systemd_dir }}/k3s-init.service"
|
||||
when: ansible_hostname != groups['server'][0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user