Added seed code for caas-kubedns.
[ta/caas-kubedns.git] / ansible / roles / kubedns / tasks / main.yml
1 ---
2 # Copyright 2019 Nokia
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 - name: template external dns configmap
17   template:
18     src: kubedns-external-dns-cm.yml
19     dest: /etc/kubernetes/kubeconfig/kubedns-external-dns-cm.yml
20   become_user: "root"
21
22 - name: template manifest
23   template:
24     src: kubedns-deployment.yml
25     dest: "{{ caas.manifests_directory }}/kubedns-deployment.yml"
26   become_user: "root"
27
28 - name: template manifest
29   template:
30     src: kubedns-service.yml
31     dest: "{{ caas.manifests_directory }}/kubedns-service.yml"
32   become_user: "root"
33
34 - name: Load the external dns configmap
35   kubectl:
36     manifest: "/etc/kubernetes/kubeconfig/kubedns-external-dns-cm.yml"
37     state: present
38   when: ( nodename | search("caas_master1") )
39
40 - name: Load the kubedns deployment
41   kubectl:
42     manifest: "{{ caas.manifests_directory }}/kubedns-deployment.yml"
43     state: present
44   when: ( nodename | search("caas_master1") )
45
46 - name: Load the kubedns service
47   kubectl:
48     manifest: "{{ caas.manifests_directory }}/kubedns-service.yml"
49     state: present
50   when: ( nodename | search("caas_master1") )
51
52 - name: wait for container to start
53   shell: "kubectl get po --all-namespaces | grep kube-dns"
54   register: result
55   until: result.stdout.find("2/2") != -1
56   retries: 120
57   delay: 1