From bc35cd8e908bbb9d5d2b9093aaac8ca3b175ce70 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Thu, 1 Apr 2021 09:40:22 +0200 Subject: [PATCH] Move templates of the prometheus role --- roles/prometheus/tasks/main.yml | 23 ++++++++----------- .../{prometheus => }/alert.rules.yml.j2 | 0 .../{prometheus => }/django.rules.yml.j2 | 0 .../{prometheus => }/prometheus.yml.j2 | 0 .../templates/{prometheus => }/snmp.yml.j2 | 0 5 files changed, 10 insertions(+), 13 deletions(-) rename roles/prometheus/templates/{prometheus => }/alert.rules.yml.j2 (100%) rename roles/prometheus/templates/{prometheus => }/django.rules.yml.j2 (100%) rename roles/prometheus/templates/{prometheus => }/prometheus.yml.j2 (100%) rename roles/prometheus/templates/{prometheus => }/snmp.yml.j2 (100%) diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index a3d2063..3a590c9 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -11,20 +11,16 @@ - name: Configure Prometheus template: - src: prometheus/prometheus.yml.j2 + src: prometheus.yml.j2 dest: /etc/prometheus/prometheus.yml - mode: 0644 - notify: Restart Prometheus - -- name: Configure Prometheus alert rules - template: - src: "prometheus/{{ item }}.j2" - dest: "/etc/prometheus/{{ item }}" - mode: 0644 - notify: Restart Prometheus + owner: prometheus + group: prometheus + mode: u=r,g=r,o= loop: + - prometheus.yml - alert.rules.yml - django.rules.yml + notify: Restart Prometheus - name: Make Prometheus snmp-exporter listen on localhost only lineinfile: @@ -36,10 +32,11 @@ # This file store SNMP OIDs - name: Configure Prometheus snmp-exporter template: - src: "prometheus/snmp.yml.j2" - dest: "/etc/prometheus/snmp.yml" - mode: 0600 + src: snmp.yml.j2 + dest: /etc/prometheus/snmp.yml owner: prometheus + group: prometheus + mode: u=r,g=r,o= notify: Restart prometheus-snmp-exporter # We don't need to restart Prometheus when updating nodes diff --git a/roles/prometheus/templates/prometheus/alert.rules.yml.j2 b/roles/prometheus/templates/alert.rules.yml.j2 similarity index 100% rename from roles/prometheus/templates/prometheus/alert.rules.yml.j2 rename to roles/prometheus/templates/alert.rules.yml.j2 diff --git a/roles/prometheus/templates/prometheus/django.rules.yml.j2 b/roles/prometheus/templates/django.rules.yml.j2 similarity index 100% rename from roles/prometheus/templates/prometheus/django.rules.yml.j2 rename to roles/prometheus/templates/django.rules.yml.j2 diff --git a/roles/prometheus/templates/prometheus/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 similarity index 100% rename from roles/prometheus/templates/prometheus/prometheus.yml.j2 rename to roles/prometheus/templates/prometheus.yml.j2 diff --git a/roles/prometheus/templates/prometheus/snmp.yml.j2 b/roles/prometheus/templates/snmp.yml.j2 similarity index 100% rename from roles/prometheus/templates/prometheus/snmp.yml.j2 rename to roles/prometheus/templates/snmp.yml.j2