forked from calvinbui/ansible-monorepo
/
alertmanager.yml
85 lines (76 loc) · 2.75 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
83
84
85
---
- hosts: homelab
vars:
application: alertmanager
alertmanager_slack_url: !vault |
$ANSIBLE_VAULT;1.1;AES256
62623438663632393039633939656363373632363665626634346264626633313034336665363365
3439353764646664626231306536643962346630643661340a656436343935333232313533633033
63366464333665636138333165336236396563333739323133346638303932643861646130623635
3863313464323931640a623132333565306563333662343330323164313938396633663161626336
39616632633739633830396236373637313531366631326531393664333031636539663032663866
33333838616437616465613563646533396433373133646537383837316234333861313731383635
61383438643866393130393035633732373037656564313966323930386666326233346139323939
32383233643934386565
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.26.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:
name: Alertmanager
group: Monitoring
weight: 500
description: "Alerting"
metrics:
- port: 9093
comparisons:
labels: allow_more_present
blackbox:
path: /-/ready