aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tasks/lineinfile.yml
blob: d7f0793d9f2d4760ace2a3541a58bc1001001f9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
---
- name: Make sure targets are deployed
  ansible.builtin.lineinfile:
    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 }}'
    state: present
  become: true
  delegate_to: '{{ prometheus_target_host }}'
  loop: '{{ prometheus_target_exporter +
         ([] if prometheus_target_skip_default_exporters else prometheus_target_default_exporters) }}'
  notify:
    - Run command hook
    - Run shell hook