ceph: disable dashboard
[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/v1
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     - crds.yaml.j2
55   loop_control:
56     loop_var: config_file
57   ignore_errors: true
58   tags: reset
59
60 - name: Wait until rook namespace is deleted
61   k8s_facts:
62     kind: Namespace
63     name: "{{ rook_namespace }}"
64   register: result
65   until: not result.resources
66   retries: 10
67   delay: 5
68   tags: reset
69
70 - name: label storage nodes  # noqa 305
71   shell: "kubectl label node {{ item }} {{ rook_storage_label }}=true"
72   changed_when: true
73   with_items: "{{ rook_storage_nodes }}"
74
75 - name: taint storage nodes  # noqa 305
76   shell: "kubectl taint node {{ item }} {{ rook_storage_label }}=true:NoSchedule"
77   changed_when: true
78   with_items: "{{ rook_storage_nodes }}"
79
80 - name: label nodes for other workloads  # noqa 305
81   shell: "kubectl label node {{ item }} {{ rook_storage_label }}=false"
82   changed_when: true
83   with_items: "{{ rook_nostorage_nodes }}"
84
85 - name: Create rook operator
86   k8s:
87     state: present
88     definition: "{{ lookup('template', config_file) }}"
89   with_items:
90     - crds.yaml.j2
91     - common.yaml.j2
92     - operator.yaml.j2
93   loop_control:
94     loop_var: config_file
95
96 - name: Implement Workaround for connectivity problem - ping all tunnels
97   k8s:
98     state: present
99     definition: "{{ lookup('template', config_file) }}"
100   with_items:
101     - ping-tunnel-workaround.yaml.j2
102   loop_control:
103     loop_var: config_file
104
105 - name: Wait until OPERATOR pod is available
106   k8s_facts:
107     kind: Pod
108     namespace: "{{ rook_namespace }}"
109     label_selectors:
110       - app = rook-ceph-operator
111     field_selectors:
112       - status.phase=Running
113   register: rook_mgr_status
114   until:
115     - rook_mgr_status.resources is defined
116     - rook_mgr_status.resources
117   retries: 40
118   delay: 5
119
120 - name: Create rook cluster
121   k8s:
122     state: present
123     definition: "{{ lookup('template', config_file) }}"
124   with_items:
125     - cluster.yaml.j2
126     - toolbox.yaml.j2
127   loop_control:
128     loop_var: config_file
129
130 - name: Wait until rook cluster deployment is complete
131   k8s_facts:
132     kind: CephCluster
133     name: rook-ceph
134     namespace: "{{ rook_namespace }}"
135     field_selectors:
136       - status.state = "Created"
137   register: rook_cluster_status
138   until:
139     - rook_cluster_status.resources
140   retries: 20
141   delay: 5
142
143 - name: Wait until MGR pods are available
144   k8s_facts:
145     kind: Pod
146     namespace: "{{ rook_namespace }}"
147     label_selectors:
148       - app = rook-ceph-mgr
149     field_selectors:
150       - status.phase=Running
151   register: rook_mgr_status
152   until:
153     - rook_mgr_status.resources is defined
154     - rook_mgr_status.resources
155   retries: 40
156   delay: 10
157
158 - name: Wait until OSD pods are available
159   k8s_facts:
160     kind: Pod
161     namespace: "{{ rook_namespace }}"
162     label_selectors:
163       - app = rook-ceph-osd
164     field_selectors:
165       - status.phase=Running
166   register: rook_osd_status
167   until:
168     - rook_osd_status.resources is defined
169     - rook_osd_status.resources
170   retries: 60
171   delay: 10
172
173 - name: Create rook block storage
174   k8s:
175     state: present
176     definition: "{{ lookup('template', config_file) }}"
177   with_items:
178     - pool.yaml.j2
179     - storageclass.yaml.j2
180   loop_control:
181     loop_var: config_file
182
183 - name: Create rook file system
184   k8s:
185     state: present
186     definition: "{{ lookup('template', config_file) }}"
187   with_items:
188     - filesystem.yaml.j2
189     - filesystem-storageclass.yaml.j2
190   loop_control:
191     loop_var: config_file
192   when: rook_filesystem|bool
193
194 - name: Create rook external dashboard
195   k8s:
196     state: present
197     definition: "{{ lookup('template', 'external-dashboard-https.yaml.j2') }}"
198   when: rook_ceph_dashboard_enabled|bool
199
200 # vim: set ts=2 sw=2 expandtab: