From ed4bdb0987baa53e5f4437d294c8375b8d2f6a1f Mon Sep 17 00:00:00 2001 From: surtur Date: Wed, 2 Aug 2023 12:44:34 +0200 Subject: [PATCH] role(headscale): restart containers conditionally --- ansible/roles/headscale/tasks/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ansible/roles/headscale/tasks/main.yml b/ansible/roles/headscale/tasks/main.yml index e21adcd..05f3154 100644 --- a/ansible/roles/headscale/tasks/main.yml +++ b/ansible/roles/headscale/tasks/main.yml @@ -114,6 +114,8 @@ loop: - crt - key + when: caddyfile.changed or caddysystemd.changed + register: fetchcrt - name: Copy to altcrtpath ansible.builtin.copy: @@ -122,6 +124,7 @@ loop: - crt - key + when: fetchcrt.changed - name: Run headscale container containers.podman.podman_container: @@ -140,6 +143,7 @@ command: headscale serve vars: crtpath: "{{ headscale.altcrtpath }}/{{ headscale.dns.base_domain }}" + when: caddyfile.changed or caddysystemd.changed or fetchcrt.changed - name: Run headscale-ui container containers.podman.podman_container: @@ -149,4 +153,5 @@ image: "ghcr.io/gurucomputing/headscale-ui:{{ headscale.ui.version }}" ports: "{{ headscale.ui.ports }}" restart_policy: always + when: caddyfile.changed or caddysystemd.changed or fetchcrt.changed ...