diff --git a/tasks/config.yml b/tasks/config.yml index 161a3db..eb18a8d 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -41,5 +41,6 @@ when: - mosquitto_acl_enabled - mosquitto_acl is defined + notify: __mosquitto_restart become: True become_user: root diff --git a/templates/etc/mosquitto/aclfile.j2 b/templates/etc/mosquitto/aclfile.j2 index d99d017..98fc88e 100644 --- a/templates/etc/mosquitto/aclfile.j2 +++ b/templates/etc/mosquitto/aclfile.j2 @@ -1,8 +1,11 @@ # {{ ansible_managed }} -{% for item in mosquitto_acl.values() %} +{% for dict in mosquitto_acl %} +{% for item in dict.values() %} {% if not item.user == "all" %} {{ item.user }} {% endif %} {{ item.acl_base if item.acl_base is defined else 'topic' }} {{ item.acl_policy }} {{ item.acl_topic }} {% endfor %} + +{% endfor %}