From d492b400fad690b679bd067e21310a43a4d162b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Sat, 12 Aug 2023 13:20:03 +0300 Subject: [PATCH] Add door controller setup --- ansible-doors.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 ansible-doors.yml diff --git a/ansible-doors.yml b/ansible-doors.yml new file mode 100644 index 0000000..41d6893 --- /dev/null +++ b/ansible-doors.yml @@ -0,0 +1,49 @@ +# ansible doors -m shell -a "ctr image pull harbor.k-space.ee/k-space/mjpg-streamer:latest" +# journalctl -u mjpg_streamer@video0.service -f +- name: Setup doors + hosts: doors + tasks: + - name: Make sure containerd is installed + ansible.builtin.apt: + name: containerd + state: present + - name: Copy systemd service for mjpg-streamer + copy: + dest: /etc/systemd/system/mjpg_streamer@.service + content: | + [Unit] + Description=A server for streaming Motion-JPEG from a video capture device + After=network.target + ConditionPathExists=/dev/%I + [Service] + ExecStart=ctr run --rm --privileged --read-only --net-host harbor.k-space.ee/k-space/mjpg-streamer:latest mjpg-streamer /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I' -o 'output_http.so -w /usr/share/mjpg_streamer/www' + [Install] + WantedBy=multi-user.target + - name: Enable Doorboy controller + ansible.builtin.systemd: + 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 + [Service] + EnvironmentFile=/etc/godoor + Environment=KDOORPI_API_ALLOWED=https://doorboy-proxy.k-space.ee/allowed + Environment=KDOORPI_API_LONGPOLL=https://doorboy-proxy.k-space.ee/longpoll + Environment=KDOORPI_API_SWIPE=https://inventory.k-space.ee/swipes + Environment=KDOORPI_DOOR=%H + ExecStart=/usr/local/bin/godoor + User=root + Restart=always + [Install] + WantedBy=multi-user.target + - name: Enable Doorboy controller + ansible.builtin.systemd: + state: restarted + daemon_reload: yes + name: godoor.service