blob: 45ededb639ed2083c35d4ce8de32468d6fb19d19 [file] [log] [blame]
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02001{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %}
5{% from 'virtual-mcp-pike-dvr/underlay.yaml' import HOSTNAME_GTW01 with context %}
Tatyana Leontovich56005da2017-12-11 13:16:51 +02006{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
7{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +02008{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME') %}
9{% set OVERRIDE_POLICY = os_env('OVERRIDE_POLICY', '') %}
Tatyana Leontovich56005da2017-12-11 13:16:51 +020010
11# Install OpenStack control services
12
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020013{%- if OVERRIDE_POLICY != '' %}
14- description: Upload policy override
15 upload:
16 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
17 local_filename: overrides-policy.yml
18 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/openstack/
19 node_name: {{ HOSTNAME_CFG01 }}
20
21- description: Create custom cluster control class
22 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
23 node_name: {{ HOSTNAME_CFG01 }}
24
25- description: Rename control classes
26 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 &&
27 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 &&
28 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.sync_all &&
29 salt --hard-crash --state-output=mixed --state-verbose=False '*' saltutil.refresh_pillar
30 node_name: {{ HOSTNAME_CFG01 }}
31{%- endif %}
32
Tatyana Leontovich56005da2017-12-11 13:16:51 +020033- description: Install glance on all controllers
34 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
35 -C 'I@glance:server' state.sls glance -b 1
36 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 5}
38 skip_fail: false
39
40- description: Install keystone service (note that different fernet keys are created on different nodes)
41 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
42 -C 'I@keystone:server' state.sls keystone.server -b 1
43 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 2, delay: 15}
45 skip_fail: false
46
47- description: Restart apache due to PROD-10477
48 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run "systemctl restart apache2"
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 15}
51 skip_fail: false
52
53- description: Check apache status to PROD-10477
54 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run "systemctl status apache2"
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 15}
57 skip_fail: false
58
59- description: Mount glusterfs.client volumes (resuires created 'keystone' and 'glusterfs' system users)
60 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
61 -C 'I@glance:server' state.sls glusterfs.client
62 node_name: {{ HOSTNAME_CFG01 }}
63 retry: {count: 1, delay: 5}
64 skip_fail: false
65
66- description: Update fernet keys for keystone server on the mounted glusterfs volume
67 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
68 -C 'I@keystone:server' state.sls keystone.server -b 1
69 node_name: {{ HOSTNAME_CFG01 }}
70 retry: {count: 1, delay: 5}
71 skip_fail: false
72
73- description: Populate keystone services/tenants/admins
74 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
75 -C 'I@keystone:client' state.sls keystone.client
76 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitrievf073e6f2018-02-06 23:45:15 +020077 retry: {count: 2, delay: 5}
Tatyana Leontovich56005da2017-12-11 13:16:51 +020078 skip_fail: false
79
80- description: Check keystone service-list
81 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
82 -C 'I@keystone:server' cmd.run '. /root/keystonercv3; openstack service list'
83 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 1, delay: 5}
85 skip_fail: false
86
87- description: Check glance image-list
88 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +020089 -C 'I@keystone:server' cmd.run '. /root/keystonerc; glance image-list'
Tatyana Leontovich56005da2017-12-11 13:16:51 +020090 node_name: {{ HOSTNAME_CFG01 }}
91 retry: {count: 1, delay: 5}
92 skip_fail: false
93
94
95- description: Install nova on all controllers
96 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
97 -C 'I@nova:controller' state.sls nova -b 1
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 2, delay: 5}
100 skip_fail: false
101
102- description: Check nova service-list
103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200104 -C 'I@keystone:server' cmd.run '. /root/keystonerc; nova --debug service-list'
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 3, delay: 5}
107 skip_fail: false
108
109
110- description: Install cinder
111 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
112 -C 'I@cinder:controller' state.sls cinder -b 1
113 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200114 retry: {count: 1, delay: 5}
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200115 skip_fail: false
116
117- description: Check cinder list
118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200119 -C 'I@keystone:server' cmd.run '. /root/keystonerc; cinder list'
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 5}
122 skip_fail: false
123
124
125- description: Install neutron service
126 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
127 -C 'I@neutron:server' state.sls neutron -b 1
128 node_name: {{ HOSTNAME_CFG01 }}
129 retry: {count: 1, delay: 5}
130 skip_fail: false
131
132- description: Install neutron on gtw node
133 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
134 -C 'I@neutron:gateway' state.sls neutron
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 5}
137 skip_fail: false
138
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200139# isntall designate
140- description: Install powerdns
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200142 -C 'I@powerdns:server' state.sls powerdns.server
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 5}
145 skip_fail: false
146
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200147- description: Install designate
148 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
149 -C 'I@designate:server' state.sls designate -b 1
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 5, delay: 10}
152 skip_fail: false
153
154- description: Check neutron agent-list
155 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
156 -C 'I@keystone:server' cmd.run '. /root/keystonerc; neutron agent-list'
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 5}
159 skip_fail: false
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200160
161- description: Install heat service
162 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
163 -C 'I@heat:server' state.sls heat -b 1
164 node_name: {{ HOSTNAME_CFG01 }}
165 retry: {count: 1, delay: 5}
166 skip_fail: false
167
168- description: Check heat service
169 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
170 -C 'I@keystone:server' cmd.run '. /root/keystonercv3; openstack orchestration resource type list'
171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 5, delay: 10}
173 skip_fail: false
174
175
176- description: Deploy horizon dashboard
177 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
178 -C 'I@horizon:server' state.sls horizon
179 node_name: {{ HOSTNAME_CFG01 }}
180 retry: {count: 1, delay: 5}
181 skip_fail: true
182
183- description: Deploy nginx proxy
184 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
185 -C 'I@nginx:server' state.sls nginx
186 node_name: {{ HOSTNAME_CFG01 }}
187 retry: {count: 1, delay: 5}
188 skip_fail: true
189
190
191# Install compute node
192
193- description: Apply formulas for compute node
194 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
195 node_name: {{ HOSTNAME_CFG01 }}
196 retry: {count: 1, delay: 5}
197 skip_fail: true
198
199- description: Re-apply(as in doc) formulas for compute node
200 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
201 node_name: {{ HOSTNAME_CFG01 }}
202 retry: {count: 1, delay: 5}
Oleksii Butenko9f2601c2018-02-08 15:13:21 +0200203 skip_fail: false
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200204
205- description: Check IP on computes
206 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
207 'ip a'
208 node_name: {{ HOSTNAME_CFG01 }}
209 retry: {count: 10, delay: 30}
210 skip_fail: false
211
212
213 # Upload cirros image
214
215- description: Upload cirros image on ctl01
216 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
217 'wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img'
218 node_name: {{ HOSTNAME_CFG01 }}
219 retry: {count: 2, delay: 30}
220 skip_fail: false
221
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200222- description: Register image in glance
223 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
224 '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-0.3.4-i386-disk.img'
225 node_name: {{ HOSTNAME_CFG01 }}
226 retry: {count: 1, delay: 30}
227 skip_fail: false
228
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200229- description: Create net04_external
230 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
231 '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat'
232 node_name: {{ HOSTNAME_CFG01 }}
233 retry: {count: 1, delay: 30}
234 skip_fail: false
235
236- description: Create subnet_external
237 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
238 '. /root/keystonercv3; neutron subnet-create net04_ext {{ IPV4_NET_EXTERNAL_PREFIX }}.0/24 --name net04_ext__subnet --disable-dhcp --allocation-pool start={{ IPV4_NET_EXTERNAL_PREFIX }}.150,end={{ IPV4_NET_EXTERNAL_PREFIX }}.180 --gateway {{ IPV4_NET_EXTERNAL_PREFIX }}.1'
239 node_name: {{ HOSTNAME_CFG01 }}
240 retry: {count: 1, delay: 30}
241 skip_fail: false
242
243- description: Create net04
244 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
245 '. /root/keystonercv3; neutron net-create net04'
246 node_name: {{ HOSTNAME_CFG01 }}
247 retry: {count: 1, delay: 30}
248 skip_fail: false
249
250- description: Create subnet_net04
251 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
252 '. /root/keystonercv3; neutron subnet-create net04 {{ IPV4_NET_TENANT_PREFIX }}.0/24 --name net04__subnet --allocation-pool start={{ IPV4_NET_TENANT_PREFIX }}.120,end={{ IPV4_NET_TENANT_PREFIX }}.240'
253 node_name: {{ HOSTNAME_CFG01 }}
254 retry: {count: 1, delay: 30}
255 skip_fail: false
256
257- description: Create router
258 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
259 '. /root/keystonercv3; neutron router-create net04_router01'
260 node_name: {{ HOSTNAME_CFG01 }}
261 retry: {count: 1, delay: 30}
262 skip_fail: false
263
264- description: Set geteway
265 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
266 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
267 node_name: {{ HOSTNAME_CFG01 }}
268 retry: {count: 1, delay: 30}
269 skip_fail: false
270
271- description: Add interface
272 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
273 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
274 node_name: {{ HOSTNAME_CFG01 }}
275 retry: {count: 1, delay: 30}
276 skip_fail: false
277
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200278#- description: Allow all tcp
279# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
280# '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
281# node_name: {{ HOSTNAME_CFG01 }}
282# retry: {count: 1, delay: 30}
283# skip_fail: false
284#
285#- description: Allow all icmp
286# cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
287# '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
288# node_name: {{ HOSTNAME_CFG01 }}
289# retry: {count: 1, delay: 30}
290# skip_fail: false
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200291
292- description: sync time
293 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
294 'service ntp stop; ntpd -gq; service ntp start'
295 node_name: {{ HOSTNAME_CFG01 }}
296 retry: {count: 1, delay: 30}
297 skip_fail: false
298
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200299# Configure cinder-volume salt-call PROD-13167
300- description: Set disks 01
301 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
302 node_name: {{ HOSTNAME_CTL01 }}
303 retry: {count: 1, delay: 30}
304 skip_fail: false
305
306- description: Set disks 02
307 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
308 node_name: {{ HOSTNAME_CTL02 }}
309 retry: {count: 1, delay: 30}
310 skip_fail: false
311
312- description: Set disks 03
313 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
314 node_name: {{ HOSTNAME_CTL03 }}
315 retry: {count: 1, delay: 30}
316 skip_fail: false
317
318- description: Create partitions 01
319 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
320 node_name: {{ HOSTNAME_CTL01 }}
321 retry: {count: 1, delay: 30}
322 skip_fail: false
323
324- description: Create partitions 02
325 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
326 node_name: {{ HOSTNAME_CTL02 }}
327 retry: {count: 1, delay: 30}
328 skip_fail: false
329
330- description: Create partitions 03
331 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
332 node_name: {{ HOSTNAME_CTL03 }}
333 retry: {count: 1, delay: 30}
334 skip_fail: false
335
336- description: create volume_group
337 cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1'
338 node_name: {{ HOSTNAME_CFG01 }}
339 retry: {count: 1, delay: 30}
340 skip_fail: false
341
342- description: Install cinder-volume
343 cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y'
344 node_name: {{ HOSTNAME_CFG01 }}
345 retry: {count: 1, delay: 30}
346 skip_fail: false
347
348- description: Install crudini
349 cmd: salt "ctl*" cmd.run 'apt-get install crudini -y'
350 node_name: {{ HOSTNAME_CFG01 }}
351 retry: {count: 1, delay: 30}
352 skip_fail: false
353
354- description: Temporary WR set enabled backends value 01
355 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
356 node_name: {{ HOSTNAME_CTL01 }}
357 retry: {count: 1, delay: 30}
358 skip_fail: false
359
360- description: Temporary WR set enabled backends value 02
361 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
362 node_name: {{ HOSTNAME_CTL02 }}
363 retry: {count: 1, delay: 30}
364 skip_fail: false
365
366- description: Temporary WR set enabled backends value 03
367 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
368 node_name: {{ HOSTNAME_CTL03 }}
369 retry: {count: 1, delay: 30}
370 skip_fail: false
371
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200372- description: Install docker.io on gtw
373 cmd: salt-call cmd.run 'apt-get install docker.io -y'
374 node_name: {{ HOSTNAME_GTW01 }}
375 retry: {count: 1, delay: 30}
376 skip_fail: false
377
Tatyana Leontovichb0b68d92018-01-11 13:27:08 +0200378- description: Restart cinder volume
379 cmd: |
380 salt -C 'I@cinder:controller' service.restart cinder-volume;
381 node_name: {{ HOSTNAME_CFG01 }}
382 retry: {count: 2, delay: 5}
383 skip_fail: false
384
Tatyana Leontovich56005da2017-12-11 13:16:51 +0200385- description: create rc file on cfg
386 cmd: scp ctl01:/root/keystonercv3 /root
387 node_name: {{ HOSTNAME_CFG01 }}
388 retry: {count: 1, delay: 30}
389 skip_fail: false
390
391- description: Copy rc file
392 cmd: scp /root/keystonercv3 gtw01:/root
393 node_name: {{ HOSTNAME_CFG01 }}
394 retry: {count: 1, delay: 30}
395 skip_fail: false