From 35fb88969a6cb85d8ba7541820acf3b0ff891055 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 31 May 2021 22:41:50 +0200 Subject: prometheus: initial node exporter role --- .../prometheus/exporter/node/tasks/main.yml | 36 ++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'roles/monitoring/prometheus/exporter/node/tasks/main.yml') 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 -- cgit v1.2.3