2017-12-16 20:33:26 +00:00
|
|
|
---
|
2017-12-18 11:16:09 +00:00
|
|
|
- name: Add mttq repository
|
2017-12-16 20:33:26 +00:00
|
|
|
yum_repository:
|
|
|
|
name: mttq
|
|
|
|
file: mttq
|
|
|
|
description: MTTQ Broker
|
2017-12-18 10:53:40 +00:00
|
|
|
baseurl: "http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-{{ ansible_distribution_major_version }}/"
|
|
|
|
gpgkey: "http://download.opensuse.org/repositories/home:/oojah:/mqtt/CentOS_CentOS-{{ ansible_distribution_major_version }}/repodata/repomd.xml.key"
|
2017-12-16 20:33:26 +00:00
|
|
|
|
|
|
|
- name: Install mttq packages
|
|
|
|
yum:
|
|
|
|
name: "{{ item }}"
|
|
|
|
state: installed
|
2017-12-16 20:39:50 +00:00
|
|
|
with_items:
|
2017-12-16 20:33:26 +00:00
|
|
|
- mosquitto
|
|
|
|
- mosquitto-clients
|
2017-12-16 21:00:52 +00:00
|
|
|
|
|
|
|
- name: Create group '{{ mosquitto_group }}'
|
|
|
|
group:
|
|
|
|
name: '{{ mosquitto_group }}'
|
|
|
|
state: present
|
|
|
|
|
|
|
|
- name: Create user '{{ mosquitto_user }}'
|
|
|
|
user:
|
|
|
|
name: '{{ mosquitto_user }}'
|
|
|
|
group: '{{ mosquitto_group }}'
|
|
|
|
system: yes
|
|
|
|
createhome: no
|
|
|
|
shell: /sbin/nologin
|
2017-12-16 21:14:07 +00:00
|
|
|
|
2017-12-17 12:21:46 +00:00
|
|
|
- name: Copy default configuration
|
2017-12-16 21:49:18 +00:00
|
|
|
template:
|
2017-12-17 12:21:46 +00:00
|
|
|
src: "etc/mosquitto/conf.d/default.conf.j2"
|
|
|
|
dest: "{{ mosquitto_config_dir }}/default.conf"
|
2017-12-16 21:49:18 +00:00
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2017-12-17 12:40:34 +00:00
|
|
|
notify:
|
|
|
|
- mosquitto_restart
|