forked from bitlair/ansible
46 lines
998 B
YAML
46 lines
998 B
YAML
---
|
|
- name: Clone source
|
|
ansible.builtin.git:
|
|
repo: https://github.com/polyfloyd/mqtt-exporter.git
|
|
version: main
|
|
dest: /opt/mqtt_exporter
|
|
accept_hostkey: yes
|
|
notify: restart mqtt_exporter
|
|
|
|
- name: Install apt dependencies
|
|
ansible.builtin.apt:
|
|
name:
|
|
- python3-paho-mqtt
|
|
- python3-prometheus-client
|
|
- python3-yaml
|
|
state: present
|
|
|
|
- name: Install service
|
|
ansible.builtin.template:
|
|
src: mqtt_exporter.service
|
|
dest: /etc/systemd/system/mqtt_exporter.service
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify:
|
|
- daemon reload
|
|
- restart mqtt_exporter
|
|
|
|
- name: Install config file
|
|
ansible.builtin.template:
|
|
src: mqtt_exporter_config.yaml
|
|
dest: /etc/mqtt_exporter.yaml
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
notify:
|
|
- daemon reload
|
|
- restart mqtt_exporter
|
|
|
|
- ansible.builtin.meta: flush_handlers
|
|
|
|
- name: Start service
|
|
ansible.builtin.systemd:
|
|
name: mqtt_exporter
|
|
state: started
|
|
enabled: true
|