Files
configpolicy/roles/blackbox-exporter/tasks/install.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

56 lines
1.3 KiB
YAML

- name: load installation variables
include_vars: install.yml
tags:
- always
- name: load architecture variables
include_vars: '{{ item }}'
with_first_found:
- '{{ ansible_architecture }}.yml'
- arch-defaults.yml
tags:
- always
- name: ensure blackbox_exporter release archive is available
delegate_to: localhost
become: false
get_url:
url: '{{ blackbox_xptr_tar_url }}'
checksum: 'sha256:{{ blackbox_xptr_cksm_url }}'
dest: '{{ playbook_dir }}/tmp/{{ blackbox_xptr_tar_name }}'
tags:
- download
- name: ensure blackbox_exporter archive is unpacked locally
delegate_to: localhost
become: false
unarchive:
src: '{{ playbook_dir }}/tmp/{{ blackbox_xptr_tar_name }}'
dest: '{{ playbook_dir }}/tmp/'
remote_src: true
creates: '{{ blackbox_xptr_extract_dir }}/blackbox_exporter'
tags:
- unarchive
- name: ensure blackbox_exporter is installed
copy:
src: '{{ blackbox_xptr_extract_dir }}/blackbox_exporter'
dest: /usr/local/sbin/blackbox_exporter
mode: u=rwx,go=rx
diff: false
notify:
- restart blackbox_exporter
- name: ensure blackbox_exporter systemd unit is installed
file:
src: blackbox_exporter.service
dest: /etc/systemd/system/blackbox_exporter.services
mode: u=rw,go=r
notify:
- reload systemd
- restart blackbox_exporter
tags:
- service
- systemd