03c577563c59f85f86003fb2562e6e3ab454aa24
[ta/caas-danm.git] / ansible / roles / flannel / tasks / main.yaml
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: collect flannel interfaces
17   set_fact:
18     flannel_interfaces: "{{ hostvars.values() | json_query(interface_query) | unique | list }}"
19
20 - name: template Flannel DaemonSet file
21   template:
22     src: flannel-ds.yaml
23     dest: "{{ caas.manifests_directory }}/flannel-ds.yaml"
24
25 - name: template Flannel ConfigMap file
26   template:
27     src: flannel-cm.yaml
28     dest: "{{ caas.manifests_directory }}/flannel-cm.yaml"
29
30 - name: create Flannel ConfigMap
31   kubectl:
32     manifest: "{{ caas.manifests_directory }}/flannel-cm.yaml"
33     state: present
34
35 - name: create Flannel DS
36   kubectl:
37     manifest: "{{ caas.manifests_directory }}/flannel-ds.yaml"
38     state: present
39
40 - name: template default ClusterNetwork for kube-system namespace
41   template:
42     src: flannel_cnet.yaml.j2
43     dest: "{{ caas.manifests_directory }}/flannel-cnet.yaml"
44
45 - name: create ClusterNetwork within kube-system namespace
46   kubectl:
47     manifest: "{{ caas.manifests_directory }}/flannel-cnet.yaml"
48     state: present