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) }}"