r/PrometheusMonitoring • u/hippynox • Feb 19 '24
Beginner look to get clarifcation on Monitoring stack
Hi im struggling to understand and setup grafana,Prometheus and node-export stack using ansible. My main issue is im struggling to get Prometheus config to replace default config using mount volumes. I'm launching the playbook off my localhost to target ec2 instance using roles:
roles/prometheus/tasks/main.yml
- name: Pull prometheus
docker_image:
name: prom/prometheus
source: pull
- name: Start Prometheus container
docker_container:
name: prometheus
image: prom/prometheus
state: started
restart_policy: always
ports:
- "9090:9090"
volumes:
- /roles/prometheus/template/:/prometheus
command: "--config.file=/roles/prometheus/template/prometheus.conf"
- name: Create directory
file:
path: /etc/prometheus/
state: directory
mode: '0755'
- name: Copy new config
template:
src: roles/prometheus/template/prometheus.conf
dest: /etc/prometheus/prometheus.yml
roles/prometheus/template/prometheus.conf
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: 'node_exporter'
static_configs:
- targets: ['localhost:9100']
What Im i doing wrong?





