diff options
| author | Colin Wilk <colin.wilk@tum.de> | 2023-05-27 19:57:38 +0200 |
|---|---|---|
| committer | Colin Wilk <colin.wilk@tum.de> | 2023-05-27 19:57:38 +0200 |
| commit | 0b2823d40892ffca4c0c64536c6a821cebaf3ff6 (patch) | |
| tree | ab8300fc9036d628b1393be43faf11a38014ef0b /tasks | |
| parent | 86becf489d216cb6de226d544ca128696f41357e (diff) | |
| download | ansible-role-prometheus-target-0b2823d40892ffca4c0c64536c6a821cebaf3ff6.tar.gz ansible-role-prometheus-target-0b2823d40892ffca4c0c64536c6a821cebaf3ff6.zip | |
Switch to single host per exporter configuration
Before you could do multiple hosts per exporter like this:
- id: node_exporter
hosts:
- host1
- host2
This was removed since it simplifies the code quite a bit and you can
still archive the same behavior like this:
- { id: node_exporter, host: host1 }
- { id: node_exporter, host: host2 }
Signed-off-by: Colin Wilk <colin.wilk@tum.de>
Diffstat (limited to 'tasks')
| -rw-r--r-- | tasks/lineinfile.yml | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tasks/lineinfile.yml b/tasks/lineinfile.yml index c90e823..ff09478 100644 --- a/tasks/lineinfile.yml +++ b/tasks/lineinfile.yml @@ -1,15 +1,14 @@ --- - 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 }}' + path: '{{ item.path if item.path is defined else prometheus_target_exporter_defaults[item.id].path }}' line: '{{ prometheus_target_strategy_lineinfile_prefix ~ - (item.1 if item.1 != "" else prometheus_target_exporter_defaults[item.0.id].host) ~ + (item.host if item.host is defined else 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 | selectattr("hosts", "defined") | subelements("hosts")) - + (prometheus_target_exporter | selectattr("hosts", "undefined") | product([""])) }}' + loop: '{{ prometheus_target_exporter }}' notify: - Run command hook - Run shell hook |