ansible/roles/services/tasks/discord_bot.yaml

41 lines
884 B
YAML

---
- name: Install dependencies
apt:
name:
- python3-paho-mqtt
- python3-tz
- virtualenv
- name: Create virtualenv
command: virtualenv /opt/miflora_exporter/.venv
args:
creates: /var/lib/discord-bot/.venv
- name: Install Python dependencies
shell: . .venv/bin/activate && pip install -r requirements.txt
args:
chdir: /var/lib/discord-bot
- name: Clone source
git:
repo: https://github.com/bitlair/discord-bot.git
version: main
dest: /var/lib/discord-bot
accept_hostkey: yes
notify: restart discord-bot
- name: Install service file
template:
src: discord-bot.service
dest: /etc/systemd/system/discord-bot.service
owner: root
group: root
mode: 0644
notify: restart discord-bot
- name: Start discord-bot
systemd:
name: discord-bot
state: started
enabled: yes
daemon_reload: true