diff options
| author | Colin Wilk <colin.wilk@tum.de> | 2023-06-11 18:53:04 +0200 |
|---|---|---|
| committer | Colin Wilk <colin.wilk@tum.de> | 2023-06-11 18:53:04 +0200 |
| commit | 232bdca2add4253981b0873188663069f74a0610 (patch) | |
| tree | f455d26babf600baad72e5e68d02a7f2730e548c /tasks | |
| parent | 7623b7302f445798fb9d6fe31c1c1eb7085173a4 (diff) | |
| download | ansible-role-prometheus-target-232bdca2add4253981b0873188663069f74a0610.tar.gz ansible-role-prometheus-target-232bdca2add4253981b0873188663069f74a0610.zip | |
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 <colin.wilk@tum.de>
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/lineinfile.yml | 5 |
1 files changed, 4 insertions, 1 deletions
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 }}' |