From 94749f1b06eec9a144cebf88e3f4adc42e3d9a40 Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 21 Mar 2020 02:38:35 -0400 Subject: [PATCH] Getting started Prometheus tutorial --- roles/prometheus/prometheus-config.yml | 10 ++++++++++ roles/prometheus/tasks/main.yml | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 roles/prometheus/prometheus-config.yml 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"