--- ## TODO: pin version - name: install apt packages apt: name: prom-exporter-mikrotik state: present - name: create config directory file: path: /etc/prometheus/exporter/mikrotik state: directory - name: generate configuration template: src: config.yml.j2 dest: /etc/prometheus/exporter/mikrotik/config.yml owner: root group: prometheus-exporter mode: 0640 notify: restart prometheus-mikrotik-exporter - name: generate systemd service unit template: src: service.j2 dest: /etc/systemd/system/prometheus-mikrotik-exporter.service notify: restart prometheus-mikrotik-exporter - name: make sure prometheus-mikrotik-exporter is enabled and started systemd: name: prometheus-mikrotik-exporter.service daemon_reload: yes state: started enabled: yes - name: register exporter copy: content: | location = /mikrotik { proxy_pass http://127.0.0.1:9436/metrics; } dest: /etc/prometheus/exporter/mikrotik.locations notify: reload nginx