prometheus: enable file discovery

This commit is contained in:
Ryan Cavicchioni 2024-04-14 17:50:31 -05:00
parent 1982782284
commit 01314cb137

View File

@ -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