services/irc-bot: Add WIP Cam relay

This commit is contained in:
polyfloyd 2023-09-10 18:20:49 +02:00
parent c94f9179c5
commit 1a26f81be6
4 changed files with 65 additions and 0 deletions

View file

@ -13,6 +13,12 @@
state: restarted
daemon_reload: true
- name: restart irc-photos
systemd:
name: irc-photos
state: restarted
daemon_reload: true
- name: restart discord-bot
systemd:
name: discord-bot

View file

@ -28,3 +28,33 @@
state: started
enabled: yes
daemon_reload: true
- name: Create helpers dir
file:
path: /var/lib/irc-helpers
state: directory
- name: Install photos notification
template:
src: irc-photos.sh
dest: /var/lib/irc-helpers/photos.sh
owner: root
group: root
mode: 0755
notify: restart irc-photos
- name: Install photos notification service
template:
src: irc-photos.service
dest: /etc/systemd/system/irc-photos.service
owner: root
group: root
mode: 0644
notify: restart irc-photos
- name: Start irc-photos
systemd:
name: irc-photos
state: started
enabled: yes
daemon_reload: true

View file

@ -0,0 +1,16 @@
# Managed by Ansible
[Unit]
Description=Bitlair IRC photos notification
After=network.target
Requires=irc-bot.service
[Service]
Type=simple
ExecStart=/bin/bash /var/lib/irc-helpers/photos.sh
Restart=on-failure
RestartSec=10s
DynamicUser=true
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,13 @@
#!/bin/basho
# Managed by Ansible
set -eu
set -o pipefail
mqtt-simple -h mqtt.bitlair.nl -s "bitlair/photos" |
while read event; do
path=$(echo $event | cut -d ' ' -f 2)
url="https://bitlair.nl/fotos/view/$path"
irc-say "WIP: $url"
done