--- - name: Install dependencies apt: name: - libjson-xs-perl - liblinux-epoll-perl - 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: - daemon reload - restart mqtt2web - meta: flush_handlers - name: Enable mqtt2web systemd: name: mqtt2web state: started enabled: true