aboutsummaryrefslogtreecommitdiff
path: root/roles/services/monitoring/prometheus/node_exporter
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-25 09:52:36 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-25 09:52:36 -0400
commit95b73daa36b23565a8566f71f9b202d3459b685f (patch)
treecb17b021be70e7868d0ec235a761f0ecdc80f3f2 /roles/services/monitoring/prometheus/node_exporter
Initial CommitHEADmaster
Diffstat (limited to 'roles/services/monitoring/prometheus/node_exporter')
-rw-r--r--roles/services/monitoring/prometheus/node_exporter/defaults/main.yml4
-rw-r--r--roles/services/monitoring/prometheus/node_exporter/tasks/main.yml28
2 files changed, 32 insertions, 0 deletions
diff --git a/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml b/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml
new file mode 100644
index 0000000..e4ff351
--- /dev/null
+++ b/roles/services/monitoring/prometheus/node_exporter/defaults/main.yml
@@ -0,0 +1,4 @@
1node_exporter_debian_package: prometheus-node-exporter
2node_exporter_fedora_package: golang-github-prometheus-node-exporter
3prometheus_server_ip: 192.168.88.32
4node_exporter_port: '9100'
diff --git a/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml b/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml
new file mode 100644
index 0000000..6bbcc08
--- /dev/null
+++ b/roles/services/monitoring/prometheus/node_exporter/tasks/main.yml
@@ -0,0 +1,28 @@
1- name: install package (Debian)
2 when: ansible_facts['distribution'] == "Debian"
3 package:
4 name: "{{ node_exporter_debian_package }}"
5
6- name: install package (Fedora)
7 when: ansible_facts['distribution'] == "Fedora"
8 package:
9 name: "{{ node_exporter_fedora_package }}"
10
11- name: allow port
12 ufw:
13 rule: allow
14 direction: in
15 proto: tcp
16 src: "{{ prometheus_server_ip }}"
17 to_port: "{{ node_exporter_port }}"
18
19- name: enable service
20 systemd:
21 name: prometheus-node-exporter
22 enabled: yes
23 masked: no
24
25- name: restart service
26 service:
27 name: prometheus-node-exporter
28 state: restarted