diff options
author | Georg Pfuetzenreuter | 2023-02-07 22:20:39 +0100 |
---|---|---|
committer | Georg Pfuetzenreuter | 2023-02-07 22:37:37 +0100 |
commit | 650854fa2730c6f61a3f7117d7271907e4a2a587 (patch) | |
tree | 207e960cfc0735af7ff1f499d3e618f9e0e964e5 /salt/profile/matterbridge/files/etc | |
parent | f678de8560780ecdeca18d0251136142ef74b701 (diff) | |
download | salt-650854fa2730c6f61a3f7117d7271907e4a2a587.tar.gz salt-650854fa2730c6f61a3f7117d7271907e4a2a587.tar.bz2 salt-650854fa2730c6f61a3f7117d7271907e4a2a587.zip |
Refactor matterbridge profile
- reduce pillar calls
- no longer define possible configuration options, apply settings from
pillar 1:1
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'salt/profile/matterbridge/files/etc')
-rw-r--r-- | salt/profile/matterbridge/files/etc/matterbridge/matterbridge.toml.j2 | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/salt/profile/matterbridge/files/etc/matterbridge/matterbridge.toml.j2 b/salt/profile/matterbridge/files/etc/matterbridge/matterbridge.toml.j2 index 11204f3..b234c9f 100644 --- a/salt/profile/matterbridge/files/etc/matterbridge/matterbridge.toml.j2 +++ b/salt/profile/matterbridge/files/etc/matterbridge/matterbridge.toml.j2 @@ -1,35 +1,33 @@ {%- 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 in generalopts %} -{%- if salt['pillar.get'](mypillar ~ option, None) != None %} -{{ option }}="{{ salt['pillar.get'](mypillar ~ option) }}" -{%- endif -%} -{%- endfor -%} +{%- for option, value in general.items() %} +{%- if value is string %} +{%- set value = '"' ~ value ~ '"' %} +{%- endif %} +{{ option }}={{ value }} +{%- endfor %} +{% endif %} -{% 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 -%} +{%- for account, config in accounts.items() %} +[{{ account }}] +{%- for option, value in config.items() %} +{%- if value is string %} +{%- set value = '"' ~ value ~ '"' %} +{%- endif %} +{{ option }}={{ value }} +{%- endfor %} {% endfor %} -{% endfor -%} -{% for gateway, config in salt['pillar.get'](mygateways).items() %} +{%- for gateway, config in gateways.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 -%} |