mirror of
https://gitlab.com/s3lph/ansible-collection-prometheus
synced 2024-11-22 09:41:01 +01:00
Add dnsbl exporter
This commit is contained in:
parent
b1d4cef351
commit
1aa32f43d7
8 changed files with 91 additions and 0 deletions
4
roles/dnsbl_exporter/defaults/main.yml
Normal file
4
roles/dnsbl_exporter/defaults/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
prometheus_dnsbl_exporter_rbls: []
|
||||||
|
prometheus_dnsbl_exporter_args: ""
|
6
roles/dnsbl_exporter/handlers/main.yml
Normal file
6
roles/dnsbl_exporter/handlers/main.yml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: restart prometheus-dnsbl-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-dnsbl-exporter
|
||||||
|
state: restarted
|
29
roles/dnsbl_exporter/tasks/config.yml
Normal file
29
roles/dnsbl_exporter/tasks/config.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: render /etc/default/prometheus-dnsbl-exporter
|
||||||
|
template:
|
||||||
|
src: etc/default/prometheus-dnsbl-exporter.j2
|
||||||
|
dest: /etc/default/prometheus-dnsbl-exporter
|
||||||
|
notify: restart prometheus-dnsbl-exporter
|
||||||
|
|
||||||
|
- name: render rbls.ini
|
||||||
|
template:
|
||||||
|
src: etc/prometheus/dnsbl-exporter/rbls.ini.j2
|
||||||
|
dest: /etc/prometheus/dnsbl-exporter/rbls.ini
|
||||||
|
vars:
|
||||||
|
rbls: "{{ prometheus_dnsbl_exporter_rbls }}"
|
||||||
|
notify: restart prometheus-dnsbl-exporter
|
||||||
|
|
||||||
|
- name: render targets.ini
|
||||||
|
template:
|
||||||
|
src: etc/prometheus/dnsbl-exporter/targets.ini.j2
|
||||||
|
dest: /etc/prometheus/dnsbl-exporter/targets.ini
|
||||||
|
vars:
|
||||||
|
targets: "{{ hostvars.keys() | selectattr('monitor_dnsbl', 'true') }}"
|
||||||
|
notify: restart prometheus-dnsbl-exporter
|
||||||
|
|
||||||
|
- name: start and enable prometheus-dnsbl-exporter
|
||||||
|
service:
|
||||||
|
name: prometheus-dnsbl-exporter
|
||||||
|
state: started
|
||||||
|
enabled: yes
|
26
roles/dnsbl_exporter/tasks/install.yml
Normal file
26
roles/dnsbl_exporter/tasks/install.yml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: add s3lphrepo apt key
|
||||||
|
apt_key:
|
||||||
|
data: |
|
||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
mDMEXu0vYhYJKwYBBAHaRw8BAQdAavB6HHoI15+Dh4ackdZuCjRkPzWcG64DHVxu
|
||||||
|
C2yDFfG0X3MzbHBoJ3MgQ3VzdG9tIERlYmlhbiBSZXBvc2l0b3J5IChBdXRvbWF0
|
||||||
|
ZWQgUGlwZWxpbmUpIDxhY2NvdW50LWdpdGxhYi1pZGV5bml6dkBrZXJuZWxwYW5p
|
||||||
|
Yy5sb2w+iJAEExYIADgWIQQ/Y+h7ABiB4vyzwPu8TSozeH+lRAUCXu0vYgIbAwUL
|
||||||
|
CQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRC8TSozeH+lRNzVAPsEKmhB0kl5Toyj
|
||||||
|
fBPUAJ6Fr+0ljZwoj1oR16Kl9GvkzQD/XqsZC+sYSImXhDTx6iDXm1WYycgB7Abt
|
||||||
|
1dm6aN640gU=
|
||||||
|
=YLAj
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
||||||
|
|
||||||
|
- name: add s3lphrepo
|
||||||
|
apt_repository:
|
||||||
|
repo: deb https://kernelpanic.lol/repo stable main
|
||||||
|
filename: s3lphrepo
|
||||||
|
|
||||||
|
- name: install prometheus-dnsbl-exporter
|
||||||
|
package:
|
||||||
|
name: prometheus-dnsbl-exporter
|
||||||
|
state: present
|
11
roles/dnsbl_exporter/tasks/main.yml
Normal file
11
roles/dnsbl_exporter/tasks/main.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- import_tasks: install.yml
|
||||||
|
tags:
|
||||||
|
- "role::dnsbl_exporter"
|
||||||
|
- "role::dnsbl_exporter:install"
|
||||||
|
|
||||||
|
- import_tasks: config.yml
|
||||||
|
tags:
|
||||||
|
- "role::dnsbl_exporter"
|
||||||
|
- "role::dnsbl_exporter:config"
|
|
@ -0,0 +1,3 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
ARGS="--config.rbls=/etc/prometheus/dnsbl-exporter/rbls.ini --config.targets=/etc/prometheus/dnsbl-exporter/targets.ini {{ prometheus_dnsbl_exporter_args }}"
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[rbl]
|
||||||
|
{% for rbl in rbls %}
|
||||||
|
server={{ rbl }}
|
||||||
|
{% endfor %}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{ ansible_managed | comment }}
|
||||||
|
|
||||||
|
[targets]
|
||||||
|
{% for target in targets %}
|
||||||
|
server={{ target }}
|
||||||
|
{% endfor %}
|
Loading…
Reference in a new issue