From 01314cb1370104b57b57f1e43ce10a534f2a1e3b Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Sun, 14 Apr 2024 17:50:31 -0500 Subject: [PATCH] prometheus: enable file discovery --- roles/prometheus/tasks/configure.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/roles/prometheus/tasks/configure.yaml b/roles/prometheus/tasks/configure.yaml index cb0c615..f26b93b 100644 --- a/roles/prometheus/tasks/configure.yaml +++ b/roles/prometheus/tasks/configure.yaml @@ -23,6 +23,14 @@ group: "{{ prometheus_etc_group }}" mode: "{{ prometheus_etc_mode }}" +- name: create file_sd_config.d path + file: + path: "{{ prometheus_etc_path }}/file_sd_config.d" + state: directory + owner: "{{ prometheus_etc_owner }}" + group: "{{ prometheus_etc_group }}" + mode: "{{ prometheus_etc_mode }}" + - name: create var path file: path: "{{ prometheus_var_path }}" @@ -49,6 +57,15 @@ mode: 0444 notify: reload prometheus +- name: configure file_sd_config.d + copy: + dest: "{{ prometheus_etc_path }}/file_sd_config.d/{{ item.name }}" + content: "{{ (item.targets | default([])) | to_json }}" + owner: root + group: root + mode: 0444 + loop: "{{ prometheus_file_sd_config_d_files | default([]) }}" + - name: configure systemd template template: src: prometheus.service.j2