This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
forked from canonical/maas-ansible-playbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alertrules.yaml
53 lines (46 loc) · 1.58 KB
/
alertrules.yaml
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"
- 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"
ansible.builtin.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"
ansible.builtin.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"