summaryrefslogtreecommitdiff
path: root/roles/mosquitto/broker/templates/config.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/mosquitto/broker/templates/config.j2')
-rw-r--r--roles/mosquitto/broker/templates/config.j229
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/mosquitto/broker/templates/config.j2 b/roles/mosquitto/broker/templates/config.j2
new file mode 100644
index 00000000..e042ac25
--- /dev/null
+++ b/roles/mosquitto/broker/templates/config.j2
@@ -0,0 +1,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 %}