From f45db7d27ea94726c615fd961dc5e52a28a3eb81 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 7 Nov 2018 22:00:41 +0100 Subject: [PATCH] try to fix acl template --- tasks/config.yml | 3 +-- templates/etc/mosquitto/aclfile.j2 | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tasks/config.yml b/tasks/config.yml index 9a8dfc0..161a3db 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -38,9 +38,8 @@ owner: root group: root mode: 0600 - with_dict: "{{ mosquitto_password_auth_users | default('{}') }}" when: - mosquitto_acl_enabled - - mosquitto_acl + - mosquitto_acl is defined become: True become_user: root diff --git a/templates/etc/mosquitto/aclfile.j2 b/templates/etc/mosquitto/aclfile.j2 index 66ab2b4..d99d017 100644 --- a/templates/etc/mosquitto/aclfile.j2 +++ b/templates/etc/mosquitto/aclfile.j2 @@ -1,8 +1,8 @@ # {{ ansible_managed }} -{% for acl in mosquitto_acl %} -{% if not acl.user == "all" %} -{{ acl.user }} +{% for item in mosquitto_acl.values() %} +{% if not item.user == "all" %} +{{ item.user }} {% endif %} -{{ acl.acl_base if acl.acl_base is defined else 'topic' }} {{ acl.acl_policy }} {{ acl.acl_topic }} +{{ item.acl_base if item.acl_base is defined else 'topic' }} {{ item.acl_policy }} {{ item.acl_topic }} {% endfor %}