blob: e5a01cebaabcb3a47c7e1651a63f5513bd86a116 (
plain) (
tree)
|
|
# prometheus ~~ roles/prometheus/tasks/main.yml
# init prometheus database, mainly used by grafana
---
- name: install prometheus
package: name=prometheus state=present
- name: install node_exporter
package: name="{{ packages[ansible_distribution | lower].node_exporter }}" state=present
- name: generate prometheus configuration
template:
src: prometheus.conf.j2
dest: "{{ path_prometheusconfig }}"
owner: "{{ user_root }}"
group: "{{ group_root }}"
mode: 0644
- name: ensure prometheus service is started and enabled
service: name=prometheus state=restarted enabled=true
- name: start and enable node_exporter
service: name=node_exporter state=restarted enabled=true
when: ansible_distribution in "OpenBSD FreeBSD"
- name: start and enable node_exporter
service: name=node-exporter state=restarted enabled=true
when: ansible_distribution not in "OpenBSD FreeBSD"
|