This role will setup Blackbox exporter on any Linux machine using systemd.
- systemd on the target host
- gnu-tar on Mac deployer host (
brew install gnu-tar
)
blackbox_exporter_version
: the version that will be downloaded and installed. (0.14.0
).
The role will download the Blackbox exporter release on the deployer and upload the binary on the target host.
If the /usr/local/bin/blackbox_exporter
binary already exists, the role will skip the install steps. You can force them (to update, for instance), by setting blackbox_exporter_force_install
to true
.
blackbox_exporter_system_group
: system user that will run the exporter (blackbox-exporter
)blackbox_exporter_system_user
: system group that will run the exporter ({{ blackbox_exporter_system_group }}
)blackbox_exporter_listen_address
: the address the exporter will listen on (0.0.0.0:9115
)blackbox_exporter_service_flags
: extra flags passed to the binary via the systemd unit. ({}
)blackbox_exporter_configuration_modules
: you can define your modules here. See the documentation for more details, as well asdefaults/main.yml
, which contains some ready-to-use modules.
---
- hosts: myhost
roles: blackbox-exporter
vars:
blackbox_exporter_web_listen_address: "127.0.0.1:9115"
Most of the config is done on Prometheus. See the docs.
If you are using my Prometheus role, here's a sample config:
- hosts: myhost
roles: prometheus
vars:
prometheus_scrape_configs:
- job_name: 'blackbox_exporter'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://angristan.xyz
- https://angristan.fr
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
MIT. See LICENSE for more details.
This role is largely inspired by cloudalchemy/ansible-blackbox-exporter.
See my other Ansible roles at angristan/ansible-roles.