2022-12-01 21:29:40 +01:00
|
|
|
---
|
|
|
|
- name: Ensure mosquitto is installed
|
2023-05-09 21:12:46 +02:00
|
|
|
become: true
|
2022-12-01 21:29:40 +01:00
|
|
|
ansible.builtin.apt:
|
|
|
|
name: mosquitto
|
2023-05-09 21:12:46 +02:00
|
|
|
|
2022-12-01 21:29:40 +01:00
|
|
|
- name: Ensure main configuraton file is deployed
|
2023-05-09 21:12:46 +02:00
|
|
|
become: true
|
2022-12-01 21:29:40 +01:00
|
|
|
ansible.builtin.copy:
|
|
|
|
content: "{{ mosquitto__mosquitto_conf_content }}"
|
|
|
|
dest: /etc/mosquitto/mosquitto.conf
|
2023-05-09 21:12:46 +02:00
|
|
|
mode: "644"
|
2022-12-01 21:29:40 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
notify: Restart mosquitto
|
2023-05-09 21:12:46 +02:00
|
|
|
|
2022-12-01 21:29:40 +01:00
|
|
|
- name: Ensure all additional configuraton files are deployed
|
2023-05-09 21:12:46 +02:00
|
|
|
become: true
|
2022-12-01 21:29:40 +01:00
|
|
|
ansible.builtin.copy:
|
|
|
|
content: "{{ item.content }}"
|
|
|
|
dest: /etc/mosquitto/conf.d/{{ item.name }}.conf
|
2023-05-09 21:12:46 +02:00
|
|
|
mode: "644"
|
2022-12-01 21:29:40 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
loop: "{{ mosquitto__configs }}"
|
|
|
|
notify: Restart mosquitto
|
2023-05-09 21:12:46 +02:00
|
|
|
|
2022-12-01 21:29:40 +01:00
|
|
|
- name: Ensure mosquitto service is enabled and started
|
2023-05-09 21:12:46 +02:00
|
|
|
become: true
|
2022-12-01 21:29:40 +01:00
|
|
|
ansible.builtin.systemd:
|
|
|
|
service: mosquitto.service
|
|
|
|
enabled: true
|
|
|
|
state: started
|