|
| 1 | +# blackbox_exporter |
| 2 | + |
| 3 | +Install Blackbox Exporter |
| 4 | + |
| 5 | +This role handles the download, installation, and configuration of the Prometheus Blackbox Exporter on a Linux host. The Blackbox Exporter is used to probe endpoints over various protocols, and this role ensures it is set up as a systemd service, running under a dedicated user and group, ready for configuration and use with Prometheus. |
| 6 | + |
| 7 | +The role will: |
| 8 | +- Create a dedicated system user and group (`blackbox`) for the service. |
| 9 | +- Download the specified Blackbox Exporter tarball from the provided URL. |
| 10 | +- Extract the Blackbox Exporter binary to the configured binary directory (`/usr/local/bin` by default). |
| 11 | +- Set up a systemd service file for Blackbox Exporter. |
| 12 | +- Ensure the Blackbox Exporter service is running and enabled on system boot. |
| 13 | + |
| 14 | +# Requirements |
| 15 | + |
| 16 | +- A running `systemd` instance for service management. |
| 17 | +- Internet access on the target host to download the Blackbox Exporter tarball. |
| 18 | +- Root or `sudo` privileges are required to manage packages, users, and system services. |
| 19 | + |
| 20 | +# Dependencies |
| 21 | + |
| 22 | +None. |
| 23 | + |
| 24 | +# Parameters |
| 25 | + |
| 26 | +| Variable | Type | Required | Default | Description | |
| 27 | +| --- | --- | --- | --- | --- | |
| 28 | +| `blackbox_tarball_url` | `str` | `False` | `https://github.com/prometheus/blackbox_exporter/releases/download/v0.24.0/blackbox_exporter-0.24.0.linux-amd64.tar.gz` | URL to the Blackbox Exporter distribution archive file. | |
| 29 | +| `blackbox_directory` | `path` | `False` | `/etc/blackbox` | The directory for Blackbox Exporter configuration files. | |
| 30 | +| `blackbox_bin_directory` | `path` | `False` | `/usr/local/bin` | The directory where the Blackbox Exporter binary will be placed. | |
| 31 | +| `blackbox_tarball_file` | `str` | `False` | `blackbox.tar.gz` | The intermediate filename to use for the downloaded tarball. | |
| 32 | +| `blackbox_user` | `str` | `False` | `blackbox` | The system username under which the Blackbox Exporter service will run. | |
| 33 | +| `blackbox_group` | `str` | `False` | `blackbox` | The system group under which the Blackbox Exporter service will run. | |
| 34 | +| `blackbox_service_directory` | `path` | `False` | `/etc/systemd/system/blackbox.service` | Full path to the systemd service file for Blackbox Exporter. | |
| 35 | + |
| 36 | +# Example Playbook |
| 37 | + |
| 38 | +```yaml |
| 39 | +- hosts: monitoring_targets |
| 40 | + tasks: |
| 41 | + - name: Install Blackbox Exporter with default settings |
| 42 | + ansible.builtin.import_role: |
| 43 | + name: cloudera.exe.blackbox_exporter |
| 44 | + # All variables will use their defaults. |
| 45 | + |
| 46 | + - name: Install a custom version of Blackbox Exporter |
| 47 | + ansible.builtin.import_role: |
| 48 | + name: cloudera.exe.blackbox_exporter |
| 49 | + vars: |
| 50 | + blackbox_tarball_url: "[https://github.com/prometheus/blackbox_exporter/releases/download/v0.25.0/blackbox_exporter-0.25.0.linux-amd64.tar.gz](https://github.com/prometheus/blackbox_exporter/releases/download/v0.25.0/blackbox_exporter-0.25.0.linux-amd64.tar.gz)" |
| 51 | + blackbox_tarball_file: "blackbox-0.25.0.tar.gz" |
| 52 | + blackbox_user: "prom_exporter" |
| 53 | + blackbox_group: "prom_exporter" |
| 54 | +``` |
| 55 | +
|
| 56 | +# License |
| 57 | +
|
| 58 | +``` |
| 59 | +Copyright 2025 Cloudera, Inc. |
| 60 | + |
| 61 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 62 | +you may not use this file except in compliance with the License. |
| 63 | +You may obtain a copy of the License at |
| 64 | + |
| 65 | + https://www.apache.org/licenses/LICENSE-2.0 |
| 66 | + |
| 67 | +Unless required by applicable law or agreed to in writing, software |
| 68 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 69 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 70 | +See the License for the specific language governing permissions and |
| 71 | +limitations under the License. |
| 72 | +``` |
0 commit comments