--- - block: - name: Copy passwd file to '{{ mosquitto_passwd_path }}' template: src: "etc/mosquitto/passwd.j2" dest: "{{ mosquitto_passwd_path }}" owner: root group: root mode: 0600 register: __mosquitto_passwd - name: Hash passwd file shell: "mosquitto_passwd -U {{ mosquitto_passwd_path }}" notify: __mosquitto_restart when: __mosquitto_passwd.changed become: True become_user: root