From e65ffd5dc73fea19df70c43a1e2472156a84ae2e Mon Sep 17 00:00:00 2001 From: polyfloyd Date: Mon, 5 May 2025 22:59:52 +0200 Subject: [PATCH] services/discord_bot: Some tweaks --- roles/services/tasks/discord_bot.yaml | 19 ++++++++----------- roles/services/templates/discord-bot.service | 3 ++- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/roles/services/tasks/discord_bot.yaml b/roles/services/tasks/discord_bot.yaml index 19a659f..4d742f6 100644 --- a/roles/services/tasks/discord_bot.yaml +++ b/roles/services/tasks/discord_bot.yaml @@ -2,23 +2,14 @@ - name: Install dependencies ansible.builtin.apt: - name: - - python3-paho-mqtt - - python3-tz - - virtualenv + name: virtualenv - name: Create virtualenv ansible.builtin.command: - cmd: virtualenv /opt/miflora_exporter/.venv + cmd: virtualenv /var/lib/discord-bot/.venv args: creates: /var/lib/discord-bot/.venv -- name: Install Python dependencies - ansible.builtin.shell: - cmd: . .venv/bin/activate && pip install -r requirements.txt - args: - chdir: /var/lib/discord-bot - - name: Clone source ansible.builtin.git: repo: https://git.bitlair.nl/bitlair/discord-bot.git @@ -28,6 +19,12 @@ notify: Restart discord-bot ignore_errors: true +- name: Install Python dependencies + ansible.builtin.shell: + cmd: . .venv/bin/activate && pip install -r requirements.txt + args: + chdir: /var/lib/discord-bot + - name: Install service file ansible.builtin.template: src: discord-bot.service diff --git a/roles/services/templates/discord-bot.service b/roles/services/templates/discord-bot.service index 2c73d05..ccac806 100644 --- a/roles/services/templates/discord-bot.service +++ b/roles/services/templates/discord-bot.service @@ -1,4 +1,4 @@ -# Managed by Ansible +# {{ ansible_managed }} [Unit] Description=HobbyBot @@ -13,6 +13,7 @@ DynamicUser=true Environment="MQTT_HOST={{ mqtt_internal_host }}" Environment="DISCORD_WEBHOOK_URL={{ lookup('passwordstore', 'services/discord', subkey='webhook_url') }}" Environment="DISCORD_TOKEN={{ lookup('passwordstore', 'services/discord', subkey='token') }}" +Environment="BOTTLECLIP_GIT_TOKEN={{ lookup('passwordstore', 'services/discord', subkey='bottleclip_git_token') }}" [Install] WantedBy=multi-user.target