Added seed code for caas-danm.
[ta/caas-danm.git] / ansible / roles / danm_setup / tasks / main.yaml
diff --git a/ansible/roles/danm_setup/tasks/main.yaml b/ansible/roles/danm_setup/tasks/main.yaml
new file mode 100644 (file)
index 0000000..65b289c
--- /dev/null
@@ -0,0 +1,46 @@
+---
+# Copyright 2019 Nokia
+# 
+# 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: copy DANM CRD templates to infra template directory
+  template:
+    src: "{{ item }}"
+    dest: "{{ caas.manifests_directory }}/{{ item }}"
+  with_items:
+    - danmep_crd_schema.yaml
+    - danmnet_crd_schema.yaml
+
+- name: create DanmEp CRD API in K8s
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/danmep_crd_schema.yaml"
+    state: present
+
+- name: wait and check DanmEp API availability
+  shell: "kubectl get crd --all-namespaces | grep danmeps | wc -l"
+  register: ep_result
+  until: ep_result.stdout == "1"
+  retries: 60
+  delay: 6
+
+- name: create DanmNet CRD API in K8s
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/danmnet_crd_schema.yaml"
+    state: present
+
+- name: wait and check DanmNet API availability
+  shell: "kubectl get crd --all-namespaces | grep danmnets | wc -l"
+  register: net_result
+  until: net_result.stdout == "1"
+  retries: 60
+  delay: 6