cloudalchemy.alertmanager
DEPRECATED
This role is no longer in use and has been replaced by the prometheus-community/ansible collection.
Ansible Role: alertmanager
Description
Use Ansible to set up and manage the Prometheus alertmanager service.
Requirements
- Ansible version 2.7 or higher (previous versions may work, but we can't ensure it)
It's helpful to have Prometheus installed on your system.
Role Variables
You can change the following settings, which are all defined in the defaults/main.yml file and summarized in the table below.
Name | Default Value | Description |
---|---|---|
alertmanager_version |
0.21.0 | Version of Alertmanager package. You can also set it to latest . |
alertmanager_binary_local_dir |
"" | Use local packages instead of those from GitHub. Specify the directory where alertmanager and amtool binaries are stored on the server running Ansible. This will override the alertmanager_version . |
alertmanager_web_listen_address |
0.0.0.0:9093 | The address where Alertmanager will listen for requests. |
alertmanager_web_external_url |
http://localhost:9093/ | The external address where Alertmanager can be accessed, useful if it's behind a reverse proxy, e.g., example.org/alertmanager. |
alertmanager_config_dir |
/etc/alertmanager | Path to the directory containing Alertmanager configuration files. |
alertmanager_db_dir |
/var/lib/alertmanager | Path to the directory for Alertmanager's database files. |
alertmanager_config_file |
alertmanager.yml.j2 | Use this variable for a custom Alertmanager configuration file as an Ansible template. |
alertmanager_config_flags_extra |
{} | Extra configuration flags for the Prometheus binary at startup. |
alertmanager_template_files |
['alertmanager/templates/*.tmpl'] | Directories where Ansible will look for templates to copy to {{ alertmanager_config_dir }}/templates/ . Templates must have *.tmpl extension. |
alertmanager_resolve_timeout |
3m | Time after which an alert is marked as resolved. |
alertmanager_smtp |
{} | SMTP (email) settings. |
alertmanager_http_config |
{} | HTTP settings for custom webhooks. |
alertmanager_slack_api_url |
"" | URL for Slack webhook. |
alertmanager_pagerduty_url |
"" | URL for PagerDuty webhook. |
alertmanager_opsgenie_api_key |
"" | API key for Opsgenie webhook. |
alertmanager_opsgenie_api_url |
"" | URL for Opsgenie webhook. |
alertmanager_victorops_api_key |
"" | API key for VictorOps webhook. |
alertmanager_victorops_api_url |
"" | URL for VictorOps webhook. |
alertmanager_hipchat_api_url |
"" | URL for Hipchat webhook. |
alertmanager_hipchat_auth_token |
"" | Authentication token for Hipchat. |
alertmanager_wechat_url |
"" | URL for Enterprise WeChat webhook. |
alertmanager_wechat_secret |
"" | Secret token for Enterprise WeChat. |
alertmanager_wechat_corp_id |
"" | Corporation ID for Enterprise WeChat. |
alertmanager_cluster |
{listen-address: ""} | Configuration for HA cluster networking, disabled by default. More info in the Alertmanager readme. |
alertmanager_receivers |
[] | List of notification receivers, same as in the official docs. |
alertmanager_inhibit_rules |
[] | List of inhibition rules, same as in the official docs. |
alertmanager_route |
{} | Alert routing settings. More info in the official docs. |
alertmanager_amtool_config_file |
amtool.yml.j2 | Template for amtool configuration. |
alertmanager_amtool_config_alertmanager_url |
alertmanager_web_external_url |
URL for Alertmanager. |
alertmanager_amtool_config_output |
extended | Output format for amtool, use "" for simple output. |
Example
Playbook
---
hosts: all
roles:
- ansible-alertmanager
vars:
alertmanager_version: latest
alertmanager_slack_api_url: "http://example.com"
alertmanager_receivers:
- name: slack
slack_configs:
- send_resolved: true
channel: '#alerts'
alertmanager_route:
group_by: ['alertname', 'cluster', 'service']
group_wait: 30s
group_interval: 5m
repeat_interval: 3h
receiver: slack
Demo Site
We offer a demo site for a complete monitoring solution using Prometheus and Grafana. You can find the code repository and links to running instances on GitHub, with the site hosted on DigitalOcean.
Local Testing
To test the role locally, it's best to use Docker with molecule (v3.x). You need to have Docker installed. Follow the "Get started" guide for information on installing a suitable Docker package. Running tests is as easy as executing molecule test
.
Continuous Integration
We use molecule and CircleCI to test how new PRs will work with different versions of Ansible and operating systems. This also helps us create test scenarios for various role configurations. As a result, we have a large test matrix, which may take longer than local testing, so please bear with us.
Contributing
Please refer to the contributor guidelines.
Troubleshooting
Check the troubleshooting guide.
License
This project is licensed under the MIT License. See LICENSE for more information.
ansible-galaxy install cloudalchemy.alertmanager