forked from bitlair/ansible
Add www role
This commit is contained in:
parent
1bab3d478d
commit
03780abf01
12 changed files with 313 additions and 0 deletions
45
roles/www/tasks/mqtt.yaml
Normal file
45
roles/www/tasks/mqtt.yaml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
- name: Install Mosquitto
|
||||
apt:
|
||||
name: mosquitto
|
||||
|
||||
- name: Allow MQTT
|
||||
iptables:
|
||||
chain: INPUT
|
||||
protocol: tcp
|
||||
destination_port: "{{ item.port }}"
|
||||
ctstate: NEW
|
||||
jump: ACCEPT
|
||||
ip_version: "{{ item.ip }}"
|
||||
action: insert
|
||||
with_items:
|
||||
- { ip: ipv4, port: 1883 }
|
||||
- { ip: ipv6, port: 1883 }
|
||||
notify: persist iptables
|
||||
|
||||
- name: Install mqtt-simple
|
||||
command: cpan Net::MQTT::Simple
|
||||
|
||||
- name: Clone mqtt2web source
|
||||
git:
|
||||
repo: https://github.com/bitlair/mqtt2web.git
|
||||
version: master
|
||||
dest: /opt/mqtt2web
|
||||
accept_hostkey: yes
|
||||
notify: restart mqtt2web
|
||||
|
||||
- name: Install mqtt2web service file
|
||||
template:
|
||||
src: mqtt2web.service
|
||||
dest: /etc/systemd/system/mqtt2web.service
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart mqtt2web
|
||||
|
||||
- name: Enable mqtt2web
|
||||
systemd:
|
||||
name: mqtt2web
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
Loading…
Add table
Add a link
Reference in a new issue