Compare commits

..

No commits in common. "dee3e035c22ba80748aee773f92618777e592382" and "f7893a980e14f9b59e5cc99b2e9b536696808018" have entirely different histories.

2 changed files with 23 additions and 26 deletions

View File

@ -1,33 +1,35 @@
{%- set header = salt['pillar.get']('managed_header_pound') -%}
{%- set myfqdn = salt['grains.get']('fqdn') -%}
{%- set mypillar = 'profile:matterbridge:instances:' ~ instance ~ ':' -%}
{%- set myaccounts = mypillar ~ 'accounts' -%}
{%- set mygateways = mypillar ~ 'gateways' -%}
{%- set generalopts = ['RemoteNickFormat', 'IgnoreFailureOnStart', 'MessageSplit', 'MediaDownloadSize', 'MediaDownloadPath', 'MediaServerDownload', 'LogFile'] -%}
{%- set accountopts = ['Nick', 'NickServNick', 'NickServPassword', 'Server', 'UseTLS', 'UseSASL', 'Label', 'Charset', 'IgnoreNicks', 'RunCommands', 'UseRelayMsg', 'RemoteNickFormat'] -%}
{{ header }}
{%- if general | length %}
[general]
{%- for option, value in general.items() %}
{%- if value is string %}
{%- set value = '"' ~ value ~ '"' %}
{%- endif %}
{{ option }}={{ value }}
{%- endfor %}
{% endif %}
{% for option in generalopts %}
{%- if salt['pillar.get'](mypillar ~ option, None) != None %}
{{ option }}="{{ salt['pillar.get'](mypillar ~ option) }}"
{%- endif -%}
{%- endfor -%}
{%- for account, config in accounts.items() %}
[{{ account }}]
{%- for option, value in config.items() %}
{%- if value is string %}
{%- set value = '"' ~ value ~ '"' %}
{%- endif %}
{{ option }}={{ value }}
{%- endfor %}
{% for account, config in salt['pillar.get'](myaccounts).items() %}
[{{ config['protocol'] }}.{{ account }}]
{%- for option in accountopts %}
{%- if salt['pillar.get'](myaccounts ~ ':' ~ account ~ ':' ~ option, None) != None %}
{{ option }}="{{ config[option] }}"
{%- endif -%}
{% endfor %}
{% endfor -%}
{%- for gateway, config in gateways.items() %}
{% for gateway, config in salt['pillar.get'](mygateways).items() %}
[[gateway]]
name="{{ gateway }}"
enable=true
{%- for account, channel in config.items() %}
{% for account, channel in config.items() %}
[[gateway.inout]]
account="{{ account }}"
channel="{{ channel }}"
{%- endfor %}
{% endfor %}
{%- endfor -%}

View File

@ -1,5 +1,5 @@
{%- set mypillar = salt['pillar.get']('profile:matterbridge') -%}
{%- set instances = mypillar['instances'] | default([]) -%}
{%- set mypillar = 'profile:matterbridge' -%}
{%- set instances = salt['pillar.get'](mypillar ~ ':instances') or [] -%}
matterbridge_packages:
pkg.installed:
@ -31,12 +31,7 @@ matterbridge_files:
- /etc/matterbridge/{{ instance }}.toml:
- context:
instance: {{ instance }}
general: {{ instances[instance]['general'] | default({}) }}
accounts: {{ instances[instance]['accounts'] }}
gateways: {{ instances[instance]['gateways'] }}
{%- endfor %}
{%- for instance in instances %}
matterbridge_{{ instance }}_service:
service.running:
- name: matterbridge@{{ instance }}.service