Skip to content

Commit

Permalink
Add a handler to restart the K3s Server when the service file changes
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Klijn <[email protected]>
  • Loading branch information
peterklijn committed Jul 6, 2024
1 parent 31b8b1e commit 4c31a36
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions roles/k3s_server/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Restart K3s Server
ansible.builtin.systemd:
name: k3s
daemon_reload: true
state: restarted
4 changes: 4 additions & 0 deletions roles/k3s_server/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
owner: root
group: root
mode: "0644"
notify: Restart K3s Server

- name: Copy K3s service file [HA]
when:
Expand All @@ -76,6 +77,7 @@
owner: root
group: root
mode: "0644"
notify: Restart K3s Server

- name: Add service environment variables
when: extra_service_envs is defined
Expand Down Expand Up @@ -159,6 +161,7 @@
owner: root
group: root
mode: "0644"
notify: Restart K3s Server

- name: Copy K3s service file [External DB]
when:
Expand All @@ -170,6 +173,7 @@
owner: root
group: root
mode: "0644"
notify: Restart K3s Server

- name: Enable and check K3s service
ansible.builtin.systemd:
Expand Down

0 comments on commit 4c31a36

Please sign in to comment.