27 lines
661 B
YAML
27 lines
661 B
YAML
|
---
|
||
|
- name: Install Prometheus
|
||
|
apt:
|
||
|
update_cache: true
|
||
|
name: prometheus
|
||
|
register: apt_result
|
||
|
retries: 3
|
||
|
until: apt_result is succeeded
|
||
|
|
||
|
- name: Configure Prometheus
|
||
|
template:
|
||
|
src: prometheus/prometheus.yml.j2
|
||
|
dest: /etc/prometheus/prometheus.yml
|
||
|
notify: Restart Prometheus
|
||
|
|
||
|
- name: Configure Prometheus alert rules
|
||
|
template:
|
||
|
src: prometheus/alert.rules.yml.j2
|
||
|
dest: /etc/prometheus/alert.rules.yml
|
||
|
notify: Restart Prometheus
|
||
|
|
||
|
# We don't need to restart Prometheus when updating nodes
|
||
|
- name: Configure Prometheus nodes
|
||
|
copy:
|
||
|
content: "{{ prometheus_targets | to_nice_json }}"
|
||
|
dest: /etc/prometheus/targets.json
|