xoxys.mosquitto/tasks/install.yml

39 lines
1.0 KiB
YAML
Raw Normal View History

2017-12-16 21:33:26 +01:00
---
2018-11-04 23:21:13 +01:00
- block:
2018-11-05 00:10:22 +01:00
- name: Install mqtt packages
2018-11-04 23:34:41 +01:00
package:
2019-08-06 21:24:37 +02:00
name: "{{ item }}"
2018-11-04 23:21:13 +01:00
state: present
2019-08-06 21:24:37 +02:00
loop: "{{ mosquitto_packages_extra + __mosquitto_packages }}"
2018-11-05 00:10:22 +01:00
- name: Create group '{{ mosquitto_group }}'
group:
name: '{{ mosquitto_group }}'
state: present
2018-11-05 00:10:22 +01: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 22:14:07 +01:00
2018-11-05 00:10:22 +01:00
- name: Deploy default configuration
template:
src: "etc/mosquitto/mosquitto.conf.j2"
2018-11-05 00:17:13 +01:00
dest: "{{ mosquitto_base_dir }}/mosquitto.conf"
2018-11-05 00:10:22 +01:00
owner: root
group: root
mode: 0644
notify: __mosquitto_restart
2018-11-05 00:31:54 +01: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 16:00:07 +02:00
when: mosquitto_iptables_enabled | bool
2018-11-04 23:21:13 +01:00
become: True
become_user: root