fix user handling
This commit is contained in:
parent
76fb609d0d
commit
138ebf4079
@ -19,15 +19,17 @@
|
|||||||
- name: Add users to password file
|
- name: Add users to password file
|
||||||
shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.key }} {{ item.value.password }}"
|
shell: "mosquitto_passwd -b {{ mosquitto_password_auth_file }} {{ item.key }} {{ item.value.password }}"
|
||||||
with_dict: "{{ mosquitto_password_auth_users | default('{}') }}"
|
with_dict: "{{ mosquitto_password_auth_users | default('{}') }}"
|
||||||
|
when: item.value.state == "present"
|
||||||
|
changed_when: False
|
||||||
notify: __mosquitto_restart
|
notify: __mosquitto_restart
|
||||||
become: True
|
become: True
|
||||||
become_user: root
|
become_user: root
|
||||||
when: item.value.state == "present"
|
|
||||||
|
|
||||||
- name: Remove unnecessary users from password file
|
- 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('{}') }}"
|
with_dict: "{{ mosquitto_password_auth_users | default('{}') }}"
|
||||||
|
when: item.value.state == "absent"
|
||||||
|
changed_when: False
|
||||||
notify: __mosquitto_restart
|
notify: __mosquitto_restart
|
||||||
become: True
|
become: True
|
||||||
become_user: root
|
become_user: root
|
||||||
when: item.value.state == "absent"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user