mesaguy.prometheus
Ansible Prometheus
This playbook installs and manages the Prometheus server, Alertmanager, PushGateway, and many Prometheus exporters.
It is designed to easily add new exporters and regular updates ensure it always has the latest Prometheus software. This role can also automatically register client exporters with the Prometheus server.
Requirements
- Ansible version 2.8.0 or higher
- Facts must be gathered (set
gather_facts: true
)
Supported Software and Operating Systems
Supported Operating Systems, Distributions, and Architectures
This module supports various distributions and architectures. Here’s a table of tested combinations. Most exporters work on ARM architectures too:
OS | Release | Architectures |
---|---|---|
Alpine | 3.2 to 3.11, edge | x86_64 (amd64) |
AmazonLinux | 1 and 2 | x86_64 (amd64) |
ArchLinux | Current | x86_64 (amd64) |
Enterprise Linux | 6, 7, 8 | x86_64 (amd64) |
Fedora | 20 to 31, rawhide | x86_64 (amd64) |
Gentoo (openrc) | Current | x86_64 (amd64) |
Gentoo (systemd) | Current | x86_64 (amd64) |
OpenSUSE | 13.1 to tumbleweed | x86_64 (amd64) |
Oracle Linux | 6, 7, 8 | x86_64 (amd64) |
Ubuntu | 16.04 to 20.04 | x86_64 (amd64) |
Managed Prometheus software
The following core Prometheus software is fully supported and tested:
Prometheus software | Usage | Author | CI tested |
---|---|---|---|
prometheus | usage | prometheus | Yes |
alertmanager | usage | prometheus | Yes |
push_gateway | usage | prometheus | Yes |
Managed exporters
All exporters can be installed, and some undergo CI testing. Check each exporter's usage page for details:
Exporter | Usage | Author | CI tested |
---|---|---|---|
389ds_exporter_terrycain | usage | terrycain | Yes |
apache_exporter_lusitaniae | usage | Lusitaniae | Yes |
aerospike_exporter_alicebob | usage | alicebob | Yes |
... | ... | ... | ... |
Managed node_exporter textfiles scripts
Different node_exporter textfile scripts can be supported and installed by using specific variables, with these scripts usually located at '/opt/prometheus/scripts'.
Role Variables
The prometheus_components
variable is used to specify the software to install. Here’s an example that installs everything supported:
prometheus_components:
- alertmanager
- prometheus
- push_gateway
- 389ds_exporter_terrycain
- apache_exporter_lusitaniae
- aerospike_exporter_alicebob
- ... # Continue with relevant exporters
Common Variables
If an installation fails, the default is to stop the process. You can set a global variable to allow installation from source instead:
prometheus_fallback_to_build: true
This allows for individual expressions too, such as:
prometheus_blackbox_exporter_fallback_to_build: true
There are various configurations available for the Prometheus service, user management, log rotation, and firewall management.
Example Playbook
Here’s an example of a playbook that installs the Prometheus server along with some exporters:
- hosts: prometheus_servers
vars:
prometheus_components:
- prometheus
- alertmanager
- blackbox_exporter
- node_exporter
prometheus_port: 10000
prometheus_extra_opts:
- '--storage.tsdb.retention=90d'
roles:
- mesaguy.prometheus
If you need to handle the installation of various components step-by-step, you can include roles individually as shown.
Additional Information
The module installs using pre-compiled binaries when possible and will compile from source if needed.
Security
This module does not manage firewall rules or enforce HTTPS. It's recommended to incorporate security practices outside of this role.
License
This role is licensed under the MIT License. Check the LICENSE file for details.
Author Information
Created by Mesaguy: GitHub Profile
install and manage prometheus and prometheus exporters
ansible-galaxy install mesaguy.prometheus