From 11baa089a6aaf62a5c35f8009aebf889a4bf85fa Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 10 Jun 2021 01:29:39 +0200 Subject: prometheus: generate target configs --- roles/monitoring/prometheus/server/tasks/main.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'roles/monitoring/prometheus') diff --git a/roles/monitoring/prometheus/server/tasks/main.yml b/roles/monitoring/prometheus/server/tasks/main.yml index 6b030fb4..492e8dc2 100644 --- a/roles/monitoring/prometheus/server/tasks/main.yml +++ b/roles/monitoring/prometheus/server/tasks/main.yml @@ -50,6 +50,17 @@ - name: create TLS CA and certificates import_tasks: tls.yml +- name: generate targets config + loop: "{{ prometheus_zone_targets }}" + copy: + content: | + - targets: [ "{{ hostvars[item].ansible_default_ipv4.address }}:9999" ] + labels: + instance: "{{ item }}" + dest: "/etc/prometheus/targets/{{ item }}.yml" + +# TODO: enable targets for configured jobs using symlinks in /etc/prometheus/jobs/*/ + - name: generate configuration file template: src: prometheus.yml.j2 -- cgit v1.2.3