blob: 6b806d12199363f5f588765bd9b145820ce91135 [file] [log] [blame]
ibumarskovd1e28972018-03-27 10:39:08 +04001{% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_CTL02 with context %}
4{% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_CTL03 with context %}
5{% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_GTW01 with context %}
ibumarskov12b79ae2018-03-15 01:11:41 -07006{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
7{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
8{% set LAB_CONFIG_NAME = os_env('LAB_CONFIG_NAME') %}
9{% set OVERRIDE_POLICY = os_env('OVERRIDE_POLICY', '') %}
10
11# Install OpenStack control services
12
13{%- 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
ibumarskove23c10e2018-08-20 15:47:58 +040033- description: Install glance on primary controller
ibumarskov12b79ae2018-03-15 01:11:41 -070034 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
ibumarskove23c10e2018-08-20 15:47:58 +040035 -C 'I@glance:server:role:primary' state.sls glance -b 1
36 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 5}
38 skip_fail: false
39
40- description: Install glance on other controllers
41 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
42 -C 'I@glance:server:role:secondary' state.sls glance -b 1
ibumarskov12b79ae2018-03-15 01:11:41 -070043 node_name: {{ HOSTNAME_CFG01 }}
44 retry: {count: 1, delay: 5}
45 skip_fail: false
46
47- description: Install keystone service (note that different fernet keys are created on different nodes)
48 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
49 -C 'I@keystone:server' state.sls keystone.server -b 1
50 node_name: {{ HOSTNAME_CFG01 }}
51 retry: {count: 2, delay: 15}
52 skip_fail: false
53
54- description: Restart apache due to PROD-10477
55 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run "systemctl restart apache2"
56 node_name: {{ HOSTNAME_CFG01 }}
57 retry: {count: 1, delay: 15}
58 skip_fail: false
59
60- description: Check apache status to PROD-10477
61 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl*' cmd.run "systemctl status apache2"
62 node_name: {{ HOSTNAME_CFG01 }}
63 retry: {count: 1, delay: 15}
64 skip_fail: false
65
66- description: Mount glusterfs.client volumes (resuires created 'keystone' and 'glusterfs' system users)
67 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
68 -C 'I@glance:server' state.sls glusterfs.client
69 node_name: {{ HOSTNAME_CFG01 }}
70 retry: {count: 1, delay: 5}
71 skip_fail: false
72
73- description: Update fernet keys for keystone server on the mounted glusterfs volume
74 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
75 -C 'I@keystone:server' state.sls keystone.server -b 1
76 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 5}
78 skip_fail: false
79
80- description: Populate keystone services/tenants/admins
81 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
82 -C 'I@keystone:client' state.sls keystone.client
83 node_name: {{ HOSTNAME_CFG01 }}
84 retry: {count: 2, delay: 5}
85 skip_fail: false
86
87- description: Check keystone service-list
88 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
89 -C 'I@keystone:server' cmd.run '. /root/keystonercv3; openstack service list'
90 node_name: {{ HOSTNAME_CFG01 }}
91 retry: {count: 1, delay: 5}
92 skip_fail: false
93
94- description: Check glance image-list
95 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
96 -C 'I@keystone:server' cmd.run '. /root/keystonerc; glance image-list'
97 node_name: {{ HOSTNAME_CFG01 }}
98 retry: {count: 1, delay: 5}
99 skip_fail: false
100
101
102- description: Install nova on all controllers
103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
104 -C 'I@nova:controller' state.sls nova -b 1
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 2, delay: 5}
107 skip_fail: false
108
109- description: Check nova service-list
110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
111 -C 'I@keystone:server' cmd.run '. /root/keystonerc; nova --debug service-list'
112 node_name: {{ HOSTNAME_CFG01 }}
113 retry: {count: 3, delay: 5}
114 skip_fail: false
115
116
117- description: Install cinder
118 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
119 -C 'I@cinder:controller' state.sls cinder -b 1
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 5}
122 skip_fail: false
123
124- description: Check cinder list
125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
126 -C 'I@keystone:server' cmd.run '. /root/keystonerc; cinder list'
127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 5}
129 skip_fail: false
130
131
132- description: Install neutron service
133 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
134 -C 'I@neutron:server' state.sls neutron -b 1
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 5}
137 skip_fail: false
138
139- description: Install neutron on gtw node
140 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
141 -C 'I@neutron:gateway' state.sls neutron
142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 5}
144 skip_fail: false
145
ibumarskovc075df82018-07-30 13:23:07 +0400146# install designate
ibumarskov12b79ae2018-03-15 01:11:41 -0700147- description: Install powerdns
148 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
149 -C 'I@powerdns:server' state.sls powerdns.server
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 5}
152 skip_fail: false
153
154- description: Install designate
155 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
156 -C 'I@designate:server' state.sls designate -b 1
157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 5, delay: 10}
159 skip_fail: false
160
161- description: Check neutron agent-list
162 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
163 -C 'I@keystone:server' cmd.run '. /root/keystonerc; neutron agent-list'
164 node_name: {{ HOSTNAME_CFG01 }}
165 retry: {count: 1, delay: 5}
166 skip_fail: false
167
168- description: Install heat service
169 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
170 -C 'I@heat:server' state.sls heat -b 1
171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 5}
173 skip_fail: false
174
ibumarskov12b79ae2018-03-15 01:11:41 -0700175- description: Deploy horizon dashboard
176 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
177 -C 'I@horizon:server' state.sls horizon
178 node_name: {{ HOSTNAME_CFG01 }}
179 retry: {count: 1, delay: 5}
180 skip_fail: true
181
182- description: Deploy nginx proxy
183 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
184 -C 'I@nginx:server' state.sls nginx
185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 1, delay: 5}
187 skip_fail: true
188
ibumarskove952bcc2018-04-02 14:01:43 +0400189- description: Check heat service
190 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
191 -C 'I@keystone:server' cmd.run '. /root/keystonercv3; openstack orchestration resource type list'
192 node_name: {{ HOSTNAME_CFG01 }}
193 retry: {count: 5, delay: 10}
194 skip_fail: false
ibumarskov12b79ae2018-03-15 01:11:41 -0700195
196# Install compute node
197
198- description: Apply formulas for compute node
199 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
200 node_name: {{ HOSTNAME_CFG01 }}
201 retry: {count: 1, delay: 5}
202 skip_fail: true
203
204- description: Re-apply(as in doc) formulas for compute node
205 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
206 node_name: {{ HOSTNAME_CFG01 }}
207 retry: {count: 1, delay: 5}
208 skip_fail: false
209
210- description: Check IP on computes
211 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
212 'ip a'
213 node_name: {{ HOSTNAME_CFG01 }}
214 retry: {count: 10, delay: 30}
215 skip_fail: false
216
217
218 # Upload cirros image
219
220- description: Upload cirros image on ctl01
221 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +0400222 'wget http://images.mirantis.com.s3.amazonaws.com/cirros-x64-20170828.qcow2'
ibumarskov12b79ae2018-03-15 01:11:41 -0700223 node_name: {{ HOSTNAME_CFG01 }}
224 retry: {count: 2, delay: 30}
225 skip_fail: false
226
227- description: Register image in glance
228 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
ibumarskov2cea0d42018-07-24 08:40:50 +0400229 '. /root/keystonercv3; glance --timeout 120 image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-x64-20170828.qcow2'
ibumarskov12b79ae2018-03-15 01:11:41 -0700230 node_name: {{ HOSTNAME_CFG01 }}
231 retry: {count: 1, delay: 30}
232 skip_fail: false
233
234- description: Create net04_external
235 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
236 '. /root/keystonercv3; neutron net-create net04_ext --router:external True --provider:physical_network physnet1 --provider:network_type flat'
237 node_name: {{ HOSTNAME_CFG01 }}
238 retry: {count: 1, delay: 30}
239 skip_fail: false
240
241- description: Create subnet_external
242 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
243 '. /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'
244 node_name: {{ HOSTNAME_CFG01 }}
245 retry: {count: 1, delay: 30}
246 skip_fail: false
247
248- description: Create net04
249 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
250 '. /root/keystonercv3; neutron net-create net04'
251 node_name: {{ HOSTNAME_CFG01 }}
252 retry: {count: 1, delay: 30}
253 skip_fail: false
254
255- description: Create subnet_net04
256 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
257 '. /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'
258 node_name: {{ HOSTNAME_CFG01 }}
259 retry: {count: 1, delay: 30}
260 skip_fail: false
261
262- description: Create router
263 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
264 '. /root/keystonercv3; neutron router-create net04_router01'
265 node_name: {{ HOSTNAME_CFG01 }}
266 retry: {count: 1, delay: 30}
267 skip_fail: false
268
ibumarskovc075df82018-07-30 13:23:07 +0400269- description: Set gateway
ibumarskov12b79ae2018-03-15 01:11:41 -0700270 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
271 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
272 node_name: {{ HOSTNAME_CFG01 }}
273 retry: {count: 1, delay: 30}
274 skip_fail: false
275
276- description: Add interface
277 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
278 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
279 node_name: {{ HOSTNAME_CFG01 }}
280 retry: {count: 1, delay: 30}
281 skip_fail: false
282
283- description: Allow all tcp
284 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
285 '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
286 node_name: {{ HOSTNAME_CFG01 }}
287 retry: {count: 1, delay: 30}
288 skip_fail: false
289
290- description: Allow all icmp
291 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
292 '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
293 node_name: {{ HOSTNAME_CFG01 }}
294 retry: {count: 1, delay: 30}
295 skip_fail: false
296
297- description: sync time
298 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
299 'service ntp stop; ntpd -gq; service ntp start'
300 node_name: {{ HOSTNAME_CFG01 }}
301 retry: {count: 1, delay: 30}
302 skip_fail: false
303
304# Configure cinder-volume salt-call PROD-13167
305- description: Set disks 01
306 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
307 node_name: {{ HOSTNAME_CTL01 }}
308 retry: {count: 1, delay: 30}
309 skip_fail: false
310
311- description: Set disks 02
312 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
313 node_name: {{ HOSTNAME_CTL02 }}
314 retry: {count: 1, delay: 30}
315 skip_fail: false
316
317- description: Set disks 03
318 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
319 node_name: {{ HOSTNAME_CTL03 }}
320 retry: {count: 1, delay: 30}
321 skip_fail: false
322
323- description: Create partitions 01
324 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
325 node_name: {{ HOSTNAME_CTL01 }}
326 retry: {count: 1, delay: 30}
327 skip_fail: false
328
329- description: Create partitions 02
330 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
331 node_name: {{ HOSTNAME_CTL02 }}
332 retry: {count: 1, delay: 30}
333 skip_fail: false
334
335- description: Create partitions 03
336 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
337 node_name: {{ HOSTNAME_CTL03 }}
338 retry: {count: 1, delay: 30}
339 skip_fail: false
340
341- description: create volume_group
342 cmd: salt "ctl*" cmd.run 'vgcreate cinder-volumes /dev/vdb1'
343 node_name: {{ HOSTNAME_CFG01 }}
344 retry: {count: 1, delay: 30}
345 skip_fail: false
346
347- description: Install cinder-volume
348 cmd: salt 'ctl*' cmd.run 'apt-get install cinder-volume -y'
349 node_name: {{ HOSTNAME_CFG01 }}
350 retry: {count: 1, delay: 30}
351 skip_fail: false
352
353- description: Install crudini
354 cmd: salt "ctl*" cmd.run 'apt-get install crudini -y'
355 node_name: {{ HOSTNAME_CFG01 }}
356 retry: {count: 1, delay: 30}
357 skip_fail: false
358
359- description: Temporary WR set enabled backends value 01
360 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
361 node_name: {{ HOSTNAME_CTL01 }}
362 retry: {count: 1, delay: 30}
363 skip_fail: false
364
365- description: Temporary WR set enabled backends value 02
366 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
367 node_name: {{ HOSTNAME_CTL02 }}
368 retry: {count: 1, delay: 30}
369 skip_fail: false
370
371- description: Temporary WR set enabled backends value 03
372 cmd: salt-call cmd.run 'crudini --verbose --set /etc/cinder/cinder.conf DEFAULT enabled_backends lvm'
373 node_name: {{ HOSTNAME_CTL03 }}
374 retry: {count: 1, delay: 30}
375 skip_fail: false
376
377- description: Install docker.io on gtw
378 cmd: salt-call cmd.run 'apt-get install docker.io -y'
379 node_name: {{ HOSTNAME_GTW01 }}
380 retry: {count: 1, delay: 30}
381 skip_fail: false
382
383- description: Restart cinder volume
384 cmd: |
385 salt -C 'I@cinder:controller' service.restart cinder-volume;
386 node_name: {{ HOSTNAME_CFG01 }}
387 retry: {count: 2, delay: 5}
388 skip_fail: false
389
390- description: create rc file on cfg
391 cmd: scp ctl01:/root/keystonercv3 /root
392 node_name: {{ HOSTNAME_CFG01 }}
393 retry: {count: 1, delay: 30}
394 skip_fail: false
395
396- description: Copy rc file
397 cmd: scp /root/keystonercv3 gtw01:/root
398 node_name: {{ HOSTNAME_CFG01 }}
399 retry: {count: 1, delay: 30}
400 skip_fail: false
ibumarskov42de6bc2018-04-17 02:40:35 -0700401
402- description: Set floating ip address on br-floating
403 cmd: ifconfig br-floating {{ IPV4_NET_EXTERNAL_PREFIX }}.110/24
404 node_name: {{ HOSTNAME_GTW01 }}
405 retry: {count: 1, delay: 30}
ibumarskovc075df82018-07-30 13:23:07 +0400406 skip_fail: false