1
0
forked from infra/ansible
infra/roles/prometheus/tasks/main.yml

41 lines
1.2 KiB
YAML
Raw Normal View History

2018-10-06 22:19:37 +02:00
---
2019-07-09 12:38:32 +02:00
- name: Check OS release
fail: msg="This role is only supported on Debian buster"
when: not (ansible_distribution == 'Debian' and ansible_distribution_release == 'buster')
2018-10-06 22:19:37 +02:00
- name: Install prometheus
2019-07-09 12:38:32 +02:00
apt: name=prometheus
2018-10-06 22:19:37 +02:00
2020-05-25 16:15:29 +02:00
- name: Install dependencies
apt:
name:
- python3-setuptools
- virtualenv
- name: Install prometheus-pve-exporter
pip:
name: git+https://github.com/znerol/prometheus-pve-exporter
virtualenv: /opt/prometheus-pve-exporter
virtualenv_python: python3
- name: Systemd unit for prometheus-pve-exporter
copy: src=prometheus-pve-exporter.service dest=/etc/systemd/system/prometheus-pve-exporter.service
notify:
- Reload systemd
- Restart prometheus-pve-exporter
2018-10-06 22:19:37 +02:00
- name: Configure prometheus
template: src=prometheus.yml.j2 dest=/etc/prometheus/prometheus.yml
notify: Restart prometheus
2020-05-25 16:15:29 +02:00
- name: Configure prometheus-pve-exporter
template: src=pve.yml.j2 dest=/etc/prometheus/pve.yml
notify: Restart prometheus-pve-exporter
2018-10-06 22:19:37 +02:00
- name: Enable prometheus
service: name=prometheus state=started enabled=yes
2020-05-25 16:15:29 +02:00
- name: Enable prometheus-pve-exporter
service: name=prometheus-pve-exporter state=started enabled=yes