From eafae2af3b834b3aee81283454640ac6f571dc5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 25 Aug 2023 09:00:36 +0300 Subject: [PATCH] Setup godoor before mjpeg-streamer for door controllers --- ansible-doors.yml | 52 ++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/ansible-doors.yml b/ansible-doors.yml index 45ba980..693a37b 100644 --- a/ansible-doors.yml +++ b/ansible-doors.yml @@ -7,6 +7,33 @@ ansible.builtin.apt: name: containerd state: present + + - name: Copy systemd service for Doorboy controller + copy: + dest: /etc/systemd/system/godoor.service + content: | + [Unit] + Description=Doorboy service + Documentation=https://git.k-space.ee/k-space/godoor + After=network.target + [Service] + Environment=IMAGE=harbor.k-space.ee/k-space/godoor:latest + ExecStartPre=-ctr task kill --signal=9 %N + ExecStartPre=-ctr task rm %N + ExecStartPre=-ctr c rm %N + ExecStartPre=-ctr image pull $IMAGE + ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor + ExecStopPost=ctr task rm %N + ExecStopPost=ctr c rm %N + [Install] + WantedBy=multi-user.target + Restart=always + - name: Enable Doorboy controller + ansible.builtin.systemd: + state: restarted + daemon_reload: yes + name: godoor.service + - name: Copy systemd service for mjpg-streamer copy: dest: /etc/systemd/system/mjpg_streamer@.service @@ -34,28 +61,3 @@ state: restarted daemon_reload: yes name: mjpg_streamer@video0.service - - name: Copy systemd service for Doorboy controller - copy: - dest: /etc/systemd/system/godoor.service - content: | - [Unit] - Description=Doorboy service - Documentation=https://git.k-space.ee/k-space/godoor - After=network.target - [Service] - Environment=IMAGE=harbor.k-space.ee/k-space/godoor:latest - ExecStartPre=-ctr task kill --signal=9 %N - ExecStartPre=-ctr task rm %N - ExecStartPre=-ctr c rm %N - ExecStartPre=-ctr image pull $IMAGE - ExecStart=ctr run --rm --pid-file=/run/%N.pid --privileged --read-only --env-file=/etc/godoor --env=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed --env=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll --env=KDOORPI_API_SWIPE=https://doorboy-proxy.k-space.ee/swipe --env=KDOORPI_DOOR=%H --net-host --net-host --cwd /app $IMAGE %N /godoor - ExecStopPost=ctr task rm %N - ExecStopPost=ctr c rm %N - [Install] - WantedBy=multi-user.target - Restart=always - - name: Enable Doorboy controller - ansible.builtin.systemd: - state: restarted - daemon_reload: yes - name: godoor.service