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
# #
prometheus_user: "prometheus" prometheus_puid: "65534"
prometheus_pgid: "65534"
prometheus_host: "prometheus" prometheus_host: "prometheus"
prometheus_data: "{{docker_data_dir}}/prometheus/" prometheus_data: "{{docker_data_dir}}/prometheus/"
prometheus_config: "{{docker_dir}}/prometheus/" prometheus_config: "{{docker_dir}}/prometheus/"

View File

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

View File

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

View File

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