--- - name: Ensure mosquitto is installed become: true ansible.builtin.apt: name: mosquitto - name: Ensure main configuraton file is deployed become: true ansible.builtin.copy: content: "{{ mosquitto__mosquitto_conf_content }}" dest: /etc/mosquitto/mosquitto.conf mode: "644" owner: root group: root notify: Restart mosquitto - name: Ensure all additional configuraton files are deployed become: true ansible.builtin.copy: content: "{{ item.content }}" dest: /etc/mosquitto/conf.d/{{ item.name }}.conf mode: "644" owner: root group: root loop: "{{ mosquitto__configs }}" notify: Restart mosquitto - name: Ensure mosquitto service is enabled and started become: true ansible.builtin.systemd: service: mosquitto.service enabled: true state: started