xoxys.mosquitto/tasks/install.yml

39 lines
1.0 KiB
YAML
Raw Normal View History

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:
2019-08-06 19:24:37 +00:00
name: "{{ item }}"
2018-11-04 22:21:13 +00:00
state: present
2019-08-06 19:24:37 +00:00
loop: "{{ mosquitto_packages_extra + __mosquitto_packages }}"
2018-11-04 23:10:22 +00:00
- name: Create group '{{ mosquitto_group }}'
group:
name: '{{ mosquitto_group }}'
state: present
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"
2018-11-04 23:17:13 +00:00
dest: "{{ mosquitto_base_dir }}/mosquitto.conf"
2018-11-04 23:10:22 +00:00
owner: root
group: root
mode: 0644
notify: __mosquitto_restart
2018-11-04 23:31:54 +00:00
- name: Open port in iptables
iptables_raw:
name: allow_mosquitto_port
state: present
rules: '-A INPUT -m state --state NEW -p tcp --dport {{ mosquitto_port }} -j ACCEPT'
2019-06-10 14:00:07 +00:00
when: mosquitto_iptables_enabled | bool
2018-11-04 22:21:13 +00:00
become: True
become_user: root