homelab/roles/prometheus/tasks/main.yml

38 lines
874 B
YAML
Raw Normal View History

2020-04-01 01:47:26 +00:00
- name: Install Prometheus node exporter
apt:
name: prometheus-node-exporter
state: present
- name: Run Prometheus node exporter
service:
name: prometheus-node-exporter
state: started
- name: Create Prometheus directory
file:
path: /home/{{ docker_user }}/prometheus
state: directory
2020-03-21 06:38:35 +00:00
- name: Install Prometheus configuration
template:
src: prometheus-config.yml
2020-04-01 01:47:26 +00:00
dest: /home/{{ docker_user }}/prometheus/prometheus.yml
2020-03-21 06:38:35 +00:00
2020-03-21 00:32:44 +00:00
- name: Start Prometheus container
docker_container:
name: "{{ prom_name }}"
image: prom/prometheus:{{ prom_version }}
2020-03-21 05:35:51 +00:00
state: started
2020-03-21 00:32:44 +00:00
restart_policy: always
2020-03-21 06:38:35 +00:00
volumes:
2020-04-01 01:47:26 +00:00
- /home/{{ docker_user }}/prometheus:/etc/prometheus
2020-03-21 05:35:51 +00:00
ports:
- "80:9090"
2020-04-01 01:47:26 +00:00
- name: Start Grafana container
docker_container:
name: grafana
image: grafana/grafana:latest
ports:
- "3000:3000"