Fixed prometheus persistant storage (fix needed to store on disk)

Signed-off-by: TuDatTr <tuan-dat.tran@tudattr.dev>
pull/1/head
TuDatTr 2023-05-11 16:26:49 +02:00
parent ef01f7edeb
commit 8586a3a59d
4 changed files with 16 additions and 10 deletions

View File

@ -374,7 +374,8 @@ node_exporter_bin_path: /usr/local/bin/node_exporter
# Prometheus
#
prometheus_user: "prometheus"
prometheus_puid: "65534"
prometheus_pgid: "65534"
prometheus_host: "prometheus"
prometheus_data: "{{docker_data_dir}}/prometheus/"
prometheus_config: "{{docker_dir}}/prometheus/"

View File

@ -20,5 +20,5 @@
- name: Restart Docker
shell:
cmd: "docker compose restart"
cmd: "docker compose up -d --build"
chdir: "{{ docker_compose_dir }}"

View File

@ -2,18 +2,20 @@
- name: Create prometheus dirs
file:
path: "{{ item }}"
owner: "{{ puid }}"
group: "{{ pgid}}"
mode: '775'
owner: "{{ prometheus_puid }}"
group: "{{ prometheus_pgid }}"
mode: '755'
state: directory
loop:
- "{{ prometheus_config }}"
- "{{ prometheus_data }}"
become: true
- name: Place prometheus config
template:
owner: "{{ puid }}"
group: "{{ pgid}}"
mode: '644'
owner: "{{ prometheus_puid }}"
group: "{{ prometheus_pgid}}"
src: "templates/aya01/prometheus/prometheus.yml.j2"
dest: "{{ prometheus_config }}/prometheus.yml"
mode: '644'
become: true

View File

@ -439,11 +439,12 @@ services:
networks:
- net
environment:
- PUID={{ puid }}
- PGID={{ pgid}}
- PUID={{ prometheus_puid }}
- PGID={{ prometheus_pgid}}
- TZ={{ timezone }}
volumes:
- {{ prometheus_config }}:/etc/prometheus/
- prometheus_data:/prometheus/
ports:
- {{ prometheus_port }}:9090
labels:
@ -486,3 +487,5 @@ networks:
driver: default
config:
- subnet: {{ docker_network }}
volumes:
prometheus_data: {}