r/vmalert: Deploy vmalert

`vmalert` is a component of Victoria Metrics. It handles alerting and
recording rules, periodically executing queries and dispatching alerts
or writing aggregated data back to the TSDB.
This commit is contained in:
2022-08-10 19:45:08 -05:00
parent 0dab3afc85
commit b3403268a8
6 changed files with 93 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
- name: ensure victoria metrics config directory exists
file:
path: /etc/victoria-metrics
mode: u=rwx,go=rx
owner: root
group: root
state: directory
tags:
- config
- name: ensure vmalert rules directory exists
file:
path: /etc/victoria-metrics/rules
mode: u=rwx,go=rx
owner: root
group: root
state: directory
tags:
- config
- name: ensure vmalert alert rules are configured
copy:
dest: /etc/victoria-metrics/rules/alerts.yml
content: |+
{{ vmalert_rules | to_nice_yaml(indent=2) }}
mode: u=rw,go=r
owner: root
group: root
notify:
- reload vmalert
tags:
- config
- alerts-config
- name: ensure vmalert environment variables are set
template:
src: vmalert.sysconfig.j2
dest: /etc/sysconfig/vmalert
mode: u=rw,go=r
owner: root
group: root
notify:
- restart vmalert
tags:
- config
- name: ensure vmalert starts at boot
service:
name: vmalert
enabled: true
tags:
- service
- name: flush handlers
meta: flush_handlers
- name: ensure vmalert is running
service:
name: vmalert
state: started
tags:
- service

View File

@@ -0,0 +1,7 @@
- block:
# - import_tasks: install.yml
# tags:
# - install
- import_tasks: deploy.yml
tags:
- vmalert