summaryrefslogtreecommitdiff
path: root/roles/mosquitto/broker/templates/config.j2
blob: e042ac256cd3d1a0241f550380b1703946654532 (plain) (blame)
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
# {{ ansible_managed }}

## Global
{% if mosquitto_broker_global_config_options is defined %}
{%   for option, value in mosquitto_broker_global_config_options.items() %}
{{ option }} {{ value }}
{%   endfor %}
{% endif %}
{% for name, listener in mosquitto_broker_listeners.items() %}

## Listener: {{ name }}
listener {{ listener.bind }}
{%   if 'tls' in listener %}
certfile /etc/mosquitto/certs/{{ name }}-crt.pem
keyfile /etc/mosquitto/certs/{{ name }}-key.pem
dhparamfile /etc/mosquitto/certs/dhparams.pem
{%   endif %}
{%   if 'options' in listener %}
{%     for option, value in listener.options.items() %}
{{ option }} {{ value }}
{%     endfor %}
{%   endif %}
{% endfor %}
{% if mosquitto_broker_prometheus_listener %}

## Prometheus monitoring
listener 0 /var/run/mosquitto/prometheus.sock
allow_anonymous true
{% endif %}