File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
ansible/roles/kube_prometheus_stack/tasks Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
3
+ - name : Checking for existing Prometheus data directory
4
+ ansible.builtin.stat :
5
+ path : " {{ prometheus_db_dir }}"
6
+ register : prom_exists_result
7
+
8
+ - name : Check if data is in kube-prometheus-stack
9
+ ansible.builtin.stat :
10
+ path : " {{ prometheus_db_dir }}/prometheus-db"
11
+ register : prom_already_migrated
12
+ when : prom_exists_result.stat.exists
13
+
14
+ - name : Migrate existing Prometheus data from cloudalchemy roles to kube-prometheus-stack
15
+ when : prom_exists_result.stat.exists and not prom_already_migrated.stat.exists
16
+ block :
17
+ - name : Get existing files to copy
18
+ ansible.builtin.find :
19
+ paths : " {{ prometheus_db_dir }}"
20
+ file_type : any
21
+ register : prometheus_files
22
+
23
+ - name : Create KPS subdirectory
24
+ ansible.builtin.file :
25
+ path : " {{ prometheus_db_dir }}/prometheus-db"
26
+ state : directory
27
+
28
+ - name : Move data to KPS subdirectory
29
+ ansible.builtin.shell :
30
+ cmd : " mv {{ item.path }} {{ prometheus_db_dir }}/prometheus-db/{{ item.path | regex_search('([^/]+$)') }}"
31
+ loop : " {{ prometheus_files.files }}"
32
+
3
33
- name : Creating namespace
4
34
kubernetes.core.k8s :
5
35
name : " {{ kube_prometheus_stack_release_namespace }}"
You can’t perform that action at this time.
0 commit comments