Merge "Add workaround for tunnel connectivity" into 1.15
[infra/stack/kubernetes.git] / apps / ceph / kubespray / playbooks / roles / install / tasks / main.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 - name: Load execution mode variables
21   include_vars: "{{ execution_mode }}.yaml"
22
23 - name: Delete existing rook cluster if any
24   k8s:
25     definition: "{{ lookup('template', config_file) }}"
26     state: absent
27   with_items:
28     - external-dashboard-https.yaml.j2
29     - pool.yaml.j2
30     - storageclass.yaml.j2
31     - toolbox.yaml.j2
32     - cluster.yaml.j2
33   loop_control:
34     loop_var: config_file
35   ignore_errors: true
36   tags: reset
37
38 - name: Delete existing rook cluster CRD if any
39   k8s:
40     api_version: apiextensions.k8s.io/v1beta1
41     state: absent
42     kind: CustomResourceDefinition
43     name: cephclusters.ceph.rook.io
44   ignore_errors: true
45   tags: reset
46
47 - name: Delete existing rook operator if any
48   k8s:
49     definition: "{{ lookup('template', config_file) }}"
50     state: absent
51   with_items:
52     - operator.yaml.j2
53     - common.yaml.j2
54   loop_control:
55     loop_var: config_file
56   ignore_errors: true
57   tags: reset
58
59 - name: Wait until rook namespace is deleted
60   k8s_facts:
61     kind: Namespace
62     name: "{{ rook_namespace }}"
63   register: result
64   until: not result.resources
65   retries: 10
66   delay: 5
67   tags: reset
68
69 - name: Create rook operator
70   k8s:
71     state: present
72     definition: "{{ lookup('template', config_file) }}"
73   with_items:
74     - common.yaml.j2
75     - operator.yaml.j2
76   loop_control:
77     loop_var: config_file
78
79 - name: Implement Workaround for connectivity problem - ping all tunnels
80   k8s:
81     state: present
82     definition: "{{ lookup('template', config_file) }}"
83   with_items:
84     - ping-tunnel-workaround.yaml.j2
85   loop_control:
86     loop_var: config_file
87
88 - name: Wait until OPERATOR pod is available
89   k8s_facts:
90     kind: Pod
91     namespace: "{{ rook_namespace }}"
92     label_selectors:
93       - app = rook-ceph-operator
94     field_selectors:
95       - status.phase=Running
96   register: rook_mgr_status
97   until:
98     - rook_mgr_status.resources is defined
99     - rook_mgr_status.resources
100   retries: 40
101   delay: 5
102
103 - name: Create rook cluster
104   k8s:
105     state: present
106     definition: "{{ lookup('template', config_file) }}"
107   with_items:
108     - cluster.yaml.j2
109     - toolbox.yaml.j2
110   loop_control:
111     loop_var: config_file
112
113 - name: Wait until rook cluster deployment is complete
114   k8s_facts:
115     kind: CephCluster
116     name: rook-ceph
117     namespace: "{{ rook_namespace }}"
118     field_selectors:
119       - status.state = "Created"
120   register: rook_cluster_status
121   until:
122     - rook_cluster_status.resources
123   retries: 20
124   delay: 5
125
126 - name: Wait until MGR pods are available
127   k8s_facts:
128     kind: Pod
129     namespace: "{{ rook_namespace }}"
130     label_selectors:
131       - app = rook-ceph-mgr
132     field_selectors:
133       - status.phase=Running
134   register: rook_mgr_status
135   until:
136     - rook_mgr_status.resources is defined
137     - rook_mgr_status.resources
138   retries: 40
139   delay: 10
140
141 - name: Wait until OSD pods are available
142   k8s_facts:
143     kind: Pod
144     namespace: "{{ rook_namespace }}"
145     label_selectors:
146       - app = rook-ceph-osd
147     field_selectors:
148       - status.phase=Running
149   register: rook_osd_status
150   until:
151     - rook_osd_status.resources is defined
152     - rook_osd_status.resources
153   retries: 60
154   delay: 10
155
156 - name: Create rook block storage
157   k8s:
158     state: present
159     definition: "{{ lookup('template', config_file) }}"
160   with_items:
161     - pool.yaml.j2
162     - storageclass.yaml.j2
163   loop_control:
164     loop_var: config_file
165
166 - name: Create rook file system
167   k8s:
168     state: present
169     definition: "{{ lookup('template', config_file) }}"
170   with_items:
171     - filesystem.yaml.j2
172     - filesystem-storageclass.yaml.j2
173   loop_control:
174     loop_var: config_file
175   when: rook_filesystem|bool
176
177 - name: Create rook external dashboard
178   k8s:
179     state: present
180     definition: "{{ lookup('template', 'external-dashboard-https.yaml.j2') }}"
181
182 # vim: set ts=2 sw=2 expandtab: