aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tasks/lineinfile.yml
diff options
context:
space:
mode:
Diffstat (limited to 'tasks/lineinfile.yml')
-rw-r--r--tasks/lineinfile.yml15
1 files changed, 15 insertions, 0 deletions
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