diff --git a/tasks/config.yml b/tasks/config.yml index 4cb4b53..e2e6fec 100644 --- a/tasks/config.yml +++ b/tasks/config.yml @@ -19,15 +19,17 @@ - name: Add users to password file shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.key }} {{ item.value.password }}" with_dict: "{{ mosquitto_password_auth_users | default('{}') }}" + when: item.value.state == "present" + changed_when: False notify: __mosquitto_restart become: True become_user: root - when: item.value.state == "present" - name: Remove unnecessary users from password file - shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.key }}" + shell: "mosquitto_passwd -D {{ mosquitto_password_auth_file }} {{ item.key }}" with_dict: "{{ mosquitto_password_auth_users | default('{}') }}" + when: item.value.state == "absent" + changed_when: False notify: __mosquitto_restart become: True become_user: root - when: item.value.state == "absent"