-
Notifications
You must be signed in to change notification settings - Fork 0
/
alertrules.yml
53 lines (47 loc) · 1.57 KB
/
alertrules.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
---
# Downloads Prometheus and Loki alert rules
- name: Create Prometheus and Loki alert rules bundle
hosts: localhost
connection: local
tasks:
- name: Ensure required variables have been defined
ansible.builtin.assert:
quiet: true
fail_msg: Required variable has not been defined
that:
- o11y_prometheus_alert_repos is defined
- o11y_loki_alert_repos is defined
- o11y_alertrules_dest is defined
- name: Install dependencies
ansible.builtin.pip:
name:
- pyyaml
- packages
- name: Fetch Prometheus alert rules
ansible.builtin.git:
repo: "{{ o11y_prometheus_alert_repos }}"
dest: maas-prometheus-alert-rules
version: HEAD # noqa git-latest
- name: Bundle Prometheus rules
community.general.make:
chdir: maas-prometheus-alert-rules
target: groups
- name: Fetch Loki alert rules
ansible.builtin.git:
repo: "{{ o11y_loki_alert_repos }}"
dest: maas-loki-alert-rules
version: HEAD # noqa git-latest
- name: Bundle Loki rules
community.general.make:
chdir: maas-loki-alert-rules
target: groups
- name: Move files
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
mode: "0644"
loop:
- src: maas-loki-alert-rules/rules/bundle.yml
dest: "{{ o11y_alertrules_dest }}/loki-alert-rules.yml"
- src: maas-prometheus-alert-rules/group.yml
dest: "{{ o11y_alertrules_dest }}/prometheus-alert-rules.yml"