diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index cb18c1c..35fc36a 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -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/" diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 7070268..42aa5f8 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -20,5 +20,5 @@ - name: Restart Docker shell: - cmd: "docker compose restart" + cmd: "docker compose up -d --build" chdir: "{{ docker_compose_dir }}" diff --git a/roles/docker/tasks/prometheus.yml b/roles/docker/tasks/prometheus.yml index eb72587..0545ab3 100644 --- a/roles/docker/tasks/prometheus.yml +++ b/roles/docker/tasks/prometheus.yml @@ -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 diff --git a/roles/docker/templates/aya01/compose.yaml b/roles/docker/templates/aya01/compose.yaml index 33eb8c7..1643685 100644 --- a/roles/docker/templates/aya01/compose.yaml +++ b/roles/docker/templates/aya01/compose.yaml @@ -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: {}