--- - name: Install required packages apt: state: present name: - mosquitto - name: Create configuration environment directory file: state: directory path: "{{ environment_directory }}" owner: root group: root mode: "u=rwx,g=rx,o=rx" - name: Configure makefile for environment directory template: src: mosquitto.makefile dest: "{{ environment_directory }}/makefile" owner: root group: root mode: "u=rw,g=r,o=r" - name: Store acl main file template: src: main.acl dest: "{{ environment_directory }}/0_main.acl" owner: root group: root mode: "u=rw,g=r,o=r" notifiy: reconfigure mosquitto acl - name: Store auth main file command: >- mosquitto_passwd -b {{ environment_directory | quote }}/0_main.auth {{ admin_user | quote }} {{ admin_pass | quote }} notifiy: reconfigure mosquitto auth - name: Configure mosquitto configuration template: src: "main.conf" dest: "{{ mosquitto_configuration_directory }}/mosquitto.conf" owner: "root" group: "root" mode: "u=rw,g=r,o=r" notifiy: restart mosquitto