Explorar o código

Create initialize_db.yml

Signed-off-by: sakshiarora13 <sakshi_arora1@dell.com>
sakshiarora13 %!s(int64=3) %!d(string=hai) anos
pai
achega
98f84a8590
Modificáronse 1 ficheiros con 32 adicións e 0 borrados
  1. 32 0
      telemetry/roles/timescaledb/tasks/initialize_db.yml

+ 32 - 0
telemetry/roles/timescaledb/tasks/initialize_db.yml

@@ -0,0 +1,32 @@
+# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+
+
+- name: Wait for timescale pod to come to ready state
+  command: kubectl wait --for=condition=ready --timeout=10m -n "{{ namespace }}" pod -l app="{{ timescaledb_k8s_name }}"
+  changed_when: false
+
+- name: Get timescaledb pod name
+  command: kubectl get pod -n "{{ namespace }}" -l app="{{ timescaledb_k8s_name }}" -o jsonpath="{.items[0].metadata.name}"
+  register: timescaledb_pod_name
+  changed_when: false
+
+- name: Initialize database
+  command: kubectl exec -it "{{ timescaledb_pod_name.stdout }}" -n "{{ namespace }}" ./cmd/initialize_timescaledb.sh
+  changed_when: false
+  register: status
+  until: status is not failed
+  retries: "{{ retries }}"
+  delay: "{{ delay }}"