From e16ce946e8cd5c3eeec40c0c86428547cf76fae8 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <qsx@chaotikum.eu>
Date: Sun, 14 Jun 2020 16:43:31 +0200
Subject: [PATCH] prometheus: Add Gentoo support

---
 prometheus/tasks/main.yml                | 22 ++++++++++++++++++++++
 prometheus/templates/confd-prometheus.j2 |  3 +++
 2 files changed, 25 insertions(+)
 create mode 100644 prometheus/templates/confd-prometheus.j2

diff --git a/prometheus/tasks/main.yml b/prometheus/tasks/main.yml
index ce4f8e2..a5f55c2 100644
--- a/prometheus/tasks/main.yml
+++ b/prometheus/tasks/main.yml
@@ -5,6 +5,16 @@
     name:
       - prometheus
     state: present
+  when: ansible_distribution_file_variety == "Debian"
+  tags:
+    - prometheus
+
+- name: Install prometheus
+  portage:
+    package:
+      - app-metrics/prometheus
+    state: present
+  when: ansible_distribution == "Gentoo"
   tags:
     - prometheus
 
@@ -14,6 +24,18 @@
     dest: /etc/default/prometheus
   notify:
     - Restart prometheus
+  when: ansible_distribution_file_variety == "Debian"
+  tags:
+    - prometheus
+    - config
+
+- name: Configure prometheus command arguments
+  template:
+    src: confd-prometheus.j2
+    dest: /etc/conf.d/prometheus
+  notify:
+    - Restart prometheus
+  when: ansible_distribution == "Gentoo"
   tags:
     - prometheus
     - config
diff --git a/prometheus/templates/confd-prometheus.j2 b/prometheus/templates/confd-prometheus.j2
new file mode 100644
index 0000000..b233503
--- /dev/null
+++ b/prometheus/templates/confd-prometheus.j2
@@ -0,0 +1,3 @@
+# arguments for Prometheus
+command_args="{{ prometheus_args }}"
+supervisor="supervise-daemon"
-- 
GitLab