ansible/roles/prometheus_federate/tasks/main.yml
pz2891 b31f9bd952
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Retention time is now a file that will be copied
2021-08-21 11:25:39 +02:00

55 lines
1.2 KiB
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: "{{ item }}.j2"
dest: "/etc/prometheus/{{ item }}"
owner: prometheus
group: prometheus
mode: u=r,g=r,o=
loop:
- prometheus.yml
- alert.rules.yml
notify: Restart Prometheus
- name: Define Prometheus retention time
copy:
src: files/prometheus
dest: /etc/default/prometheus
owner: prometheus
group: prometheus
mode: u=r,g=r,o=
notify: Restart Prometheus
# We don't need to restart Prometheus when updating nodes
- name: Configure Prometheus Federate devices
copy:
content: "{{ [{'targets': prometheus_targets }] | to_nice_json }}"
dest: /etc/prometheus/targets.json
mode: 0644
when: prometheus_targets is defined
- name: Activate prometheus service
systemd:
name: prometheus
enabled: true
state: started
- name: Configure MOTD
include_role:
name: update_motd
vars:
motd_messages:
- key: 05-prometheus-federate
message: >-
Prometheus (en configuration fédération) est déployé sur cette
machine (voir /etc/prometheus)
...