Added seed code for caas-kubedns.
[ta/caas-kubedns.git] / ansible / roles / kubedns / tasks / main.yml
diff --git a/ansible/roles/kubedns/tasks/main.yml b/ansible/roles/kubedns/tasks/main.yml
new file mode 100644 (file)
index 0000000..e258efe
--- /dev/null
@@ -0,0 +1,57 @@
+---
+# 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: template external dns configmap
+  template:
+    src: kubedns-external-dns-cm.yml
+    dest: /etc/kubernetes/kubeconfig/kubedns-external-dns-cm.yml
+  become_user: "root"
+
+- name: template manifest
+  template:
+    src: kubedns-deployment.yml
+    dest: "{{ caas.manifests_directory }}/kubedns-deployment.yml"
+  become_user: "root"
+
+- name: template manifest
+  template:
+    src: kubedns-service.yml
+    dest: "{{ caas.manifests_directory }}/kubedns-service.yml"
+  become_user: "root"
+
+- name: Load the external dns configmap
+  kubectl:
+    manifest: "/etc/kubernetes/kubeconfig/kubedns-external-dns-cm.yml"
+    state: present
+  when: ( nodename | search("caas_master1") )
+
+- name: Load the kubedns deployment
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/kubedns-deployment.yml"
+    state: present
+  when: ( nodename | search("caas_master1") )
+
+- name: Load the kubedns service
+  kubectl:
+    manifest: "{{ caas.manifests_directory }}/kubedns-service.yml"
+    state: present
+  when: ( nodename | search("caas_master1") )
+
+- name: wait for container to start
+  shell: "kubectl get po --all-namespaces | grep kube-dns"
+  register: result
+  until: result.stdout.find("2/2") != -1
+  retries: 120
+  delay: 1