feat(standupbot): add initial role and playbook

This commit is contained in:
Jan Christian Grünhage 2023-01-13 14:29:25 +01:00
parent 3c634ac930
commit 11b117cf98
No known key found for this signature in database
GPG key ID: EEC1170CE56FA2ED
7 changed files with 102 additions and 0 deletions

5
playbooks/standupbot.yml Normal file
View file

@ -0,0 +1,5 @@
---
- name: Deploy standupbot
hosts: "{{ standupbot_hosts | default('standupbot') }}"
roles:
- standupbot

View file

@ -0,0 +1,17 @@
# `famedly.matrix.standupbot`
Deploys a containerized instance of [standupbot](https://github.com/beeper/standupbot).
## Role Variables
- `standupbot_homeserver`: Base URL of the matrix homeserver, for example `https://matrix.famedly.de`.
- `standupbot_username`: Full MXID of the bot user.
- `standupbot_password`: Password of the bot user.
## License
AGPL-3.0-only
## Author Information
- Jan Christian Grünhage <jan.christian@gruenhage.xyz>

View file

@ -0,0 +1,2 @@
---
standupbot_base_path: /opt/standupbot

View file

@ -0,0 +1,7 @@
---
- name: Restart standupbot
community.docker.docker_container:
name: standupbot
state: started
restart: true
listen: restart-standupbot

View file

@ -0,0 +1,18 @@
---
galaxy_info:
author: Jan Christian Grünhage <jan.christian@gruenhage.xyz>
description: Deploy a containerized standupbot instance
company: Famedly GmbH
license: AGPL-3.0-only
min_ansible_version: "2.11"
platforms:
- name: Debian
versions:
- bullseye
galaxy_tags: []
dependencies: []

View file

@ -0,0 +1,48 @@
---
- name: Ensure standupbot user is created
become: true
ansible.builtin.user:
name: standupbot
state: present
system: true
- name: Ensure base directory for standupbot is created
become: true
ansible.builtin.file:
path: "{{ standupbot_base_path }}"
state: directory
owner: standupbot
group: standupbot
mode: 0755
- name: Ensure config file is up to date
become: true
ansible.builtin.copy:
content: "{{ standupbot_config | to_nice_json }}"
dest: "{{ standupbot_base_path }}/config.json"
owner: standupbot
group: standupbot
mode: 0600
notify: restart-standupbot
- name: Ensure password file is up to date
become: true
ansible.builtin.copy:
content: "{{ standupbot_password }}"
dest: "{{ standupbot_config.PasswordFile }}"
owner: standupbot
group: standupbot
mode: 0600
notify: restart-standupbot
- name: Ensure standupbot container is running
become: true
community.docker.docker_container:
image: ghcr.io/famedly/standupbot:latest
name: standupbot
restart_policy: unless-stopped
volumes:
- "{{ standupbot_base_path }}:{{ standupbot_base_path }}"
- "{{ standupbot_base_path }}/data:/root/.local/share/standupbot"
working_dir: "{{ standupbot_base_path }}"
command: "/usr/local/bin/standupbot"

View file

@ -0,0 +1,5 @@
---
standupbot_config:
Homeserver: "{{ standupbot_homeserver }}"
Username: "{{ standupbot_username }}"
PasswordFile: "{{ standupbot_base_path }}/password_file"