xoxys.mosquitto/tasks/install.yml
Robert Kaussow 07507651ce
Some checks failed
continuous-integration/drone/push Build is failing
remove outgoing iptables rule, not required
2019-04-28 22:51:34 +02:00

38 lines
993 B
YAML

---
- block:
- name: Install mqtt packages
package:
name: mosquitto
state: present
- name: Create group '{{ mosquitto_group }}'
group:
name: '{{ mosquitto_group }}'
state: present
- name: Create user '{{ mosquitto_user }}'
user:
name: '{{ mosquitto_user }}'
group: '{{ mosquitto_group }}'
home: "{{ mosquitto_base_dir }}"
system: yes
shell: /sbin/nologin
- name: Deploy default configuration
template:
src: "etc/mosquitto/mosquitto.conf.j2"
dest: "{{ mosquitto_base_dir }}/mosquitto.conf"
owner: root
group: root
mode: 0644
notify: __mosquitto_restart
- 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'
when: mosquitto_iptables_enabled
become: True
become_user: root