mirror of
https://github.com/famedly/ansible-collection-matrix
synced 2024-12-04 16:49:17 +00:00
feat(standupbot): add initial role and playbook
This commit is contained in:
parent
3c634ac930
commit
11b117cf98
7 changed files with 102 additions and 0 deletions
5
playbooks/standupbot.yml
Normal file
5
playbooks/standupbot.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Deploy standupbot
|
||||
hosts: "{{ standupbot_hosts | default('standupbot') }}"
|
||||
roles:
|
||||
- standupbot
|
17
roles/standupbot/README.md
Normal file
17
roles/standupbot/README.md
Normal 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>
|
2
roles/standupbot/defaults/main.yml
Normal file
2
roles/standupbot/defaults/main.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
standupbot_base_path: /opt/standupbot
|
7
roles/standupbot/handlers/main.yml
Normal file
7
roles/standupbot/handlers/main.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
- name: Restart standupbot
|
||||
community.docker.docker_container:
|
||||
name: standupbot
|
||||
state: started
|
||||
restart: true
|
||||
listen: restart-standupbot
|
18
roles/standupbot/meta/main.yml
Normal file
18
roles/standupbot/meta/main.yml
Normal 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: []
|
48
roles/standupbot/tasks/main.yml
Normal file
48
roles/standupbot/tasks/main.yml
Normal 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"
|
5
roles/standupbot/vars/main.yml
Normal file
5
roles/standupbot/vars/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
standupbot_config:
|
||||
Homeserver: "{{ standupbot_homeserver }}"
|
||||
Username: "{{ standupbot_username }}"
|
||||
PasswordFile: "{{ standupbot_base_path }}/password_file"
|
Loading…
Reference in a new issue