summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/mikrotik/tasks/main.yml
blob: c3ffe31baf8febc249f64d12328bbd8923891253 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- 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: |
      method: http
      http:
        port: 9436
    dest: /etc/prometheus/exporter/enabled/mikrotik.yml
  notify: reload prometheus-exporter-exporter