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
|
state: restarted
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Restart discord-bot
|
- name: restart discord-bot
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
name: discord-bot
|
name: discord-bot
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
version: main
|
version: main
|
||||||
dest: /var/lib/bottle-clip
|
dest: /var/lib/bottle-clip
|
||||||
accept_hostkey: yes
|
accept_hostkey: yes
|
||||||
notify: Restart discord-bot
|
|
||||||
|
|
||||||
- name: Clone discord-bot source
|
- name: Clone discord-bot source
|
||||||
ansible.builtin.git:
|
ansible.builtin.git:
|
||||||
|
@ -26,22 +25,23 @@
|
||||||
version: main
|
version: main
|
||||||
dest: /var/lib/discord-bot
|
dest: /var/lib/discord-bot
|
||||||
accept_hostkey: yes
|
accept_hostkey: yes
|
||||||
notify: Restart discord-bot
|
notify: restart discord-bot
|
||||||
|
|
||||||
- name: Install Python dependencies
|
- name: Install Python dependencies
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: . .venv/bin/activate && pip install -r requirements.txt
|
cmd: . .venv/bin/activate && pip install -e .
|
||||||
args:
|
args:
|
||||||
chdir: /var/lib/discord-bot
|
chdir: /var/lib/discord-bot
|
||||||
|
notify: restart discord-bot
|
||||||
|
|
||||||
- name: Install service file
|
- name: Install discord-bot service file
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: discord-bot.service
|
src: discord-bot.service
|
||||||
dest: /etc/systemd/system/discord-bot.service
|
dest: /etc/systemd/system/discord-bot.service
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
notify: Restart discord-bot
|
notify: restart discord-bot
|
||||||
|
|
||||||
- name: Start discord-bot
|
- name: Start discord-bot
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
# {{ ansible_managed }}
|
# {{ ansible_managed }}
|
||||||
|
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=HobbyBot
|
Description=Bitlair Discord Bot
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Restart=on-failure
|
Restart=always
|
||||||
RestartSec=10s
|
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
|
DynamicUser=true
|
||||||
Environment="MQTT_HOST={{ mqtt_internal_host }}"
|
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_WEBHOOK_URL={{ lookup('passwordstore', 'services/discord', subkey='webhook_url') }}"
|
||||||
Environment="DISCORD_TOKEN={{ lookup('passwordstore', 'services/discord', subkey='token') }}"
|
Environment="DISCORD_TOKEN={{ lookup('passwordstore', 'services/discord', subkey='token') }}"
|
||||||
Environment="BOTTLECLIP_RESOURCES=/var/lib/bottle-clip"
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue