2017-12-16 20:33:26 +00:00
|
|
|
---
|
2018-11-04 22:21:13 +00:00
|
|
|
- block:
|
2018-11-04 23:10:22 +00:00
|
|
|
- name: Install mqtt packages
|
2018-11-04 22:34:41 +00:00
|
|
|
package:
|
2018-11-04 23:10:22 +00:00
|
|
|
name: mosquitto
|
2018-11-04 22:21:13 +00:00
|
|
|
state: present
|
2017-12-16 21:00:52 +00:00
|
|
|
|
2018-11-04 23:10:22 +00:00
|
|
|
- name: Create group '{{ mosquitto_group }}'
|
|
|
|
group:
|
|
|
|
name: '{{ mosquitto_group }}'
|
|
|
|
state: present
|
2017-12-16 21:00:52 +00:00
|
|
|
|
2018-11-04 23:10:22 +00:00
|
|
|
- name: Create user '{{ mosquitto_user }}'
|
|
|
|
user:
|
|
|
|
name: '{{ mosquitto_user }}'
|
|
|
|
group: '{{ mosquitto_group }}'
|
|
|
|
home: "{{ mosquitto_base_dir }}"
|
|
|
|
system: yes
|
|
|
|
shell: /sbin/nologin
|
2017-12-16 21:14:07 +00:00
|
|
|
|
2018-11-04 23:10:22 +00:00
|
|
|
- name: Deploy default configuration
|
|
|
|
template:
|
|
|
|
src: "etc/mosquitto/mosquitto.conf.j2"
|
|
|
|
dest: "{{ mosquitto_base_dir }}/default.conf"
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: __mosquitto_restart
|
2018-11-04 22:21:13 +00:00
|
|
|
become: True
|
|
|
|
become_user: root
|