elan.monitoring_prometheus
Ansible Role for Prometheus
This guide helps you install the latest version of Prometheus using Ansible. This role is similar to Prometheus RPM but works on multiple operating systems.
Role Variables
You can choose which configuration file templates to use. The role will install a default configuration, but you will probably want to customize it. To use your own configuration file, set the path to your Jinja template in the variable prometheus_config_template
.
It also installs an .env
file that defines how Prometheus is run with systemd. You can provide your own file by setting the prometheus_env_file
variable, allowing you to customize it.
Example Playbook
To use this role in your playbook, simply add it like this:
- hosts: all
become: true
roles:
- role: elan.monitoring_prometheus
prometheus_config_template: 'custom_templates/prometheus.yml.j2'
Development
For testing and development, you can use Molecule. If you are using Podman as the driver, you can install it like this (if using Docker, replace podman
with docker
):
pip install -r .dev_requirements.txt
You can then create test instances, apply the Ansible configuration, and destroy the test instances with the following commands:
molecule create
molecule converge
molecule destroy
To inspect a running test instance, use molecule login --host <instance_name>
, replacing <instance_name>
with the name of the instance you want to check.
License
Author Information
ansible-galaxy install elan.monitoring_prometheus