Files
configpolicy/roles/blackbox-exporter/tasks/deploy.yml
Dustin C. Hatch 1e14dd7905 r/blackbox-exporter: Deploy blackbox_exporter
The Prometheus *blackbox_exporter* is a tool that can perform arbitrary,
generic ICMP, TCP, or HTTP "probes" against external services.  This is
useful for applications that do not export their own metrics, and for
evaluating the health of protocol-level operations (e.g. TLS
certificate expiration).

The *blackbox-exporter* Ansible role installs and configures the
Blackbox Exporter on the target system.  It fetches the specified binary
release from Github and copies it to the remote machine.  It also
creates a systemd unit and configures the Blackbox exporter's "modules"
from the `blackbox_modules` Ansible variable.
2022-08-10 22:18:53 -05:00

34 lines
703 B
YAML

- name: ensure /etc/prometheus directory exists
file:
path: /etc/prometheus
mode: u=rwx,go=rx
owner: root
group: root
state: directory
- name: ensure blackbox_exporter is configured
copy:
dest: /etc/prometheus/blackbox.yml
content: |
{{ blackbox_config|to_nice_yaml(indent=2) }}
mode: u=rw,go=r
owner: root
group: root
notify:
- reload blackbox_exporter
- name: ensure blackbox_exporter starts at boot
service:
name: blackbox_exporter
enabled: true
tags:
- service
- name: flush_handlers
meta: flush_handlers
- name: ensure blackbox_exporter is running
service:
name: blackbox_exporter
state: started
tags:
- service