summaryrefslogtreecommitdiffstats
path: root/salt/profile/matterbridge/init.sls
blob: eee6df273885ba8a3f654497a02d0d2112a7e6df (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
{%- set mypillar = 'profile:matterbridge' -%}
{%- set instances = salt['pillar.get'](mypillar ~ ':instances') or [] -%}

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 }}

matterbridge_{{ instance }}_service:
  service.running:
    - name: matterbridge@{{ instance }}.service
    - enable: True
{%- endfor %}
{%- endif %}

matterbridge_cleanup_timer:
  service.running:
    - name: matterbridge-cleanup.timer
    - enable: True