You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.5 KiB
YAML

---
- 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"
notify:
- reconfigure mosquitto acl
- reconfigure mosquitto auth
- name: Create link in environment directory
file:
state: link
src: "{{ configuration_directory }}"
dest: "{{ environment_link }}"
- 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"
notify: reconfigure mosquitto acl
- name: Create auth main file
file:
state: touch
path: "{{ environment_directory | quote }}/0_main.auth"
owner: root
group: root
mode: "u=rw,g=r,o=r"
- name: Store auth main file
command: >-
mosquitto_passwd
-b
{{ environment_directory | quote }}/0_main.auth
{{ admin_user | quote }}
{{ admin_pass | quote }}
notify: reconfigure mosquitto auth
- name: Configure mosquitto configuration
template:
src: "main.conf"
dest: "{{ configuration_directory }}/conf.d/0_main.conf"
owner: "root"
group: "root"
mode: "u=rw,g=r,o=r"
notify: restart mosquitto