1
0
Fork 0
mirror of https://gitlab.com/s3lph/ansible-collection-prometheus synced 2024-12-22 08:17:33 +01:00

Add dnsbl exporter

This commit is contained in:
s3lph 2020-11-22 01:50:26 +01:00
parent b1d4cef351
commit 1aa32f43d7
8 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,4 @@
---
prometheus_dnsbl_exporter_rbls: []
prometheus_dnsbl_exporter_args: ""

View file

@ -0,0 +1,6 @@
---
- name: restart prometheus-dnsbl-exporter
service:
name: prometheus-dnsbl-exporter
state: restarted

View 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

View 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

View 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"

View file

@ -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 }}"

View file

@ -0,0 +1,6 @@
{{ ansible_managed | comment }}
[rbl]
{% for rbl in rbls %}
server={{ rbl }}
{% endfor %}

View file

@ -0,0 +1,6 @@
{{ ansible_managed | comment }}
[targets]
{% for target in targets %}
server={{ target }}
{% endfor %}