1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/mosquitto/tasks/main.yml

45 lines
1.1 KiB
YAML

- name: Install mosquitto & mosquitto-clients
package:
name: "{{ item }}"
state: present
with_items:
- mosquitto
- mosquitto-clients
when: mosquitto_install
tags: download
- name: Disable & Stop mosquitto service
systemd:
name: mosquitto
enabled: no
state: stopped
when: mosquitto_install
- name: Create (touch) file /etc/mosquitto/passwd
file:
path: /etc/mosquitto/passwd
state: touch
mode: "u=rw,g=r,o=r" # 0644
when: mosquitto_install
- name: Populate /etc/mosquitto/passwd with actual username/password
shell: mosquitto_passwd -b /etc/mosquitto/passwd "{{ mosquitto_user }}" "{{ mosquitto_password }}"
when: mosquitto_install
- name: Install /etc/mosquitto/conf.d/websockets.conf from template
template:
backup: yes
src: websockets.conf.j2
dest: /etc/mosquitto/conf.d/websockets.conf
owner: root
group: root
mode: 0755
when: mosquitto_install
- name: Enable & Start mosquitto service
systemd:
daemon_reload: yes
name: mosquitto
enabled: yes
state: started
when: mosquitto_enabled