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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
- name: "[Alpine] Install package: node-exporter"
apk:
name: prometheus-node-exporter
state: present
update_cache: yes
when:
- ansible_distribution == "Alpine"
- services.prometheus_node_exporter.enable is true
notify: Restart prometheus-node-exporter
- name: "[Archlinux] Install package: prometheus-node-exporter"
pacman:
name: prometheus-node-exporter
state: present
update_cache: yes
when:
- ansible_distribution == "Archlinux"
- services.prometheus_node_exporter.enable is true
notify: Restart prometheus-node-exporter
- name: "[OpenRC] Enable and start service: node-exporter"
service:
name: node-exporter
enabled: yes
state: started
when:
- ansible_service_mgr == "openrc"
- services.prometheus_node_exporter is true
- name: "[systemd] Enable and start service: prometheus-node-exporter"
systemd:
name: prometheus-node-exporter
state: started
enabled: yes
when:
- ansible_service_mgr == "systemd"
- services.prometheus_node_exporter.enable is true
- name: "[OpenRC] Disable and stop service: node-exporter"
service:
name: node-exporter
enabled: no
state: stopped
when:
- ansible_service_mgr == "openrc"
- services.prometheus_node_exporter is false
- name: "[systemd] Disable and stop service: prometheus-node-exporter"
systemd:
name: prometheus-node-exporter
state: stopped
enabled: no
when:
- services.prometheus_node_exporter.enable is false
- ansible_service_mgr == "systemd"
- name: "[Alpine] Remove package: node-exporter"
apk:
name: prometheus-node-exporter
state: absent
when:
- ansible_distribution == "Alpine"
- services.prometheus_node_exporter.enable is false
- name: "[Archlinux] Remove package: prometheus-node-exporter"
pacman:
name: prometheus-node-exporter
state: absent
when:
- ansible_distribution == "Archlinux"
- services.prometheus_node_exporter.enable is false