Created
January 9, 2020 10:16
-
-
Save f9n/8650d14ca5573799399d138ee7cd13be to your computer and use it in GitHub Desktop.
Alertmanager Cluster Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alertmanagers] | |
10.250.250.1 | |
10.250.250.2 | |
10.250.250.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: alertmanagers | |
become: true | |
pre_tasks: | |
- name: Get other alertmanager peers | |
set_fact: | |
alertmanager_peers: "{{ groups['alertmanagers'] | reject('search', ansible_host) | list }}" | |
- name: Create alertmanager option list | |
set_fact: | |
alertmanager_peer_option_list: "{{ alertmanager_peer_option_list|default([]) + ['--cluster.peer=' + item + ':9094'] }}" | |
loop: "{{ alertmanager_peers }}" | |
- name: Create alertmanager peer options | |
set_fact: | |
alertmanager_peer_options: "{{ alertmanager_peer_option_list | join(' ') }}" | |
roles: | |
- name: mesaguy.prometheus | |
vars: | |
prometheus_manage_client_tgroups: false | |
prometheus_alertmanager_extra_opts: | |
- "{{ alertmanager_peer_options }}" | |
- "--cluster.listen-address=:9094" | |
prometheus_components: | |
- alertmanager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- src: mesaguy.prometheus | |
version: v0.9.2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment