summaryrefslogtreecommitdiff
path: root/roles/monitoring/prometheus/exporter/node/tasks/main.yml
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-05-31 22:41:50 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-06-20 01:44:16 +0200
commit35fb88969a6cb85d8ba7541820acf3b0ff891055 (patch)
tree8e986321cf06886a8b3ebb4251c5b056ffa2d8b4 /roles/monitoring/prometheus/exporter/node/tasks/main.yml
parentprometheus basic exporter base role (diff)
prometheus: initial node exporter role
Diffstat (limited to 'roles/monitoring/prometheus/exporter/node/tasks/main.yml')
-rw-r--r--roles/monitoring/prometheus/exporter/node/tasks/main.yml36
1 files changed, 33 insertions, 3 deletions
diff --git a/roles/monitoring/prometheus/exporter/node/tasks/main.yml b/roles/monitoring/prometheus/exporter/node/tasks/main.yml
index 0758eb3f..694dafb0 100644
--- a/roles/monitoring/prometheus/exporter/node/tasks/main.yml
+++ b/roles/monitoring/prometheus/exporter/node/tasks/main.yml
@@ -1,9 +1,39 @@
---
+- name: check if prometheus apt component of spreadspace repo is enabled
+ assert:
+ msg: "please enable the 'prometheus' component of spreadspace repo using 'spreadspace_apt_repo_components'"
+ that:
+ - spreadspace_apt_repo_components is defined
+ - "'prometheus' in spreadspace_apt_repo_components"
+
- name: install apt packages
apt:
name: prom-exporter-node
state: present
-## TODO:
-## - systemd service unit
-## - add snippet to exporter-exporter config-dir
+- name: create directory for textfile collector
+ file:
+ path: /var/lib/prometheus-node-exporter/textfile-collector
+ state: directory
+
+- name: generate systemd service unit
+ template:
+ src: service.j2
+ dest: /etc/systemd/system/prometheus-node-exporter.service
+ notify: restart prometheus-node-exporter
+
+- name: make sure prometheus-exporter-exporter is enabled and started
+ systemd:
+ name: prometheus-node-exporter.service
+ daemon_reload: yes
+ state: started
+ enabled: yes
+
+- name: register exporter
+ copy:
+ content: |
+ method: http
+ http:
+ port: 9100
+ dest: /etc/prometheus/exporter/enabled/node.yml
+ notify: reload prometheus-exporter-exporter