2020-11-13 10:36:46 +01:00
|
|
|
---
|
|
|
|
|
2021-10-09 03:17:05 +02:00
|
|
|
- name: initialize list of blackbox modules
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-10-09 03:40:36 +02:00
|
|
|
_blackbox_modules: {}
|
2021-10-09 03:17:05 +02:00
|
|
|
|
|
|
|
- name: build list of blackbox modules
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.set_fact:
|
2021-10-09 03:40:36 +02:00
|
|
|
_blackbox_modules: "{% set _ = _blackbox_modules.update(item) %}{{ _blackbox_modules }}"
|
|
|
|
loop: "{{ hostvars[inventory_hostname] | dict2items | selectattr('key', 'match', '^prometheus_job_.+$') | map(attribute='value') | map(attribute='blackbox') | map(attribute='modules') | select('defined') | list }}"
|
2021-10-09 03:17:05 +02:00
|
|
|
|
2020-11-13 10:36:46 +01:00
|
|
|
- name: render blackbox exporter configuration
|
2021-11-03 02:25:21 +01:00
|
|
|
ansible.builtin.template:
|
2021-11-06 05:22:17 +01:00
|
|
|
src: etc/prometheus/blackbox.yml.j2
|
2020-11-13 10:36:46 +01:00
|
|
|
dest: /etc/prometheus/blackbox.yml
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
2021-10-09 03:17:05 +02:00
|
|
|
vars:
|
|
|
|
blackbox_modules: "{{ _blackbox_modules }}"
|
2020-11-13 10:36:46 +01:00
|
|
|
notify: restart blackbox exporter
|
2021-11-06 05:22:17 +01:00
|
|
|
|
|
|
|
- name: render /etc/default/prometheus-blackbox-exporter
|
|
|
|
ansible.builtin.template:
|
2021-11-06 05:32:01 +01:00
|
|
|
src: etc/default/prometheus-blackbox-exporter.j2
|
2021-11-06 05:22:17 +01:00
|
|
|
dest: /etc/default/prometheus-blackbox-exporter
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
notify: restart blackbox exporter
|