fix user hadling
This commit is contained in:
parent
da82193ac9
commit
76fb609d0d
@ -17,8 +17,10 @@ mosquitto_password_auth_file: "{{ mosquitto_base_dir }}/passwd"
|
||||
# mosquitto_password_auth_users: (defaults to not set)
|
||||
# - admin:
|
||||
# password: mysecret
|
||||
# state: present
|
||||
# - user1:
|
||||
# password: very_secure
|
||||
# state: absent
|
||||
|
||||
mosquitto_acl_enabled: False
|
||||
mosquitto_acl_file: "{{ mosquitto_base_dir }}/aclfile"
|
||||
|
@ -15,7 +15,19 @@
|
||||
become_user: root
|
||||
when: not __mosquitto_passwd.stat.exists
|
||||
|
||||
# TODO: ugly workaround, move this to a custom module
|
||||
- name: Add users to password file
|
||||
shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.name }} {{ item.value.password }}"
|
||||
shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.key }} {{ item.value.password }}"
|
||||
with_dict: "{{ mosquitto_password_auth_users | default('{}') }}"
|
||||
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 }}"
|
||||
with_dict: "{{ mosquitto_password_auth_users | default('{}') }}"
|
||||
notify: __mosquitto_restart
|
||||
become: True
|
||||
become_user: root
|
||||
when: item.value.state == "absent"
|
||||
|
Loading…
Reference in New Issue
Block a user