blob: c90225bc1d535afac3faae922ff58c8164d45f0f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{%- set mypillar = salt['pillar.get']('profile:matterbridge') -%}
{%- set instances = mypillar['instances'] | default([]) -%}
matterbridge_packages:
pkg.installed:
- pkgs:
- matterbridge
matterbridge_directory:
file.directory:
- user: root
- group: matterbridge
- clean: True
- require:
- pkg: matterbridge_packages
{%- if instances | length > 0 %}
- file: matterbridge_files
{%- endif %}
- names:
- /etc/matterbridge
{%- if instances | length > 0 %}
matterbridge_files:
file.managed:
- user: root
- mode: '0644'
- template: jinja
- source: salt:///{{ slspath }}/files/etc/matterbridge/matterbridge.toml.j2
- names:
{%- for instance in instances %}
- /etc/matterbridge/{{ instance }}.toml:
- context:
instance: {{ instance }}
general: {{ instances[instance]['general'] | default({}) }}
accounts: {{ instances[instance]['accounts'] }}
gateways: {{ instances[instance]['gateways'] }}
- watch_in:
- service: matterbridge_{{ instance }}_service
{%- endfor %}
{%- for instance in instances %}
{%- if 'general' in instances[instance] and 'MediaDownloadPath' in instances[instance]['general'] %}
matterbridge_{{ instance }}_mediadir:
file.directory:
- name: {{ instances[instance]['general']['MediaDownloadPath'] }}
- user: matterbridge
{#- to-do: implement some shared group #}
- group: lighttpd
- mode: 750
- makedirs: True
{%- endif %}
matterbridge_{{ instance }}_service:
service.running:
- name: matterbridge@{{ instance }}.service
- enable: True
- watch:
- file: /etc/matterbridge/{{ instance }}.toml
{%- endfor %}
{%- endif %}
matterbridge_cleanup_timer:
service.running:
- name: matterbridge-cleanup.timer
- enable: True
|