role(headscale): restart containers conditionally

This commit is contained in:
surtur 2023-08-02 12:44:34 +02:00
parent eb0da91152
commit ed4bdb0987
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI

@ -114,6 +114,8 @@
loop: loop:
- crt - crt
- key - key
when: caddyfile.changed or caddysystemd.changed
register: fetchcrt
- name: Copy to altcrtpath - name: Copy to altcrtpath
ansible.builtin.copy: ansible.builtin.copy:
@ -122,6 +124,7 @@
loop: loop:
- crt - crt
- key - key
when: fetchcrt.changed
- name: Run headscale container - name: Run headscale container
containers.podman.podman_container: containers.podman.podman_container:
@ -140,6 +143,7 @@
command: headscale serve command: headscale serve
vars: vars:
crtpath: "{{ headscale.altcrtpath }}/{{ headscale.dns.base_domain }}" crtpath: "{{ headscale.altcrtpath }}/{{ headscale.dns.base_domain }}"
when: caddyfile.changed or caddysystemd.changed or fetchcrt.changed
- name: Run headscale-ui container - name: Run headscale-ui container
containers.podman.podman_container: containers.podman.podman_container:
@ -149,4 +153,5 @@
image: "ghcr.io/gurucomputing/headscale-ui:{{ headscale.ui.version }}" image: "ghcr.io/gurucomputing/headscale-ui:{{ headscale.ui.version }}"
ports: "{{ headscale.ui.ports }}" ports: "{{ headscale.ui.ports }}"
restart_policy: always restart_policy: always
when: caddyfile.changed or caddysystemd.changed or fetchcrt.changed
... ...