2019-05-05 14:07:04 +02:00
|
|
|
---
|
2023-04-02 05:08:01 +02:00
|
|
|
- name: Install prometheus
|
2019-05-05 14:07:04 +02:00
|
|
|
apt:
|
2019-07-22 20:56:43 +02:00
|
|
|
name:
|
|
|
|
- prometheus
|
2019-05-05 14:07:04 +02:00
|
|
|
|
2023-04-02 05:08:01 +02:00
|
|
|
- name: Configure prometheus
|
2019-05-05 14:07:04 +02:00
|
|
|
template:
|
2023-04-02 05:08:01 +02:00
|
|
|
src: prometheus.yml.j2
|
|
|
|
dest: /etc/prometheus/prometheus.yml
|
2021-04-01 09:40:22 +02:00
|
|
|
owner: prometheus
|
|
|
|
group: prometheus
|
2023-04-02 05:08:01 +02:00
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
vars:
|
|
|
|
prometheus__config:
|
|
|
|
alerting:
|
|
|
|
alertmanagers:
|
|
|
|
- static_configs:
|
|
|
|
- targets: "{{ prometheus__alertmanager_targets }}"
|
|
|
|
rule_files:
|
|
|
|
- /etc/prometheus/rules.yml
|
|
|
|
scrape_configs: "{{ prometheus__scraping
|
|
|
|
| prometheus__convert_jobs }}"
|
|
|
|
notify:
|
|
|
|
- Restart prometheus
|
2021-04-11 15:58:35 +02:00
|
|
|
|
2023-04-02 05:08:01 +02:00
|
|
|
- name: Configure prometheus default
|
2021-04-11 15:58:35 +02:00
|
|
|
template:
|
2023-04-02 05:08:01 +02:00
|
|
|
src: default.j2
|
|
|
|
dest: /etc/default/prometheus
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
notify:
|
|
|
|
- Restart prometheus
|
2019-05-05 14:07:04 +02:00
|
|
|
|
2023-04-02 05:08:01 +02:00
|
|
|
- name: Configure prometheus rules
|
2019-11-01 14:16:32 +01:00
|
|
|
template:
|
2023-04-02 05:08:01 +02:00
|
|
|
src: rules.yml.j2
|
|
|
|
dest: /etc/prometheus/rules.yml
|
2019-11-01 14:16:32 +01:00
|
|
|
owner: prometheus
|
2021-04-01 09:40:22 +02:00
|
|
|
group: prometheus
|
2023-04-02 05:08:01 +02:00
|
|
|
mode: u=rw,g=r,o=r
|
|
|
|
validate: "promtool check rules %s"
|
|
|
|
vars:
|
|
|
|
prometheus__rules:
|
|
|
|
groups: "{{ prometheus__alert_rules
|
|
|
|
| dict2items(key_name='name', value_name='rules') }}"
|
|
|
|
notify:
|
|
|
|
- Reload prometheus
|
2019-11-01 14:16:32 +01:00
|
|
|
|
2023-04-02 05:08:01 +02:00
|
|
|
- name: Enable prometheus
|
2019-07-22 20:56:43 +02:00
|
|
|
systemd:
|
|
|
|
name: prometheus
|
2019-07-22 21:04:58 +02:00
|
|
|
enabled: true
|
2019-07-22 20:56:43 +02:00
|
|
|
state: started
|
2021-04-12 10:58:59 +02:00
|
|
|
...
|