Files
configpolicy/roles/vmalert/tasks/deploy.yml
Dustin C. Hatch b3403268a8 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.
2022-08-11 21:40:19 -05:00

60 lines
1.1 KiB
YAML

- 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