blob: 9edffda587ff622212935d9b51cd48edee7ace2b [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 Butenkoe0fc5f22018-09-25 14:29:42 +0300250{%- macro MACRO_INSTALL_DESIGNATE(INSTALL_POWERDNS=false) %}
251 {%- 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
ibumarskovb5210062018-08-22 16:18:15 +0400260- description: Install designate on primary node
261 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
262 -C "I@designate:server and *01*" state.sls designate.server
263 node_name: {{ HOSTNAME_CFG01 }}
264 retry: {count: 5, delay: 10}
265 skip_fail: false
266
267- description: Install designate on other nodes
268 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
269 -C "I@designate:server" state.sls designate
270 node_name: {{ HOSTNAME_CFG01 }}
271 retry: {count: 5, delay: 10}
272 skip_fail: false
273{%- endmacro %}
274
275{%- macro MACRO_INSTALL_CEILOMETER() %}
276# TO DO
277{%- endmacro %}
278
279{%- macro MACRO_INSTALL_BARBICAN() %}
280# TO DO
281{%- endmacro %}
282
283{%- macro MACRO_INSTALL_IRONIC() %}
284# TO DO
285{%- endmacro %}
286
287{%- macro MACRO_INSTALL_MANILA() %}
288# TO DO
289{%- endmacro %}
290
291{%- macro MACRO_INSTALL_OCTAVIA_API() %}
292# TO DO
293{%- endmacro %}
294
295{%- macro MACRO_INSTALL_DOGTAG() %}
296# TO DO
297{%- endmacro %}
298
299{%- macro MACRO_INSTALL_GNOCCHI() %}
300# TO DO
301{%- endmacro %}
302
303{%- macro MACRO_INSTALL_AODH() %}
304# TO DO
305{%- endmacro %}
Oleksii Butenko20947f22018-08-29 15:48:21 +0300306
Oleksii Butenkode0c5ee2018-09-24 15:29:45 +0300307{%- macro MACRO_INSTALL_COMPUTE(CELL_MAPPING=false) %}
Oleksii Butenko20947f22018-08-29 15:48:21 +0300308# Install compute node
309- description: Apply formulas for compute node
310 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
311 node_name: {{ HOSTNAME_CFG01 }}
312 retry: {count: 1, delay: 5}
313 skip_fail: true
314
315- description: Re-apply(as in doc) formulas for compute node
316 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
317 node_name: {{ HOSTNAME_CFG01 }}
318 retry: {count: 1, delay: 5}
319 skip_fail: false
320
321- description: Check IP on computes
322 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
323 'ip a'
324 node_name: {{ HOSTNAME_CFG01 }}
325 retry: {count: 10, delay: 30}
326 skip_fail: false
Oleksii Butenkode0c5ee2018-09-24 15:29:45 +0300327
328 {%- if CELL_MAPPING %}
329- description: Re-run nova for map cell mapping
330 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
331 -C "I@nova:controller and *01*" state.sls nova.controller
332 node_name: {{ HOSTNAME_CFG01 }}
333 retry: {count: 1, delay: 5}
334 skip_fail: false
335 {%- endif %}
336
Oleksii Butenko20947f22018-08-29 15:48:21 +0300337{%- endmacro %}
Oleksii Butenkoffc09222018-09-21 12:37:16 +0300338
339{%- macro OVERRIDE_POLICY() %}
340- description: Upload policy override
341 upload:
342 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
343 local_filename: overrides-policy.yml
344 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
345 node_name: {{ HOSTNAME_CFG01 }}
346
347- description: Create custom cluster control class
348 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
349 node_name: {{ HOSTNAME_CFG01 }}
350
351- description: Rename control classes
352 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 &&
353 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 &&
354 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
355 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
356 node_name: {{ HOSTNAME_CFG01 }}
357{%- endmacro %}