aboutsummaryrefslogtreecommitdiff
path: root/roles/monitoring/tasks/prometheus.yaml
diff options
context:
space:
mode:
authorKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
committerKumar Damani <me@kumardamani.net>2022-09-07 20:40:17 +0000
commitbbe10895d9df8dd7899bbd65575d5bf12e57f8c8 (patch)
tree244d2f1ad38320863fb60f695c88c97799be1171 /roles/monitoring/tasks/prometheus.yaml
parent4d34de2f5e757bfeae5738547aabb61d3d28a2f8 (diff)
parentc85806e3289b5e207d51d382f8dc75edad04404d (diff)
Merge branch 'alpine' into 'master'
switched to alpine initial commit See merge request kdam0/vps!2
Diffstat (limited to 'roles/monitoring/tasks/prometheus.yaml')
-rw-r--r--roles/monitoring/tasks/prometheus.yaml23
1 files changed, 23 insertions, 0 deletions
diff --git a/roles/monitoring/tasks/prometheus.yaml b/roles/monitoring/tasks/prometheus.yaml
new file mode 100644
index 0000000..0fbfd89
--- /dev/null
+++ b/roles/monitoring/tasks/prometheus.yaml
@@ -0,0 +1,23 @@
+---
+
+# Install Prometheus as TSDB for monitoring metrics
+- name: 'Copy the prometheus.yml config file to conf dir'
+ template:
+ src: 'prometheus.yml.j2'
+ dest: '{{ monitoring_root_dir }}/prometheus.yml'
+ mode: '0644'
+
+- name: 'Make sure prometheus container is created and running'
+ docker_container:
+ name: 'prometheus'
+ image: 'prom/prometheus:v2.37.0'
+ pull: true
+ state: 'started'
+ recreate: true
+ command: '--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus'
+ user: 'root'
+ volumes:
+ - "{{ monitoring_root_dir }}/prometheus.yml:/etc/prometheus/prometheus.yml"
+ - "{{ monitoring_root_dir }}/prom_data:/data/prometheus"
+ network_mode: 'host'
+ restart_policy: unless-stopped