ansible-nas/roles/mosquitto/tasks/main.yml
2022-06-12 23:24:47 +01:00

31 lines
948 B
YAML

---
- name: Create Mosquitto Directories
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ mosquitto_data_directory }}/config"
- "{{ mosquitto_data_directory }}/data"
- "{{ mosquitto_data_directory }}/log"
- name: Template mosquitto.conf
copy:
src: mosquitto.conf
dest: "{{ mosquitto_data_directory }}/config/mosquitto.conf"
register: mosquitto_conf
- name: Create Mosquitto container
docker_container:
name: mosquitto
image: eclipse-mosquitto:latest
pull: true
volumes:
- "{{ mosquitto_data_directory }}/config/mosquitto.conf:/mosquitto/config/mosquitto.conf:rw"
- "{{ mosquitto_data_directory }}/data:/mosquitto/data:rw"
- "{{ mosquitto_data_directory }}/log:/mosquitto/log:rw"
ports:
- "{{ mosquitto_port_a }}:1883"
- "{{ mosquitto_port_b }}:9001"
restart_policy: unless-stopped
restart: "{{ mosquitto_conf is changed }}"
memory: 1g