diff --git a/roles/prometheus/prometheus-config.yml b/roles/prometheus/prometheus-config.yml new file mode 100644 index 0000000..64a609b --- /dev/null +++ b/roles/prometheus/prometheus-config.yml @@ -0,0 +1,10 @@ +global: + scrape_interval: 15s + +scrape_configs: + - job_name: 'prometheus' + + scrape_interval: 5s + + static_configs: + - targets: ['localhost:9090'] diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index b434ab8..1123105 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -1,8 +1,15 @@ +- name: Install Prometheus configuration + template: + src: prometheus-config.yml + dest: /home/{{ docker_user }}/prometheus.yml + - name: Start Prometheus container docker_container: name: "{{ prom_name }}" image: prom/prometheus:{{ prom_version }} state: started restart_policy: always + volumes: + - /home/{{ docker_user }}/prometheus.yml:/etc/prometheus/prometheus.yml ports: - "80:9090"