Add door controller setup

This commit is contained in:
Lauri Võsandi 2023-08-12 13:20:03 +03:00
parent 612e788d9b
commit d492b400fa

49
ansible-doors.yml Normal file
View File

@ -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