xoxys.mosquitto/tasks/install.yml
Robert Kaussow 940e35da5b
All checks were successful
continuous-integration/drone/push Build is passing
add extra packages variable
2019-08-06 21:24:37 +02:00

39 lines
1.0 KiB
YAML

---
- block:
- name: Install mqtt packages
package:
name: "{{ item }}"
state: present
loop: "{{ mosquitto_packages_extra + __mosquitto_packages }}"
- 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 | bool
become: True
become_user: root