ansible-infra/playbooks/roles/mosquitto/tasks/main.yaml

27 lines
763 B
YAML

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