blob: 1ac4b8d708e6283e232450ffb2cf4cd81f77ad03 (
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
42
43
44
|
---
- name: generate apt pin file for exporter-bind package
when: prometheus_exporter_bind_version is defined
copy:
dest: "/etc/apt/preferences.d/prom-exporter-bind.pref"
content: |
Package: prom-exporter-bind
Pin: version {{ prometheus_exporter_bind_version }}-1
Pin-Priority: 1001
- name: remove apt pin file for exporter-bind package
when: prometheus_exporter_bind_version is not defined
file:
path: "/etc/apt/preferences.d/prom-exporter-bind.pref"
state: absent
- name: install apt packages
apt:
name: "prom-exporter-bind{% if prometheus_exporter_bind_version is defined %}={{ prometheus_exporter_bind_version }}-1{% endif %}"
state: present
allow_downgrade: yes
notify: restart prometheus-bind-exporter
- name: generate systemd service unit
template:
src: service.j2
dest: /etc/systemd/system/prometheus-bind-exporter.service
notify: restart prometheus-bind-exporter
- name: make sure prometheus-bind-exporter is enabled and started
systemd:
name: prometheus-bind-exporter.service
daemon_reload: yes
state: started
enabled: yes
- name: register exporter
copy:
content: |
location = /bind {
proxy_pass http://127.0.0.1:9119/metrics;
}
dest: /etc/prometheus/exporter/bind.locations
notify: reload nginx
|