Updated prometheus roles. WIP psql, nginx exporters.
--- a/prometheus/client/defaults/main.yaml Sun Feb 09 20:34:46 2020 -0600
+++ b/prometheus/client/defaults/main.yaml Sun Feb 09 20:56:26 2020 -0600
@@ -4,7 +4,3 @@
- "prometheus-node-exporter"
# - "prometheus-postgres-exporter"
# - "prometheus-nginx-exporter"
-
-prometheus_client_rpi_exporter_version: "0.6.0"
-prometheus_client_arch: "{{ansible_architecture}}"
-prometheus_client_rpi_dest: "rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}"
--- a/prometheus/client/tasks/main.yaml Sun Feb 09 20:34:46 2020 -0600
+++ b/prometheus/client/tasks/main.yaml Sun Feb 09 20:56:26 2020 -0600
@@ -2,33 +2,24 @@
- name: install prometheus node exporter
become: yes
- apt: name="{{prometheus_client_apt_packages}}"
-
-- name: add prometheus user to video group for GPU stats
- become: yes
- user: name="prometheus" groups="video" append="yes"
+ apt: name="prometheus-node-exporter"
-- name: install prometheus rpi exporter
- unarchive:
- src: "https://github.com/lukasmalkmus/rpi_exporter/releases/download/v{{prometheus_client_rpi_exporter_version}}/rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}.tar.gz"
- remote_src: yes
- dest: "/tmp/"
+# # Nginx
+# - name: check if running nginx
+# stat: path="/etc/nginx/"
+# register: stat_nginx_conf
-- name: install systemd service for rpi exporter
- become: yes
- copy:
- src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
- remote_src: yes
- dest: "/lib/systemd/system/rpi_exporter.service"
+# - name: install prometheus-nginx-exporter
+# become: yes
+# apt: name="prometheus-nginx-exporter"
+# when: stat_nginx_conf.stat.exists
-- name: install rpi exporter binary
- become: yes
- copy:
- src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
- remote_src: yes
- dest: "/usr/local/bin/rpi_exporter"
- mode: "0755"
+# # PostgreSQL
+# - name: check if running postgresql
+# stat: path="/etc/postgresql/"
+# register: stat_postgresql_conf
-- name: ensure systemd services are started
- become: yes
- systemd: name="rpi_exporter.service" enabled="yes" state="started"
+# - name: install prometheus-postgresql-exporter
+# become: yes
+# apt: name="prometheus-postgres-exporter"
+# when: stat_postgresql_conf.stat.exists
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/prometheus/rpi-client/defaults/main.yaml Sun Feb 09 20:56:26 2020 -0600
@@ -0,0 +1,5 @@
+---
+
+prometheus_client_rpi_exporter_version: "0.6.0"
+prometheus_client_arch: "{{ansible_architecture}}"
+prometheus_client_rpi_dest: "rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/prometheus/rpi-client/meta/main.yaml Sun Feb 09 20:56:26 2020 -0600
@@ -0,0 +1,4 @@
+---
+
+dependencies:
+ - role: "prometheus/client"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/prometheus/rpi-client/tasks/main.yaml Sun Feb 09 20:56:26 2020 -0600
@@ -0,0 +1,30 @@
+---
+
+- name: add prometheus user to video group for rpi GPU stats
+ become: yes
+ user: name="prometheus" groups="video" append="yes"
+
+- name: install prometheus rpi exporter
+ unarchive:
+ src: "https://github.com/lukasmalkmus/rpi_exporter/releases/download/v{{prometheus_client_rpi_exporter_version}}/rpi_exporter-{{prometheus_client_rpi_exporter_version}}.linux-{{prometheus_client_arch}}.tar.gz"
+ remote_src: yes
+ dest: "/tmp/"
+
+- name: install systemd service for rpi-exporter
+ become: yes
+ copy:
+ src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter.service"
+ remote_src: yes
+ dest: "/lib/systemd/system/rpi_exporter.service"
+
+- name: install rpi-exporter binary
+ become: yes
+ copy:
+ src: "/tmp/{{prometheus_client_rpi_dest}}/rpi_exporter"
+ remote_src: yes
+ dest: "/usr/local/bin/rpi_exporter"
+ mode: "0755"
+
+- name: ensure systemd service is started
+ become: yes
+ systemd: name="rpi_exporter.service" enabled="yes" state="started"