# 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] Environment=IMAGE=harbor.k-space.ee/k-space/mjpg-streamer:latest StandardOutput=tty Type=forking ExecStartPre=-ctr task kill --signal=9 %p_%i ExecStartPre=-ctr task rm %p_%i ExecStartPre=-ctr c rm %p_%i ExecStartPre=ctr image pull $IMAGE ExecStart=ctr run --tty -d --rm --pid-file=/run/%i.pid --privileged --read-only --net-host $IMAGE %p_%i /usr/local/bin/mjpg_streamer -i 'input_uvc.so -d /dev/%I -r 1280x720 -f 10' -o 'output_http.so -w /usr/share/mjpg_streamer/www' ExecStopPost=ctr task rm %p_%i ExecStopPost=ctr c rm %p_%i PIDFile=/run/%i.pid [Install] WantedBy=multi-user.target - name: Enable mjpg-streamer 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