ableton.amtool
Ansible Role: ableton.amtool
This role installs amtool
(from Alertmanager) on the Ansible control host. Keep in mind, this is the computer where you run your Ansible playbooks, not the server you are setting up with Ansible. The goal of this role is to make amtool
ready to use on the control host for creating and ending silences.
Requirements
You need Ansible version 2.10 or higher, and the control host must be running either a Debian-based Linux or macOS.
Role Variables
Check the defaults/main.yml
file for detailed information on the required and optional variables for this role.
After installing amtool
, the role will set a variable called amtool_exe
to the path of the installed program. You can use this variable to run amtool
in later tasks of your playbooks. Remember, these tasks must be pointed to localhost
.
Example Playbook
---
- name: Create alert silences for all hosts
hosts: "all"
gather_facts: false
vars:
alertmanager_url: "https://example.com/alertmanager"
comment: "Added by Ansible"
expiration_timeout: "4h"
roles:
- role: ableton.amtool
run_once: true
tasks:
- name: Create silences for example alerts
delegate_to: localhost
command: "{{ amtool_exe }} \
--alertmanager.url={{ alertmanager_url }} \
silence add \
--comment='{{ comment }}' \
--duration={{ expiration_timeout }} \
alertname={{ alert_item }}"
loop_control:
loop_var: alert_item
with_items:
- "example_alert_one"
- "example_alert_two"
License
MIT
Maintainers
This project is maintained by these GitHub users:
ansible-galaxy install ableton.amtool