services/discord_bot: Update deployment
This commit is contained in:
parent
2698e8a613
commit
0d2fc3ebb5
3 changed files with 10 additions and 10 deletions
|
@ -20,7 +20,7 @@
|
|||
state: restarted
|
||||
daemon_reload: true
|
||||
|
||||
- name: Restart discord-bot
|
||||
- name: restart discord-bot
|
||||
ansible.builtin.systemd:
|
||||
name: discord-bot
|
||||
state: restarted
|
||||
|
|
|
@ -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,23 @@
|
|||
version: main
|
||||
dest: /var/lib/discord-bot
|
||||
accept_hostkey: yes
|
||||
notify: Restart discord-bot
|
||||
notify: restart discord-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
|
||||
|
||||
- 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: Start discord-bot
|
||||
ansible.builtin.systemd:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue