From 9db96602063e6ceb3cb8e819a8e942f28061bb42 Mon Sep 17 00:00:00 2001 From: Colin Wilk Date: Fri, 26 May 2023 19:59:24 +0200 Subject: init Signed-off-by: Colin Wilk --- tasks/lineinfile.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tasks/lineinfile.yml (limited to 'tasks/lineinfile.yml') diff --git a/tasks/lineinfile.yml b/tasks/lineinfile.yml new file mode 100644 index 0000000..c90e823 --- /dev/null +++ b/tasks/lineinfile.yml @@ -0,0 +1,15 @@ +--- +- name: Make sure targets are deployed + ansible.builtin.lineinfile: + path: '{{ item.0.path if item.0.path is defined else prometheus_target_exporter_defaults[item.0.id].path }}' + line: '{{ prometheus_target_strategy_lineinfile_prefix ~ + (item.1 if item.1 != "" else prometheus_target_exporter_defaults[item.0.id].host) ~ + prometheus_target_strategy_lineinfile_suffix }}' + state: present + become: true + delegate_to: '{{ prometheus_target_host }}' + loop: '{{ (prometheus_target_exporter | selectattr("hosts", "defined") | subelements("hosts")) + + (prometheus_target_exporter | selectattr("hosts", "undefined") | product([""])) }}' + notify: + - Run command hook + - Run shell hook -- cgit v1.2.3