-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathalertmanager.yml
82 lines (73 loc) · 2.63 KB
/
alertmanager.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
- hosts: homelab
vars:
application: alertmanager
alertmanager_slack_webhook_id: !vault |
$ANSIBLE_VAULT;1.1;AES256
30623531353631653433356263336434373037623036643730356464356263646439326663356232
6134306334316666613235663930376563366236643966310a303533306436633963356430363435
36373033346433346539623133663064343532396539386639376361333862613664343765376536
3135666539623037300a636531653832316165643365303039356565363063333630343033323134
39633536313162326238386130643032643332363564346632323861643132663161
alertmanager_slack_url: https://mattermost.{{ common_tld }}/hooks/{{ alertmanager_slack_webhook_id }}
docker_network: "{{ prometheus_network }}"
handlers:
- name: Restart
community.docker.docker_container:
name: "{{ application }}"
restart: true
comparisons:
'*': ignore
tasks:
- name: Create config folder
ansible.builtin.file:
path: "{{ config_directory }}"
state: directory
owner: "65534" # nobody user
group: "{{ common_group }}"
mode: "0771"
- name: Create directories
ansible.builtin.file:
path: "{{ config_directory }}/{{ item }}"
state: directory
owner: "65534" # nobody user
group: "{{ common_group }}"
mode: "0771"
loop:
- config
- data
- name: Template config
ansible.builtin.template:
src: "{{ files_directory }}/alertmanager.yml.j2"
dest: "{{ config_directory }}/config/alertmanager.yml"
owner: "65534" # nobody user
group: "{{ common_group }}"
mode: "0444"
validate: "docker run --rm --name {{ application }}_config_check -v %s:/tmp/config.yml --entrypoint /bin/amtool prom/alertmanager:latest check-config /tmp/config.yml"
notify: Restart
- name: Create container
ansible.builtin.include_role:
name: docker_container
vars:
image: prom/alertmanager:v0.27.0
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"
- "--storage.path=/alertmanager"
- "--web.external-url=https://{{ application }}.{{ common_tld }}"
- "--data.retention=72h"
volumes:
- "{{ config_directory }}/config:/etc/alertmanager"
- "{{ config_directory }}/data:/alertmanager"
traefik:
- port: 9093
auth: page
homepage:
group: Monitoring
weight: 500
description: "Alerting"
metrics:
- port: 9093
comparisons:
labels: allow_more_present
blackbox:
path: /-/ready