-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-installer.sh
executable file
·551 lines (475 loc) · 14.1 KB
/
main-installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
#!/bin/bash
#
## Unattended Installer (Semi Automated) for OpenStack (OCATA)
## Abdo Farag
## E-Mail: abdofarag85@gmail.com
## This installer forked and based on openstack-ocata-installer-centos7 v1.2.0.el7 "Siberian Lynx" released by:
## Reynaldo R. Martínez P. E-Mail: TigerLinux at Gmail dot com.
#
# Main Installer Script
# Version: 1.2.0.el7 "Siberian Lynx"
# August 24, 2017
#
PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
#
# This is our main installation script. It's function is basically read the main configuration file
# in "./configs" directory, source all installation variables, and then install every component in
# the right order. Normally the order is as follows:
# 1.- Basic python libraries and other base packages. Libvirt/qemu/kvm, sudo, etc.
# 2.- Message Broker (either rabbit or qpid - only if it's a controller).
# 3.- Database installation, configuration and provisioning (if it's a controller).
# 4.- Extra libraries (only on debian/ubuntu based installs).
# 5.- Keystone (if it's a controller, installs the sofwtare, in other cases, justo provision the en-
# vironment files
# 6.- Application Modules (if apply and where apply) in order:
# - Swift.
# - Glance.
# - Cinder.
# - Neutron.
# - Nova.
# - Ceilometer (with gnocchi and aodh).
# - Heat.
# - Trove.
# - Sahara.
# - Manila.
# - Designate.
# - Magnum.
# - Horizon.
# 7.- Basic SNMP Support.
# 8.- Post-install with maintenance crontabs and scripts
#
# This installation tool will allow you to construct an OpenStack cloud with the following possible
# configurations:
# - Monolitic ALL-IN-ONE OpenStack Server (basically an ALL-Services controller/compute).
# - Distributed Cloud with a Controller/Compute and several compute nodes.
# - Distributed Cloud with a Pure Controller and several compute nodes.
# - Fully distributed cloud with controller services distributed in many nodes, and several compute nodes
#
# The behaviour of this script is completelly controlled in the ./config/main-config.rc file. By properlly
# configuring this file, you can deploy your cloud the way you want.
#
case $1 in
"install")
if [ -f ./configs/main-config.rc ]
then
source ./configs/main-config.rc
mkdir -p /etc/openstack-control-script-config
date > /etc/openstack-control-script-config/install-init-date-and-time
chown -R root.root *
find . -name "*" -type f -exec chmod 644 "{}" ";"
find . -name "*.sh" -type f -exec chmod 755 "{}" ";"
else
echo "I can't access my own configuration"
echo "Please check you are executing the installer in its correct directory"
echo "Aborting !!!!."
echo ""
exit 0
fi
clear
echo ""
echo "OPENSTACK UNATTENDED INSTALLER"
echo "Flavor: OpenStack OCATA for Centos 7"
echo "Made by: Abdo Farag."
echo "E-Mail: abdofarag85@gmail.com"
echo "Version 0.0.1.el7 - September 11, 2017"
echo ""
echo "I'll verify all requiremens"
echo "If any requirement is not met, I'll stop and inform what's missing"
echo ""
echo "Requirements"
echo "- OS: Centos 7 x86_64 fully updated"
echo "- This script must be executed by root account (don't use sudo please)"
echo "- Centos 7 original repositories must be enabled and available"
echo "- Epel 7 repository must be enabled and available"
echo "- OpenStack RDO repositories for OCATA also enabled and available"
echo "- OpenVSwitch must be installed and configured with at least br-int bridge"
echo "- If you wish to install swift, the filesystem should be mounted in /srv/node"
echo ""
echo "NOTE: You can use the tee command if you want to log all installer actions. Example:"
echo "./main-installer.sh install | tee -a /var/log/my_install_log.log"
echo ""
case $2 in
auto|AUTO)
echo "Automated mode activated. No additional questions will be made"
;;
*)
echo -n "Do you wish to continue ? [y/n]:"
read -n 1 answer
echo ""
case $answer in
y|Y)
echo ""
echo "Starting verifications"
echo ""
;;
*)
echo ""
echo "Aborting by user request !!!"
echo ""
exit 0
;;
esac
;;
esac
echo ""
echo "Installing requirements and performing more validations"
echo ""
./modules/requeriments.sh
if [ -f /etc/openstack-control-script-config/libvirt-installed ]
then
echo ""
echo "Requeriments installed and initial validations done"
echo "I'll continue with the OpenStack modules installation"
echo ""
else
echo ""
echo "Something bad happened. Validations failed"
echo "Aborting the installation !!"
echo ""
exit 0
fi
echo "Ready... let's continue working"
echo ""
rm -rf /tmp/keystone-signing-*
rm -rf /tmp/cd_gen_*
if [ $messagebrokerinstall == "yes" ]
then
echo ""
echo "Installing message broker"
./modules/messagebrokerinstall.sh
if [ -f /etc/openstack-control-script-config/broker-installed ]
then
echo ""
echo "Ready"
echo ""
else
echo ""
echo "Message broker installation failed. Aborting !!"
echo ""
exit 0
fi
fi
echo ""
echo "Installing database support"
echo ""
./modules/databaseinstall.sh
if [ -f /etc/openstack-control-script-config/db-installed ]
then
echo ""
echo "Database support ready"
echo ""
else
echo ""
echo "Database support installation failed. Abroting !!"
echo ""
exit 0
fi
if [ $keystoneinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK KEYSTONE"
./modules/keystoneinstall.sh
if [ -f /etc/openstack-control-script-config/keystone-installed ]
then
echo "OPENSTACK KEYSTONE INSTALLED"
else
echo ""
echo "Keystone installation failed. Aborting !!"
echo ""
exit 0
fi
else
OS_URL="http://$keystonehost:35357/v3"
OS_USERNAME=$keystoneadminuser
OS_TENANT_NAME=$keystoneadminuser
OS_PROJECT_NAME=$keystoneadminuser
OS_PASSWORD=$keystoneadminpass
OS_AUTH_URL="http://$keystonehost:5000/v3"
OS_VOLUME_API_VERSION=2
OS_PROJECT_DOMAIN_NAME=$keystonedomain
OS_USER_DOMAIN_NAME=$keystonedomain
OS_IDENTITY_API_VERSION=3
echo "export OS_USERNAME=$OS_USERNAME" >> $keystone_admin_rc_file
echo "export OS_PASSWORD=$OS_PASSWORD" >> $keystone_admin_rc_file
echo "export OS_PROJECT_NAME=$OS_TENANT_NAME" >> $keystone_admin_rc_file
echo "export OS_AUTH_URL=$OS_AUTH_URL" >> $keystone_admin_rc_file
echo "export OS_VOLUME_API_VERSION=2" >> $keystone_admin_rc_file
echo "export OS_IDENTITY_API_VERSION=3" >> $keystone_admin_rc_file
echo "export OS_PROJECT_DOMAIN_NAME=$keystonedomain" >> $keystone_admin_rc_file
echo "export OS_USER_DOMAIN_NAME=$keystonedomain" >> $keystone_admin_rc_file
echo "PS1='[\u@\h \W(keystone_admin)]\$ '" >> $keystone_admin_rc_file
OS_AUTH_URL_FULLADMIN="http://$keystonehost:35357/v3"
echo "export OS_USERNAME=$OS_USERNAME" >> $keystone_fulladmin_rc_file
echo "export OS_PASSWORD=$OS_PASSWORD" >> $keystone_fulladmin_rc_file
echo "export OS_PROJECT_NAME=$OS_TENANT_NAME" >> $keystone_fulladmin_rc_file
echo "export OS_AUTH_URL=$OS_AUTH_URL_FULLADMIN" >> $keystone_fulladmin_rc_file
echo "export OS_VOLUME_API_VERSION=2" >> $keystone_fulladmin_rc_file
echo "export OS_IDENTITY_API_VERSION=3" >> $keystone_fulladmin_rc_file
echo "export OS_PROJECT_DOMAIN_NAME=$keystonedomain" >> $keystone_fulladmin_rc_file
echo "export OS_USER_DOMAIN_NAME=$keystonedomain" >> $keystone_fulladmin_rc_file
echo "PS1='[\u@\h \W(keystone_fulladmin)]\$ '" >> $keystone_fulladmin_rc_file
mkdir -p /etc/openstack-control-script-config
date > /etc/openstack-control-script-config/keystone-installed
date > /etc/openstack-control-script-config/keystone-extra-idents
fi
if [ $swiftinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK SWIFT"
./modules/swiftinstall.sh
if [ -f /etc/openstack-control-script-config/swift-installed ]
then
echo "OPENSTACK SWIFT INSTALLED"
else
echo ""
echo "Swift installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $glanceinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK GLANCE"
./modules/glanceinstall.sh
if [ -f /etc/openstack-control-script-config/glance-installed ]
then
echo "OPENSTACK GLANCE INSTALLED"
else
echo ""
echo "Glance installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $cinderinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK CINDER"
./modules/cinderinstall.sh
if [ -f /etc/openstack-control-script-config/cinder-installed ]
then
echo "OPENSTACK CINDER INSTALLED"
else
echo ""
echo "Cinder installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $neutroninstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK NEUTRON"
./modules/neutroninstall.sh
if [ -f /etc/openstack-control-script-config/neutron-installed ]
then
echo "OPENSTACK NEUTRON INSTALLED"
else
echo ""
echo "Neutron installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $novainstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK NOVA"
./modules/novainstall.sh
if [ -f /etc/openstack-control-script-config/nova-installed ]
then
echo "OPENSTACK NOVA INSTALLED"
else
echo ""
echo "Nova installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $ceilometerinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK CEILOMETER"
./modules/ceilometerinstall.sh
if [ -f /etc/openstack-control-script-config/ceilometer-installed ]
then
echo "OPENSTACK CEILOMETER INSTALLED"
else
echo ""
echo "Ceilometer installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $heatinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK HEAT"
./modules/heatinstall.sh
if [ -f /etc/openstack-control-script-config/heat-installed ]
then
echo "OPENSTACK HEAT INSTALLED"
else
echo ""
echo "Heat installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $troveinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK TROVE"
./modules/troveinstall.sh
if [ -f /etc/openstack-control-script-config/trove-installed ]
then
echo "OPENSTACK TROVE INSTALLED"
else
echo ""
echo "Trove installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $saharainstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK SAHARA"
./modules/saharainstall.sh
if [ -f /etc/openstack-control-script-config/sahara-installed ]
then
echo "OPENSTACK SAHARA INSTALLED"
else
echo ""
echo "Sahara installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $manilainstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK MANILA"
./modules/manilainstall.sh
if [ -f /etc/openstack-control-script-config/manila-installed ]
then
echo "OPENSTACK MANILA INSTALLED"
else
echo ""
echo "Manila installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $designateinstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK DESIGNATE"
./modules/designateinstall.sh
if [ -f /etc/openstack-control-script-config/designate-installed ]
then
echo "OPENSTACK DESIGNATE INSTALLED"
else
echo ""
echo "Designate installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $magnuminstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK MAGNUM"
./modules/magnuminstall.sh
if [ -f /etc/openstack-control-script-config/magnum-installed ]
then
echo "OPENSTACK MAGNUM INSTALLED"
else
echo ""
echo "Magnum installation failed. Aborting !!"
echo ""
exit 0
fi
fi
if [ $snmpinstall == "yes" ]
then
echo ""
echo "INSTALLING SNMP SUPPORT"
./modules/snmpinstall.sh
if [ -f /etc/openstack-control-script-config/snmp-installed ]
then
echo "SNMP SUPPORT INSTALLED"
else
echo ""
echo "SNMP Support failed to install, but because this is NOT critical,"
echo "we will continue the installation"
echo ""
fi
fi
if [ $horizoninstall == "yes" ]
then
echo ""
echo "Installing OPENSTACK HORIZON"
./modules/horizoninstall.sh
if [ -f /etc/openstack-control-script-config/horizon-installed ]
then
echo "OPENSTACK HORIZON INSTALLED"
else
echo ""
echo "Horizon installation failed. Aborting !!"
echo ""
exit 0
fi
fi
echo ""
echo "Executing Post Install"
./modules/postinstall.sh
date > /etc/openstack-control-script-config/install-end-date-and-time
echo ""
echo "OPENSTACK INSTALLATION FINISHED"
echo ""
;;
"uninstall")
if [ -f ./configs/main-config.rc ]
then
source ./configs/main-config.rc
else
echo "I can't access my own configuration"
echo "Please check you are executing the installer in its correct directory"
echo "Aborting !!!!."
echo ""
exit 0
fi
echo ""
echo "All openstack related content will be erased from this server"
echo ""
case $2 in
auto|AUTO)
echo "Automated mode activated"
;;
*)
echo -n "Are you sure you want to continue ? [y/n]:"
read -n 1 answer
case $answer in
y|Y)
echo ""
echo "Uninstalling OpenStack services, packages and configurations"
echo ""
;;
*)
echo ""
echo "Aborted by user request"
echo ""
exit 0
;;
esac
esac
./modules/uninstall.sh
;;
*)
echo ""
echo "Usage: $0 install | uninstall [auto]"
echo ""
;;
esac