From edf0c9eebd14c1c2eae03fccda49b534866c6ac5 Mon Sep 17 00:00:00 2001 From: egandro Date: Fri, 19 Jan 2024 15:37:14 +0100 Subject: [PATCH] fix for recreating new control planes (2nd run) (#393) Co-authored-by: Harald Fielker Co-authored-by: Techno Tim --- roles/k3s_server/tasks/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/roles/k3s_server/tasks/main.yml b/roles/k3s_server/tasks/main.yml index 60b063db1..5a396e0b6 100644 --- a/roles/k3s_server/tasks/main.yml +++ b/roles/k3s_server/tasks/main.yml @@ -6,6 +6,13 @@ state: stopped failed_when: false +# k3s-init won't work if the port is already in use +- name: Stop k3s + systemd: + name: k3s + state: stopped + failed_when: false + - name: Clean previous runs of k3s-init # noqa command-instead-of-module # The systemd module does not support "reset-failed", so we need to resort to command. command: systemctl reset-failed k3s-init @@ -29,7 +36,7 @@ -p Restart=on-failure \ --unit=k3s-init \ k3s server {{ server_init_args }}" - creates: "{{ systemd_dir }}/k3s.service" + creates: "{{ systemd_dir }}/k3s-init.service" - name: Verification when: not ansible_check_mode