Install basic Prometheus tools

This commit is contained in:
Kris Lamoureux 2020-03-31 21:47:26 -04:00
parent 94749f1b06
commit 2fc3910c3e
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
3 changed files with 25 additions and 3 deletions

View File

View File

@ -7,4 +7,4 @@ scrape_configs:
scrape_interval: 5s scrape_interval: 5s
static_configs: static_configs:
- targets: ['localhost:9090'] - targets: {{ prom_targets }}

View File

@ -1,7 +1,22 @@
- 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
- name: Install Prometheus configuration - name: Install Prometheus configuration
template: template:
src: prometheus-config.yml src: prometheus-config.yml
dest: /home/{{ docker_user }}/prometheus.yml dest: /home/{{ docker_user }}/prometheus/prometheus.yml
- name: Start Prometheus container - name: Start Prometheus container
docker_container: docker_container:
@ -10,6 +25,13 @@
state: started state: started
restart_policy: always restart_policy: always
volumes: volumes:
- /home/{{ docker_user }}/prometheus.yml:/etc/prometheus/prometheus.yml - /home/{{ docker_user }}/prometheus:/etc/prometheus
ports: ports:
- "80:9090" - "80:9090"
- name: Start Grafana container
docker_container:
name: grafana
image: grafana/grafana:latest
ports:
- "3000:3000"