blob: daf66d7d7ec1dd8e04aeba130099c6cdb0f0afac [file] [log] [blame]
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +03001{% from 'virtual-mcp-ocata-dvr/salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
2{% from 'virtual-mcp-ocata-dvr/salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
Tatyana Leontovich78b83482017-04-11 18:57:11 +03003
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +03004################### Install OpenStack control ##########################
Tatyana Leontovich78b83482017-04-11 18:57:11 +03005
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +03006# // Install horizon dashboard
7# salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
8# salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
Dennis Dmitriev45396db2017-04-26 15:29:47 +03009
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030010- description: Install Horizon
11 do: enforceState
12 target: I@horizon:server
13 state: horizon
Tatyana Leontovich78b83482017-04-11 18:57:11 +030014
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030015- description: Update certs on nginx servers
16 do: enforceState
17 target: I@nginx:server
18 state: salt.minion.cert
Tatyana Leontovich966af4d2017-04-24 14:08:12 +030019
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030020- description: Install nginx
21 do: enforceState
22 target: I@nginx:server
23 state: nginx
Tatyana Leontovich966af4d2017-04-24 14:08:12 +030024
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030025# // setup keystone service
26# //runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
27# salt.enforceState(saltMaster, 'I@keystone:server and *01*', 'keystone.server', true)
28# salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
29# // populate keystone services/tenants/roles/users
Dennis Dmitriev45396db2017-04-26 15:29:47 +030030
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030031- description: Install Keystone on 01
32 do: enforceState
33 target: I@keystone:server and *01*
34 state: keystone.server
35 retry: {count: 3, delay: 5}
Dennis Dmitriev45396db2017-04-26 15:29:47 +030036
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030037- description: Install Keystone
38 do: enforceState
39 target: I@keystone:server
40 state: keystone.server
41 retry: {count: 3, delay: 5}
Tatyana Leontovich78b83482017-04-11 18:57:11 +030042
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030043# // keystone:client must be called locally
44# //salt.runSaltProcessStep(saltMaster, 'I@keystone:client', 'cmd.run', ['salt-call state.sls keystone.client'], null, true)
45# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'service.restart', ['apache2'])
46# salt.enforceState(saltMaster, 'I@keystone:client', 'keystone.client', true)
47# salt.enforceState(saltMaster, 'I@keystone:client', 'keystone.client', true)
48# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; keystone service-list'], null, true)
Tatyana Leontovich78b83482017-04-11 18:57:11 +030049
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030050# - description: Install Keystone client
51# do: runState
52# target: I@keystone:client
53# state: cmd.run
54# args: ['salt-call state.sls keystone.client']
55
56- description: Restart apache on Keystone servers
57 do: runState
58 target: I@keystone:server
59 state: service.restart
60 args: ['apache2']
61
62- description: Install Keystone Client
63 do: enforceState
64 target: I@keystone:client
65 state: keystone.client
66
67- description: Install Keystone Client
68 do: enforceState
69 target: I@keystone:client
70 state: keystone.client
71
72- description: Show Keystone config
73 do: runState
74 target: I@keystone:server
75 state: cmd.run
76 args: ['. /root/keystonerc; keystone service-list']
Tatyana Leontovich78b83482017-04-11 18:57:11 +030077
78
Dmitry Tyzhnenko2b730a02017-04-07 19:31:32 +030079# // Install glance and ensure glusterfs clusters
80# //runSaltProcessStep(saltMaster, 'I@glance:server', 'state.sls', ['glance.server'], 1)
81# salt.enforceState(saltMaster, 'I@glance:server and *01*', 'glance.server', true)
82# salt.enforceState(saltMaster, 'I@glance:server', 'glance.server', true)
83# salt.enforceState(saltMaster, 'I@glance:server', 'glusterfs.client', true)
84
85
86- description: Install glance on 01
87 do: enforceState
88 target: I@glance:server and *01*
89 state: glance.server
90
91- description: Install glance
92 do: enforceState
93 target: I@glance:server
94 state: glance.server
95
96- description: Install gluster client on glance servers
97 do: enforceState
98 target: I@glance:server
99 state: glusterfs.client
100
101# // Update fernet tokens before doing request on keystone server
102# salt.enforceState(saltMaster, 'I@keystone:server', 'keystone.server', true)
103
104- description: Update fernet tokens
105 do: enforceState
106 target: I@keystone:server
107 state: keystone.server
108
109# // Check glance service
110# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; glance image-list'], null, true)
111
112- description: Show glance images via keystone node
113 do: runState
114 target: I@keystone:server
115 state: cmd.run
116 args: ['. /root/keystonerc; glance image-list']
117
118# // Install and check nova service
119# //runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1)
120# salt.enforceState(saltMaster, 'I@nova:controller and *01*', 'nova.controller', true)
121# salt.enforceState(saltMaster, 'I@nova:controller', 'nova.controller', true)
122# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true)
123
124- description: Install nova on controllers on 01
125 do: enforceState
126 target: I@nova:controller and *01*
127 state: nova.controller
128
129- description: Install Keystone
130 do: enforceState
131 target: I@nova:controller
132 state: nova.controller
133
134- description: Show nova services via keystone node
135 do: runState
136 target: I@keystone:server
137 state: cmd.run
138 args: ['. /root/keystonerc; nova service-list']
139
140
141
142# // Install and check cinder service
143# //runSaltProcessStep(saltMaster, 'I@cinder:controller', 'state.sls', ['cinder'], 1)
144# salt.enforceState(saltMaster, 'I@cinder:controller and *01*', 'cinder', true)
145# salt.enforceState(saltMaster, 'I@cinder:controller', 'cinder', true)
146# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; cinder list'], null, true)
147
148
149- description: Install cinder on controllers on 01
150 do: enforceState
151 target: I@cinder:controller and *01*
152 state: cinder
153
154- description: Install cinder on controllers
155 do: enforceState
156 target: I@cinder:controller
157 state: cinder
158
159- description: Show cinder list via keystone node
160 do: runState
161 target: I@keystone:server
162 state: cmd.run
163 args: ['. /root/keystonerc; nova list']
164
165
166# // Install neutron service
167# //runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1)
168
169# salt.enforceState(saltMaster, 'I@neutron:server and *01*', 'neutron.server', true)
170# salt.enforceState(saltMaster, 'I@neutron:server', 'neutron.server', true)
171# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true)
172
173- description: Install neutron on controllers on 01
174 do: enforceState
175 target: I@neutron:server and *01*
176 state: neutron.server
177
178- description: Install neutron on controllers
179 do: enforceState
180 target: I@neutron:server
181 state: neutron.server
182
183- description: Show neutron agent list via keystone node
184 do: runState
185 target: I@keystone:server
186 state: cmd.run
187 args: ['. /root/keystonerc; neutron agent-list']
188
189# // Install heat service
190# //runSaltProcessStep(saltMaster, 'I@heat:server', 'state.sls', ['heat'], 1)
191# salt.enforceState(saltMaster, 'I@heat:server and *01*', 'heat', true)
192# salt.enforceState(saltMaster, 'I@heat:server', 'heat', true)
193# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true)
194
195- description: Install heat on controllers on 01
196 do: enforceState
197 target: I@heat:server and *01*
198 state: heat
199
200- description: Install heat on controllers
201 do: enforceState
202 target: I@heat:server
203 state: heat
204
205- description: Show heat resource type list via keystone node
206 do: runState
207 target: I@keystone:server
208 state: cmd.run
209 args: ['. /root/keystonerc; heat resource-type-list']
210
211# // Restart nova api
212# salt.runSaltProcessStep(saltMaster, 'I@nova:controller', 'service.restart', ['nova-api'])
213
214- description: Restart nova-api
215 do: runState
216 target: I@nova:controller
217 state: service.restart
218 args: ['nova-api']
219
220################### Install OpenStack network ##########################
221
222# // Apply gateway
223# salt.runSaltProcessStep(saltMaster, 'I@neutron:gateway', 'state.apply', [], null, true)
224
225- description: Apply gateway
226 do: runState
227 target: I@neutron:gateway
228 state: state.apply
229
230# // Pring information
231# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron net-list'], null, true)
232# salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova net-list'], null, true)
233
234- description: Show neutron networks via keystone node
235 do: runState
236 target: I@keystone:server
237 state: cmd.run
238 args: ['. /root/keystonerc; neutron net-list']
239
240- description: Show nova networks via keystone node
241 do: runState
242 target: I@keystone:server
243 state: cmd.run
244 args: ['. /root/keystonerc; nova net-list']
245
246
247################### Install OpenStack compute ##########################
248
249# //orchestrate.installOpenstackMkCompute(saltMaster, physical)
250# // Configure compute nodes
251# retry(2) {
252# salt.runSaltProcessStep(saltMaster, 'I@nova:compute', 'state.apply', [], null, true)
253# }
254
255- description: Install Nova compute
256 do: runState
257 target: I@nova:compute
258 state: state.apply
Dennis Dmitriev4ab889c2017-04-27 14:11:04 +0300259 retry: {count: 2, delay: 5}
Tatyana Leontovich78b83482017-04-11 18:57:11 +0300260
261
Oleksandr Ivashchenkoa95a72b2017-06-06 15:55:59 +0300262 # Upload cirros image
263
264- description: Upload cirros image on ctl01
265 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
266 'wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-i386-disk.img'
267 node_name: {{ HOSTNAME_CFG01 }}
268 retry: {count: 2, delay: 30}
269 skip_fail: false
270
271- description: Register image in glance
272 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
273 '. /root/keystonercv3; glance image-create --name cirros --visibility public --disk-format qcow2 --container-format bare --progress < /root/cirros-0.3.4-i386-disk.img'
274 node_name: {{ HOSTNAME_CFG01 }}
275 retry: {count: 1, delay: 30}
276 skip_fail: false
277
278- description: Create net04_external
279 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
280 '. /root/keystonercv3; neutron net-create net04_ext --shared --router:external True --provider:physical_network physnet1 --provider:network_type flat'
281 node_name: {{ HOSTNAME_CFG01 }}
282 retry: {count: 1, delay: 30}
283 skip_fail: false
284
285- description: Create subnet_external
286 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
287 '. /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'
288 node_name: {{ HOSTNAME_CFG01 }}
289 retry: {count: 1, delay: 30}
290 skip_fail: false
291
292- description: Create net04
293 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
294 '. /root/keystonercv3; neutron net-create net04'
295 node_name: {{ HOSTNAME_CFG01 }}
296 retry: {count: 1, delay: 30}
297 skip_fail: false
298
299- description: Create subnet_net04
300 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
301 '. /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'
302 node_name: {{ HOSTNAME_CFG01 }}
303 retry: {count: 1, delay: 30}
304 skip_fail: false
305
306- description: Create router
307 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
308 '. /root/keystonercv3; neutron router-create net04_router01'
309 node_name: {{ HOSTNAME_CFG01 }}
310 retry: {count: 1, delay: 30}
311 skip_fail: false
312
313- description: Set geteway
314 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
315 '. /root/keystonercv3; neutron router-gateway-set net04_router01 net04_ext'
316 node_name: {{ HOSTNAME_CFG01 }}
317 retry: {count: 1, delay: 30}
318 skip_fail: false
319
320- description: Add interface
321 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
322 '. /root/keystonercv3; neutron router-interface-add net04_router01 net04__subnet'
323 node_name: {{ HOSTNAME_CFG01 }}
324 retry: {count: 1, delay: 30}
325 skip_fail: false
326
327- description: Allow all tcp
328 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
329 '. /root/keystonercv3; nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0'
330 node_name: {{ HOSTNAME_CFG01 }}
331 retry: {count: 1, delay: 30}
332 skip_fail: false
333
334- description: Allow all icmp
335 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
336 '. /root/keystonercv3; nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0'
337 node_name: {{ HOSTNAME_CFG01 }}
338 retry: {count: 1, delay: 30}
339 skip_fail: false
340
341# Configure cinder-volume salt-call
342- description: Set disks 01
343 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
344 node_name: {{ HOSTNAME_CTL01 }}
345 retry: {count: 1, delay: 30}
346 skip_fail: false
347
348- description: Set disks 02
349 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
350 node_name: {{ HOSTNAME_CTL02 }}
351 retry: {count: 1, delay: 30}
352 skip_fail: false
353
354- description: Set disks 03
355 cmd: salt-call cmd.run 'echo -e "nn\np\n\n\n\nw" | fdisk /dev/vdb'
356 node_name: {{ HOSTNAME_CTL03 }}
357 retry: {count: 1, delay: 30}
358 skip_fail: false
359
360- description: Create partitions 01
361 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
362 node_name: {{ HOSTNAME_CTL01 }}
363 retry: {count: 1, delay: 30}
364 skip_fail: false
365
366- description: Create partitions 02
367 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
368 node_name: {{ HOSTNAME_CTL01 }}
369 retry: {count: 1, delay: 30}
370 skip_fail: false
371
372- description: Create partitions 03
373 cmd: salt-call cmd.run 'pvcreate /dev/vdb1'
374 node_name: {{ HOSTNAME_CTL01 }}
375 retry: {count: 1, delay: 30}
376 skip_fail: false