aboutsummaryrefslogtreecommitdiffstats
path: root/roles/prometheus/tasks
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-22 21:11:20 +0100
committerbinary <me@rgoncalves.se>2020-11-22 21:11:20 +0100
commit0d1a97a0d82d347761da6113686398f364ba04aa (patch)
treec4d20e4ff920f19a226234d99184a145e445b6d4 /roles/prometheus/tasks
parent5930f294421b490a5beff52ce75f52e938e93354 (diff)
downloadinfrastructure-0d1a97a0d82d347761da6113686398f364ba04aa.tar.gz
Add node exporter per-system.
Diffstat (limited to 'roles/prometheus/tasks')
-rw-r--r--roles/prometheus/tasks/main.yml19
1 files changed, 19 insertions, 0 deletions
diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml
index aacdb65..ba5095b 100644
--- a/roles/prometheus/tasks/main.yml
+++ b/roles/prometheus/tasks/main.yml
@@ -7,5 +7,24 @@
- name: install prometheus
package: name=prometheus state=present
+- name: install node_exporter
+ package: name="{{ packages[os_distribution].node_exporter }}" state=present
+
+- name: generate prometheus configuration
+ template:
+ src: prometheus.conf.j2
+ dest: "{{ path_prometheusconfig }}"
+ owner: "{{ user_root }}"
+ group: "{{ group_root }}"
+ mode: 0644
+
- name: ensure prometheus service is started and enabled
service: name=prometheus state=restarted enabled=true
+
+- name: start and enable node_exporter
+ service: name=node_exporter state=restarted enabled=true
+ when: os_type == "bsd"
+
+- name: start and enable node_exporter
+ service: name=node-exporter state=restarted enabled=true
+ when: os_type != "bsd"
remember that computers suck.