From 677db09b4aab8286a68484ce58370352339d388e Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Mon, 20 Dec 2021 21:06:10 +0000 Subject: [PATCH] fix(start): annoying behaviour where k3s won't start as a single node in ha etcd #152 --- tasks/build/install-k3s.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tasks/build/install-k3s.yml b/tasks/build/install-k3s.yml index f2fc34d..202aaf4 100644 --- a/tasks/build/install-k3s.yml +++ b/tasks/build/install-k3s.yml @@ -17,6 +17,11 @@ - include_tasks: install-k3s-node.yml when: k3s_build_cluster +- name: Determine if the systems are already clustered + ansible.builtin.stat: + path: "{{ k3s_token_location }}" + register: k3s_token_cluster_check + - name: Ensure k3s initial control plane server is started ansible.builtin.systemd: name: k3s @@ -29,4 +34,5 @@ - not ansible_check_mode when: (k3s_control_node and k3s_controller_list | length == 1) or (k3s_primary_control_node and k3s_controller_list | length > 1) + or k3s_token_cluster_check.stat.exists become: "{{ k3s_become_for_systemd | ternary(true, false, k3s_become_for_all) }}"