atosatto.alertmanager
Ansible Role: Alertmanager
This role installs and sets up Prometheus Alertmanager.
Requirements
- You need Ansible version 2.2 or higher.
- This role uses the Ansible
json_filter
, which requiresjmespath
to be installed on the Ansible machine. Checkrequirements.txt
for the required version ofjmespath
.
Role Variables
Here are the available variables with their default values (see defaults/main.yml):
alertmanager_release_tag
: "latest"
This is the version of Alertmanager to install. By default, it uses the latest version from here.alertmanager_release_url
: ""
If you specify a URL here, it will download Alertmanager from that URL instead of the default GitHub URL.alertmanager_user
: "alertmanager"
The system user for Alertmanager.alertmanager_group
: "alertmanager"
The system group for Alertmanager.alertmanager_install_path
: "/opt"
The location where the downloaded Alertmanager files will be stored.alertmanager_bin_path
: "/usr/local/bin"
Where the Alertmanager executable files will be linked.alertmanager_config_path
: "/etc/alertmanager"
The directory for Alertmanager configuration files.alertmanager_config_file
: "alertmanager.yml"
The name of the configuration file for Alertmanager.alertmanager_config
: {}
A YAML structure holding the Alertmanager configuration. For complete configuration options, visit this link.
NOTE: This configuration will be combined with the default settings invars/main.yml
.alertmanager_templates_path
: "{{ alertmanager_config_path }}/templates"
The directory for Alertmanager templates.alertmanager_templates
: {}
Definitions for Alertmanager templates.alertmanager_listen_address
: "127.0.0.1:9093"
The IP address and port on which the Alertmanager web server listens.
NOTE: Metrics will be available at{{ alertmanager_listen_address }}/metrics
.alertmanager_storage_path
: "/var/lib/alertmanager"
The directory used for storing Alertmanager's notification states and silences.alertmanager_storage_retention
: "120h"
Old notification data will be deleted after 120 hours by default.alertmanager_log_level
: "info"
The verbosity level of Alertmanager logs.alertmanager_additional_cli_args
: ""
Additional command-line arguments for the Alertmanager service unit. For all available options, runalertmanager --help
.
Dependencies
There are no additional dependencies.
Example Playbooks
Here’s a simple playbook example:
$ cat playbook.yml
- name: "Install and configure Prometheus Alertmanager"
hosts: all
roles:
- { role: atosatto.alertmanager }
Testing
Tests are automated using Molecule.
To install dependencies:
$ pip install tox
To run all tests, use:
$ tox
For a specific Molecule command, run:
$ tox -e py27-ansible29 -- molecule test -s alertmanager-latest
License
This project is licensed under the MIT License.
Author Information
The author is Andrea Tosatto (@_hilbert_).
Install and Configure Prometheus Alertmanager
ansible-galaxy install atosatto.alertmanager