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