--- - name: Install packages ansible.builtin.apt: name: - mosquitto - name: Configure mosquitto ansible.builtin.copy: src: files/mosquitto/conf.d dest: /etc/mosquitto mode: "0644" - name: Copy mosquitto password ansible.builtin.template: src: mosquitto/passwd.j2 dest: /etc/mosquitto/passwd mode: '0600' owner: root group: root - name: Restart mosquitto ansible.builtin.service: name: mosquitto state: restarted