blob: 803b6c9d560a807ae46e312cdf64244c02576c4c [file] [log] [blame]
ibumarskovb5210062018-08-22 16:18:15 +04001{# Collection of common macroses shared across openstack services #}
2
Dennis Dmitriev4034db02018-08-26 21:50:13 +03003{%- macro MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=true) %}
4 {%- if USE_ORCHESTRATE %}
5- description: |
Oleksii Butenkoe0fc5f22018-09-25 14:29:42 +03006 Execute salt orchestration state to configure all needed
ibumarskov330bc122018-08-23 13:02:04 +04007 prerequisites like creating SSH public key ant etc.
Dennis Dmitriev4034db02018-08-26 21:50:13 +03008 Workaround for PROD-22488, use for PROD-22535.
ibumarskov330bc122018-08-23 13:02:04 +04009 cmd: salt-run state.orchestrate keystone.orchestrate.deploy
10 node_name: {{ HOSTNAME_CFG01 }}
11 retry: {count: 1, delay: 5}
12 skip_fail: false
Dennis Dmitriev4034db02018-08-26 21:50:13 +030013 {%- endif %}
ibumarskov330bc122018-08-23 13:02:04 +040014
ibumarskovb5210062018-08-22 16:18:15 +040015- description: Install keystone service on primary node
16 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
17 -C 'I@keystone:server and *01*' state.sls keystone.server
18 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 2, delay: 15}
20 skip_fail: false
21
22- description: Install keystone service on other nodes
23 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
24 -C 'I@keystone:server' state.sls keystone.server
25 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 2, delay: 15}
27 skip_fail: false
28
29- description: Restart apache due to PROD-10477
30 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*'
ibumarskov1b85e892018-08-30 11:54:47 +040031 cmd.run "service apache2 restart"
ibumarskovb5210062018-08-22 16:18:15 +040032 node_name: {{ HOSTNAME_CFG01 }}
33 retry: {count: 1, delay: 15}
34 skip_fail: false
35
36- description: Check apache status to PROD-10477
37 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*'
ibumarskov1b85e892018-08-30 11:54:47 +040038 cmd.run "service apache2 status"
ibumarskovb5210062018-08-22 16:18:15 +040039 node_name: {{ HOSTNAME_CFG01 }}
40 retry: {count: 1, delay: 15}
41 skip_fail: false
42
Dennis Dmitriev4034db02018-08-26 21:50:13 +030043- description: Mount glusterfs.client volumes (resuires created 'keystone' system user)
44 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
45 -C 'I@keystone:server' state.sls glusterfs.client -b 1
46 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 5}
48 skip_fail: false
49
50- description: Update fernet keys for keystone server on the mounted glusterfs volume
51 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
52 -C 'I@keystone:server' state.sls keystone.server -b 1
53 node_name: {{ HOSTNAME_CFG01 }}
54 retry: {count: 1, delay: 5}
55 skip_fail: false
56
ibumarskovb5210062018-08-22 16:18:15 +040057- description: Populate keystone services/tenants/admins
58 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
59 -C 'I@keystone:client' state.sls keystone.client
60 node_name: {{ HOSTNAME_CFG01 }}
61 retry: {count: 2, delay: 5}
62 skip_fail: false
63
64- description: Check keystone service-list
65 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +030066 -C "I@keystone:server" cmd.run ". /root/keystonercv3;
67 openstack service list"
ibumarskovb5210062018-08-22 16:18:15 +040068 node_name: {{ HOSTNAME_CFG01 }}
69 retry: {count: 1, delay: 5}
70 skip_fail: false
71{%- endmacro %}
72
73{%- macro MACRO_INSTALL_GLANCE() %}
74- description: Install glance service on primary node
75 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
76 -C 'I@glance:server and *01*' state.sls glance.server
77 node_name: {{ HOSTNAME_CFG01 }}
78 retry: {count: 1, delay: 5}
79 skip_fail: false
80
81- description: Install glance service on other nodes
82 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
83 -C 'I@glance:server' state.sls glance.server
84 node_name: {{ HOSTNAME_CFG01 }}
85 retry: {count: 1, delay: 5}
86 skip_fail: false
87
Dennis Dmitriev4034db02018-08-26 21:50:13 +030088- description: Mount glusterfs.client volumes (resuires created 'glusterfs' system user)
ibumarskovb5210062018-08-22 16:18:15 +040089 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Dennis Dmitriev4034db02018-08-26 21:50:13 +030090 -C 'I@glance:server' state.sls glusterfs.client -b 1
ibumarskovb5210062018-08-22 16:18:15 +040091 node_name: {{ HOSTNAME_CFG01 }}
92 retry: {count: 1, delay: 5}
93 skip_fail: false
94
Dennis Dmitriev4034db02018-08-26 21:50:13 +030095#- description: Setup glance.client
96# cmd: salt --hard-crash --state-output=mixed --state-verbose=False
97# -C 'I@glance:client' state.sls glance.client
98# node_name: {{ HOSTNAME_CFG01 }}
99# retry: {count: 1, delay: 5}
100# skip_fail: false
101
ibumarskovb5210062018-08-22 16:18:15 +0400102- description: Check glance image-list
103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +0300104 -C "I@keystone:server" cmd.run ". /root/keystonercv3;
105 openstack image list"
ibumarskovb5210062018-08-22 16:18:15 +0400106 node_name: {{ HOSTNAME_CFG01 }}
107 retry: {count: 1, delay: 5}
108 skip_fail: false
109{%- endmacro %}
110
111{%- macro MACRO_INSTALL_NOVA() %}
112- description: Install nova service on primary node
113 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
114 -C "I@nova:controller and *01*" state.sls nova.controller
115 node_name: {{ HOSTNAME_CFG01 }}
116 retry: {count: 1, delay: 5}
117 skip_fail: false
118
119- description: Install nova service on other nodes
120 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
121 -C "I@nova:controller" state.sls nova.controller
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 5}
124 skip_fail: false
125
126- description: Check nova service-list
127 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +0300128 -C "I@keystone:server" cmd.run ". /root/keystonercv3;
129 openstack compute service list"
ibumarskovb5210062018-08-22 16:18:15 +0400130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 5}
132 skip_fail: false
133
134- description: Check nova list
135 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +0300136 -C "I@keystone:server" cmd.run ". /root/keystonercv3;
137 openstack server list"
ibumarskovb5210062018-08-22 16:18:15 +0400138 node_name: {{ HOSTNAME_CFG01 }}
139 retry: {count: 1, delay: 5}
140 skip_fail: false
141{%- endmacro %}
142
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300143{%- macro MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) %}
ibumarskovb5210062018-08-22 16:18:15 +0400144- description: Install cinder on primary node
145 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
146 -C "I@cinder:controller and *01*" state.sls cinder
147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 1, delay: 5}
149 skip_fail: false
150
151- description: Install cinder on other nodes
152 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
153 -C "I@cinder:controller" state.sls cinder
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 5}
156 skip_fail: false
157
158- description: Check cinder list
159 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +0300160 -C "I@keystone:server" cmd.run ". /root/keystonercv3;
161 openstack volume list"
ibumarskovb5210062018-08-22 16:18:15 +0400162 node_name: {{ HOSTNAME_CFG01 }}
163 retry: {count: 1, delay: 5}
164 skip_fail: false
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300165
166 {%- if INSTALL_VOLUME %}
167- description: Install cinder volume
168 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
169 -C 'I@cinder:volume' state.sls cinder
170 node_name: {{ HOSTNAME_CFG01 }}
171 retry: {count: 1, delay: 5}
172 skip_fail: false
173 {%- endif %}
174
ibumarskovb5210062018-08-22 16:18:15 +0400175{%- endmacro %}
176
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300177{%- macro MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=true) %}
ibumarskovb5210062018-08-22 16:18:15 +0400178- description: Install neutron service on primary node
179 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
180 -C "I@neutron:server and *01*" state.sls neutron.server
181 node_name: {{ HOSTNAME_CFG01 }}
182 retry: {count: 1, delay: 5}
183 skip_fail: false
184
185- description: Install neutron service on other nodes
186 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
187 -C "I@neutron:server" state.sls neutron.server
188 node_name: {{ HOSTNAME_CFG01 }}
189 retry: {count: 1, delay: 5}
190 skip_fail: false
191
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300192 {%- if INSTALL_GATEWAY %}
ibumarskovb5210062018-08-22 16:18:15 +0400193- description: Install neutron on gtw node
194 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
195 -C 'I@neutron:gateway' state.sls neutron
196 node_name: {{ HOSTNAME_CFG01 }}
197 retry: {count: 1, delay: 5}
198 skip_fail: false
199
200- description: Check neutron agent-list
201 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko16f86912018-09-20 11:47:00 +0300202 -C 'I@keystone:server' cmd.run '. /root/keystonercv3; neutron agent-list'
ibumarskovb5210062018-08-22 16:18:15 +0400203 node_name: {{ HOSTNAME_CFG01 }}
204 retry: {count: 1, delay: 5}
205 skip_fail: false
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300206 {%- endif %}
207
ibumarskovb5210062018-08-22 16:18:15 +0400208{%- endmacro %}
209
210{%- macro MACRO_INSTALL_HEAT() %}
211- description: Install heat service on primary node
212 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
213 -C "I@heat:server and *01*" state.sls heat.server
214 node_name: {{ HOSTNAME_CFG01 }}
215 retry: {count: 1, delay: 5}
216 skip_fail: false
217
218- description: Install heat service on other nodes
219 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
220 -C "I@heat:server" state.sls heat.server
221 node_name: {{ HOSTNAME_CFG01 }}
222 retry: {count: 1, delay: 5}
223 skip_fail: false
224
225- description: Check heat service
226 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Oleksii Butenko8b49a762018-09-18 11:46:35 +0300227 -C 'I@keystone:server' cmd.run '. /root/keystonercv3;
228 openstack orchestration resource type list'
ibumarskovb5210062018-08-22 16:18:15 +0400229 node_name: {{ HOSTNAME_CFG01 }}
230 retry: {count: 5, delay: 10}
231 skip_fail: false
232{%- endmacro %}
233
234{%- macro MACRO_INSTALL_HORIZON() %}
235- description: Deploy horizon dashboard
236 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
237 -C 'I@horizon:server' state.sls horizon
238 node_name: {{ HOSTNAME_CFG01 }}
239 retry: {count: 1, delay: 5}
240 skip_fail: true
241
242- description: Deploy nginx proxy
243 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
244 -C 'I@nginx:server' state.sls nginx
245 node_name: {{ HOSTNAME_CFG01 }}
246 retry: {count: 1, delay: 5}
247 skip_fail: true
248{%- endmacro %}
249
Oleksii Butenko81d8a7f2018-09-26 16:09:27 +0300250{%- macro MACRO_INSTALL_DESIGNATE(INSTALL_POWERDNS=false, INSTALL_BIND=false) %}
Oleksii Butenkoe0fc5f22018-09-25 14:29:42 +0300251 {%- if INSTALL_POWERDNS %}
252- description: Install powerdns
253 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
254 -C 'I@powerdns:server' state.sls powerdns.server
255 node_name: {{ HOSTNAME_CFG01 }}
256 retry: {count: 1, delay: 5}
257 skip_fail: false
258 {%- endif %}
259
Oleksii Butenko81d8a7f2018-09-26 16:09:27 +0300260 {%- if INSTALL_BIND %}
261- description: Install bind
262 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
263 -C 'I@bind:server' state.sls bind
264 node_name: {{ HOSTNAME_CFG01 }}
265 retry: {count: 1, delay: 5}
266 skip_fail: false
267 {%- endif %}
268
ibumarskovb5210062018-08-22 16:18:15 +0400269- description: Install designate on primary node
270 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
271 -C "I@designate:server and *01*" state.sls designate.server
272 node_name: {{ HOSTNAME_CFG01 }}
273 retry: {count: 5, delay: 10}
274 skip_fail: false
275
276- description: Install designate on other nodes
277 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
278 -C "I@designate:server" state.sls designate
279 node_name: {{ HOSTNAME_CFG01 }}
280 retry: {count: 5, delay: 10}
281 skip_fail: false
282{%- endmacro %}
283
284{%- macro MACRO_INSTALL_CEILOMETER() %}
285# TO DO
286{%- endmacro %}
287
288{%- macro MACRO_INSTALL_BARBICAN() %}
289# TO DO
290{%- endmacro %}
291
292{%- macro MACRO_INSTALL_IRONIC() %}
293# TO DO
294{%- endmacro %}
295
296{%- macro MACRO_INSTALL_MANILA() %}
297# TO DO
298{%- endmacro %}
299
300{%- macro MACRO_INSTALL_OCTAVIA_API() %}
301# TO DO
302{%- endmacro %}
303
304{%- macro MACRO_INSTALL_DOGTAG() %}
305# TO DO
306{%- endmacro %}
307
308{%- macro MACRO_INSTALL_GNOCCHI() %}
309# TO DO
310{%- endmacro %}
311
312{%- macro MACRO_INSTALL_AODH() %}
313# TO DO
314{%- endmacro %}
Oleksii Butenko20947f22018-08-29 15:48:21 +0300315
Oleksii Butenkode0c5ee2018-09-24 15:29:45 +0300316{%- macro MACRO_INSTALL_COMPUTE(CELL_MAPPING=false) %}
Oleksii Butenko20947f22018-08-29 15:48:21 +0300317# Install compute node
318- description: Apply formulas for compute node
319 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
320 node_name: {{ HOSTNAME_CFG01 }}
321 retry: {count: 1, delay: 5}
322 skip_fail: true
323
324- description: Re-apply(as in doc) formulas for compute node
325 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
326 node_name: {{ HOSTNAME_CFG01 }}
327 retry: {count: 1, delay: 5}
328 skip_fail: false
329
330- description: Check IP on computes
331 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
332 'ip a'
333 node_name: {{ HOSTNAME_CFG01 }}
334 retry: {count: 10, delay: 30}
335 skip_fail: false
Oleksii Butenkode0c5ee2018-09-24 15:29:45 +0300336
337 {%- if CELL_MAPPING %}
338- description: Re-run nova for map cell mapping
339 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
340 -C "I@nova:controller and *01*" state.sls nova.controller
341 node_name: {{ HOSTNAME_CFG01 }}
342 retry: {count: 1, delay: 5}
343 skip_fail: false
344 {%- endif %}
345
Oleksii Butenko20947f22018-08-29 15:48:21 +0300346{%- endmacro %}
Oleksii Butenkoffc09222018-09-21 12:37:16 +0300347
348{%- macro OVERRIDE_POLICY() %}
349- description: Upload policy override
350 upload:
351 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
352 local_filename: overrides-policy.yml
353 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
354 node_name: {{ HOSTNAME_CFG01 }}
355
356- description: Create custom cluster control class
357 cmd: echo -e "classes:\n- cluster.{{ LAB_CONFIG_NAME }}.openstack.control_orig\n$(cat /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml)" > /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml
358 node_name: {{ HOSTNAME_CFG01 }}
359
360- description: Rename control classes
361 cmd: mv /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control_orig.yml &&
362 ln -s /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/overrides-policy.yml /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/control.yml &&
363 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
364 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
365 node_name: {{ HOSTNAME_CFG01 }}
366{%- endmacro %}