Initial commit

This commit is contained in:
nemunaire 2023-12-12 10:49:22 +01:00
commit 38824afd62
5 changed files with 87 additions and 0 deletions

13
files/matterbridge.init Normal file
View File

@ -0,0 +1,13 @@
#!/sbin/openrc-run
PNAME=${SVCNAME#*.}
name="matterbridge ${PNAME}"
command="/usr/bin/matterbridge"
command_args="-conf ${CONFIG_FILE}"
pidfile="/var/run/${SVCNAME}.pid"
start_stop_daemon_args="--stdout /var/log/matterbridge/${SVCNAME}.log --stderr /var/log/matterbridge/${SVCNAME}.log -b -m -p $pidfile -u nobody -g nogroup"
depend() {
after net
}

5
handlers/main.yml Normal file
View File

@ -0,0 +1,5 @@
---
- name: reload matterbridge
service:
name: "matterbridge{% if instance_name is defined %}.{{ instance_name }}{% endif %}"
state: restarted

18
meta/main.yml Normal file
View File

@ -0,0 +1,18 @@
---
dependencies: []
galaxy_info:
role_name: matterbridge
author: 'Pierre-Olivier Mercier <nemunaire+iac@nemunai.re>'
description: Install and configure matterbridge
license: GPL-3.0-or-later
min_ansible_version: 2.9
platforms:
- name: Alpine
versions:
- all
- name: Debian
versions:
- all
galaxy_tags: []

50
tasks/main.yml Normal file
View File

@ -0,0 +1,50 @@
---
- name: "download 42wim/matterbridge-v{{ version }}"
get_url:
url: "https://github.com/42wim/matterbridge/releases/download/v{{ version }}/matterbridge-{{ version }}-linux-{% if ansible_architecture == 'armv7l' %}armv7{% elif ansible_architecture == 'aarch64' %}arm64{% else %}{{ ansible_architecture }}{% endif %}"
dest: "/usr/bin/matterbridge"
mode: 0551
notify:
- reload matterbridge
- name: configure matterbridge
copy:
content: "{{ matterbridge_configuration }}"
dest: "/etc/matterbridge{% if instance_name %}-{{ instance_name }}{% endif %}.toml"
notify:
- reload matterbridge
- name: ensure init script is present
copy:
src: matterbridge.init
dest: /etc/init.d/matterbridge
mode: 0755
- name: ensure init script is present
file:
src: matterbridge
path: "/etc/init.d/matterbridge.{{ instance_name }}"
state: link
mode: 0755
when: "instance_name is defined"
- name: ensure init config is present
template:
src: matterbridge.conf.j2
dest: "/etc/conf.d/matterbridge{% if instance_name %}.{{ instance_name }}{% endif %}"
notify:
- reload matterbridge
- name: ensure matterbridge is running
service:
name: matterbridge
enabled: yes
state: started
when: instance_name is not defined
- name: ensure matterbridge is running
service:
name: "matterbridge.{{ instance_name }}"
enabled: yes
state: started
when: instance_name is defined

View File

@ -0,0 +1 @@
CONFIG_FILE="/etc/matterbridge{% if instance_name %}-{{ instance_name }}{% endif %}.toml"