From 50231edbe168a1a9b9082f50859d31b7da3c3e9d Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Mon, 31 Jul 2023 00:07:34 +0200 Subject: [PATCH] Ensure K3S service is enabled after running the role It is not given that handlers are run under every circumstance. Define as a task the state we want the K3S service to be in. --- handlers/main.yml | 1 - tasks/main.yml | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index 83595b0..308ba3b 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -14,7 +14,6 @@ ansible.builtin.systemd: name: "{{ k3s_service }}" state: restarted - enabled: true - name: Reload systemd become: true diff --git a/tasks/main.yml b/tasks/main.yml index 057eee4..224f094 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -171,6 +171,12 @@ mode: "0755" content: "{{ item.content }}" +- name: Start and enable K3S + ansible.builtin.systemd: + name: "{{ k3s_service }}" + state: started + enabled: true + - name: Flush handlers ansible.builtin.meta: flush_handlers