Compare commits
3 commits
2698e8a613
...
7529832dea
Author | SHA1 | Date | |
---|---|---|---|
7529832dea | |||
3d6d71e068 | |||
0d2fc3ebb5 |
5 changed files with 65 additions and 19 deletions
|
@ -2,9 +2,9 @@
|
|||
- ansible.builtin.import_tasks:
|
||||
file: ../../common/handlers/main.yaml
|
||||
|
||||
- name: Restart irc-bot
|
||||
- name: Restart ircbot
|
||||
ansible.builtin.systemd:
|
||||
name: irc-bot
|
||||
name: ircbot
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
|
@ -20,12 +20,18 @@
|
|||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart discord-bot
|
||||
- name: restart discord-bot
|
||||
ansible.builtin.systemd:
|
||||
name: discord-bot
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: restart irc-bot
|
||||
ansible.builtin.systemd:
|
||||
name: irc-bot
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart siahsd
|
||||
ansible.builtin.systemd:
|
||||
name: siahsd
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
version: main
|
||||
dest: /var/lib/bottle-clip
|
||||
accept_hostkey: yes
|
||||
notify: Restart discord-bot
|
||||
|
||||
- name: Clone discord-bot source
|
||||
ansible.builtin.git:
|
||||
|
@ -26,22 +25,36 @@
|
|||
version: main
|
||||
dest: /var/lib/discord-bot
|
||||
accept_hostkey: yes
|
||||
notify: Restart discord-bot
|
||||
notify:
|
||||
- restart discord-bot
|
||||
- restart irc-bot
|
||||
|
||||
- name: Install Python dependencies
|
||||
ansible.builtin.shell:
|
||||
cmd: . .venv/bin/activate && pip install -r requirements.txt
|
||||
cmd: . .venv/bin/activate && pip install -e .
|
||||
args:
|
||||
chdir: /var/lib/discord-bot
|
||||
notify:
|
||||
- restart discord-bot
|
||||
- restart irc-bot
|
||||
|
||||
- name: Install service file
|
||||
- name: Install discord-bot service file
|
||||
ansible.builtin.template:
|
||||
src: discord-bot.service
|
||||
dest: /etc/systemd/system/discord-bot.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: Restart discord-bot
|
||||
notify: restart discord-bot
|
||||
|
||||
- name: Install irc-bot service file
|
||||
ansible.builtin.template:
|
||||
src: irc-bot.service
|
||||
dest: /etc/systemd/system/irc-bot.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: restart irc-bot
|
||||
|
||||
- name: Start discord-bot
|
||||
ansible.builtin.systemd:
|
||||
|
@ -49,3 +62,10 @@
|
|||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
||||
- name: Start irc-bot
|
||||
ansible.builtin.systemd:
|
||||
name: irc-bot
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
dest: /var/lib/irc-bot
|
||||
accept_hostkey: yes
|
||||
ignore_errors: true
|
||||
notify: Restart irc-bot
|
||||
notify: Restart ircbot
|
||||
|
||||
- name: Link irc-say
|
||||
ansible.builtin.file:
|
||||
|
@ -17,18 +17,18 @@
|
|||
- name: Install service file
|
||||
ansible.builtin.template:
|
||||
src: generic.service
|
||||
dest: /etc/systemd/system/irc-bot.service
|
||||
dest: /etc/systemd/system/ircbot.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
vars:
|
||||
description: Bitlair IRC bot
|
||||
exec: /bin/bash /var/lib/irc-bot/irc-bot
|
||||
notify: Restart irc-bot
|
||||
notify: Restart ircbot
|
||||
|
||||
- name: Start irc-bot
|
||||
- name: Start ircbot
|
||||
ansible.builtin.systemd:
|
||||
name: irc-bot
|
||||
name: ircbot
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
@ -56,7 +56,7 @@
|
|||
mode: 0644
|
||||
vars:
|
||||
description: Bitlair IRC photos notification
|
||||
requires: irc-bot.service
|
||||
requires: ircbot.service
|
||||
exec: /bin/bash /var/lib/irc-helpers/photos.sh
|
||||
notify: Restart irc-photos
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
mode: 0644
|
||||
vars:
|
||||
description: Bitlair IRC doorduino notification
|
||||
requires: irc-bot.service
|
||||
requires: ircbot.service
|
||||
exec: /bin/bash /var/lib/irc-helpers/doorduino.sh
|
||||
notify: Restart irc-doorduino
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=HobbyBot
|
||||
Description=Bitlair Discord Bot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
ExecStart=/var/lib/discord-bot/.venv/bin/python /var/lib/discord-bot/main.py
|
||||
ExecStart=/var/lib/discord-bot/.venv/bin/python /var/lib/discord-bot/discordbot.py
|
||||
DynamicUser=true
|
||||
Environment="MQTT_HOST={{ mqtt_internal_host }}"
|
||||
Environment="BOTTLECLIP_RESOURCES=/var/lib/bottle-clip"
|
||||
Environment="DISCORD_WEBHOOK_URL={{ lookup('passwordstore', 'services/discord', subkey='webhook_url') }}"
|
||||
Environment="DISCORD_TOKEN={{ lookup('passwordstore', 'services/discord', subkey='token') }}"
|
||||
Environment="BOTTLECLIP_RESOURCES=/var/lib/bottle-clip"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
20
roles/services/templates/irc-bot.service
Normal file
20
roles/services/templates/irc-bot.service
Normal file
|
@ -0,0 +1,20 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
[Unit]
|
||||
Description=Bitlair IRC Bot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
ExecStart=/var/lib/discord-bot/.venv/bin/python /var/lib/discord-bot/ircbot.py
|
||||
DynamicUser=true
|
||||
Environment="MQTT_HOST={{ mqtt_internal_host }}"
|
||||
Environment="BOTTLECLIP_RESOURCES=/var/lib/bottle-clip"
|
||||
Environment="IRC_SERVER=irc.smurfnet.ch"
|
||||
Environment="IRC_CHANNEL=#bitlair-bot-test"
|
||||
Environment="IRC_NICK=Bitlair"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Add table
Add a link
Reference in a new issue