1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-10-23 11:56:59 +02:00
ansible-collection-prometheus/roles/prometheus/tasks/blackbox.yml

31 lines
1 KiB
YAML
Raw Normal View History

2020-11-13 10:36:46 +01:00
---
- name: initialize list of blackbox modules
ansible.builtin.set_fact:
_blackbox_modules: {}
- name: build list of blackbox modules
ansible.builtin.set_fact:
_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 }}"
2020-11-13 10:36:46 +01:00
- name: render blackbox exporter configuration
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
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