ansible/roles/monitoring/tasks/prometheus.yaml
2025-04-19 16:42:53 +02:00

27 lines
749 B
YAML

---
- name: Install dependencies
ansible.builtin.apt:
name: prometheus
- name: Configure Prometheus
ansible.builtin.template:
src: prometheus.yml
dest: "{{ prometheus_config_dir }}/prometheus.yml"
owner: "root"
group: "root"
mode: "0644"
notify: restart prometheus
- name: Configure Prometheus args
ansible.builtin.lineinfile:
path: /etc/default/prometheus
line: >-
ARGS="
--storage.tsdb.retention.time={{ prometheus_storage_retention }}
--storage.tsdb.retention.size=0
--web.listen-address={{ prometheus_web_listen_address }}
--web.external-url=prometheus
--config.file={{ prometheus_config_dir }}/prometheus.yml
"
regexp: '^ARGS'
notify: restart prometheus