Persist Prometheus data in bind mount
This commit is contained in:
parent
fa4aae4dfd
commit
46f2b6c0f6
@ -35,4 +35,4 @@ prom_version: latest
|
||||
prom_domain: prom.vm.krislamo.org
|
||||
grafana_version: latest
|
||||
grafana_domain: grafana.vm.krislamo.org
|
||||
prom_targets: "['127.0.0.1', '127.0.0.1:9100']"
|
||||
prom_targets: "['10.0.2.15:9100']"
|
||||
|
@ -1,3 +1,3 @@
|
||||
prom_name: prometheus
|
||||
grafana_name: grafana
|
||||
prom_root: "/opt/{{ prom_name }}/config"
|
||||
prom_root: "/opt/{{ prom_name }}"
|
||||
|
@ -8,15 +8,21 @@
|
||||
name: prometheus-node-exporter
|
||||
state: started
|
||||
|
||||
- name: Create Prometheus directories
|
||||
- name: Create Prometheus data directory
|
||||
file:
|
||||
path: "{{ prom_root }}"
|
||||
path: "{{ prom_root }}/prometheus"
|
||||
state: directory
|
||||
owner: nobody
|
||||
|
||||
- name: Create Prometheus config directory
|
||||
file:
|
||||
path: "{{ prom_root }}/config"
|
||||
state: directory
|
||||
|
||||
- name: Install Prometheus configuration
|
||||
template:
|
||||
src: prometheus.yml.j2
|
||||
dest: "{{ prom_root }}/prometheus.yml"
|
||||
dest: "{{ prom_root }}/config/prometheus.yml"
|
||||
|
||||
- name: Create Prometheus network
|
||||
docker_network:
|
||||
@ -28,7 +34,9 @@
|
||||
image: prom/prometheus:{{ prom_version }}
|
||||
state: started
|
||||
restart_policy: always
|
||||
volumes: "{{ prom_root }}:/etc/prometheus"
|
||||
volumes:
|
||||
- "{{ prom_root }}/config:/etc/prometheus"
|
||||
- "{{ prom_root }}/prometheus:/prometheus"
|
||||
networks_cli_compatible: true
|
||||
networks:
|
||||
- name: "{{ prom_name }}"
|
||||
|
Loading…
Reference in New Issue
Block a user