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
|
prom_domain: prom.vm.krislamo.org
|
||||||
grafana_version: latest
|
grafana_version: latest
|
||||||
grafana_domain: grafana.vm.krislamo.org
|
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
|
prom_name: prometheus
|
||||||
grafana_name: grafana
|
grafana_name: grafana
|
||||||
prom_root: "/opt/{{ prom_name }}/config"
|
prom_root: "/opt/{{ prom_name }}"
|
||||||
|
@ -8,15 +8,21 @@
|
|||||||
name: prometheus-node-exporter
|
name: prometheus-node-exporter
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
- name: Create Prometheus directories
|
- name: Create Prometheus data directory
|
||||||
file:
|
file:
|
||||||
path: "{{ prom_root }}"
|
path: "{{ prom_root }}/prometheus"
|
||||||
|
state: directory
|
||||||
|
owner: nobody
|
||||||
|
|
||||||
|
- name: Create Prometheus config directory
|
||||||
|
file:
|
||||||
|
path: "{{ prom_root }}/config"
|
||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: Install Prometheus configuration
|
- name: Install Prometheus configuration
|
||||||
template:
|
template:
|
||||||
src: prometheus.yml.j2
|
src: prometheus.yml.j2
|
||||||
dest: "{{ prom_root }}/prometheus.yml"
|
dest: "{{ prom_root }}/config/prometheus.yml"
|
||||||
|
|
||||||
- name: Create Prometheus network
|
- name: Create Prometheus network
|
||||||
docker_network:
|
docker_network:
|
||||||
@ -28,7 +34,9 @@
|
|||||||
image: prom/prometheus:{{ prom_version }}
|
image: prom/prometheus:{{ prom_version }}
|
||||||
state: started
|
state: started
|
||||||
restart_policy: always
|
restart_policy: always
|
||||||
volumes: "{{ prom_root }}:/etc/prometheus"
|
volumes:
|
||||||
|
- "{{ prom_root }}/config:/etc/prometheus"
|
||||||
|
- "{{ prom_root }}/prometheus:/prometheus"
|
||||||
networks_cli_compatible: true
|
networks_cli_compatible: true
|
||||||
networks:
|
networks:
|
||||||
- name: "{{ prom_name }}"
|
- name: "{{ prom_name }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user