From 232bdca2add4253981b0873188663069f74a0610 Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Sun, 11 Jun 2023 18:53:04 +0200 Subject: Add ability to specify target path prefix This will decrease the amount of redundant configuration for users by allowing them to specify a general prefix on global / exporter / play level Signed-off-by: Colin Wilk --- tasks/lineinfile.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tasks') diff --git a/tasks/lineinfile.yml b/tasks/lineinfile.yml index 5f93b92..d7f0793 100644 --- a/tasks/lineinfile.yml +++ b/tasks/lineinfile.yml @@ -1,7 +1,10 @@ --- - name: Make sure targets are deployed ansible.builtin.lineinfile: - path: '{{ item.path | default(prometheus_target_exporter_defaults[item.id].path) }}' + path: '{{ (item.path_prefix + | default(prometheus_target_exporter_defaults[item.id].path_prefix) + | default(prometheus_target_exporter_target_prefix)) ~ + item.path | default(prometheus_target_exporter_defaults[item.id].path) }}' line: '{{ prometheus_target_strategy_lineinfile_prefix ~ (item.host | default(prometheus_target_exporter_defaults[item.id].host)) ~ prometheus_target_strategy_lineinfile_suffix }}' -- cgit v1.2.3