forked from wuyeliang/install_openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
244 lines (217 loc) · 5.06 KB
/
main.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
#!/bin/bash
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
TOPDIR=$(cd $(dirname "$0") && pwd)
export TOPDIR
INSTALL_PATH=${TOPDIR}
if [ -e ${TOPDIR}/lib/openstack-log.sh ]
then
source ${TOPDIR}/lib/openstack-log.sh
else
echo -e "\033[41;37m ${TOPDIR}/openstack-log.sh is not exist. \033[0m"
exit 1
fi
#input variable
if [ -e ${TOPDIR}/lib/installrc ]
then
source ${TOPDIR}/lib/installrc
else
echo -e "\033[41;37m ${TOPDIR}/lib/installr is not exist. \033[0m"
exit 1
fi
USER_N=`whoami`
if [ ${USER_N} = root ]
then
log_info "execute by root. "
else
log_error "execute by ${USER_N}"
echo -e "\033[41;37m you must execute this scritp by root. \033[0m"
exit
fi
function fn_install_openstack_controller ()
{
cat << EOF
1) Configure System Environment.
2) Install Mariadb and Rabbitmq-server.
3) Install Keystone.
4) Install Glance.
5) Install Nova.
6) Install Cinder.
7) Install Neutron.
8) Install Dashboard.
0) Quit
EOF
read -p "please input one number for install :" install_number
case ${install_number} in
1)
/bin/bash ${TOPDIR}/etc/presystem.sh
log_info "/bin/bash ${TOPDIR}/etc/presystem.sh."
fn_install_openstack_controller
;;
2)
/bin/bash ${TOPDIR}/etc/install_mariadb.sh
log_info "/bin/bash ${TOPDIR}/etc/install_mariadb.sh."
fn_install_openstack_controller
;;
3)
/bin/bash ${TOPDIR}/etc/config-keystone.sh
log_info "/bin/bash ${TOPDIR}/etc/config-keystone.sh."
fn_install_openstack_controller
;;
4)
/bin/bash ${TOPDIR}/etc/install_glance.sh
log_info "/bin/bash ${TOPDIR}/etc/install_glance.sh."
fn_install_openstack_controller
;;
5)
/bin/bash ${TOPDIR}/etc/install_nova.sh
log_info "/bin/bash ${TOPDIR}/etc/install_nova.sh."
fn_install_openstack_controller
;;
6)
/bin/bash ${TOPDIR}/etc/install_cinder.sh
log_info "/bin/bash ${TOPDIR}/etc/install_cinder.sh."
fn_install_openstack_controller
;;
7)
/bin/bash $PWD/etc/install_neutron.sh
log_info "/bin/bash $PWD/etc/install_neutron.sh"
fn_install_openstack_controller
;;
8)
/bin/bash ${INSTALL_PATH}/etc/install_dashboard.sh
log_info "/bin/bash ${TOPDIR}/etc/install_dashboard.sh."
fn_install_openstack_controller
;;
0)
exit 1
;;
*)
echo -e "\033[41;37m please input one right number. \033[0m"
fn_install_openstack_controller
;;
esac
}
function fn_install_openstack_computer ()
{
cat << EOF
1) Configure System Environment.
2) Install Computer Service.
0) Quit
EOF
read -p "please input one number for install :" install_number
case ${install_number} in
1)
/usr/bin/bash ./etc/openstack-computer_system.sh
fn_log "/usr/bin/bash ./etc/openstack-computer_system.sh"
fn_install_openstack_computer
;;
2)
/usr/bin/bash ./etc/openstack-computer_install.sh
fn_log "/usr/bin/bash ./etc/openstack-computer_install.sh"
fn_install_openstack_computer
;;
0)
fn_install_openstack
;;
*)
echo -e "\033[41;37m please input one number. \033[0m"
fn_install_openstack_computer
;;
esac
}
function fn_install_openstack_swift () {
cat << EOF
1) Configure System Environment.(swift node)
2) Install siwft Service.(swift node)
3) Initial rings(controller node)
0) Quit
EOF
read -p "please input one number for install :" install_number
case ${install_number} in
1)
/usr/bin/bash ./etc/openstack-block_storage_system.sh
fn_log "/usr/bin/bash ./etc/openstack-block_storage_system.sh"
fn_install_openstack_swift
;;
2)
/usr/bin/bash ./etc/node-swift.sh
fn_log "/usr/bin/bash ./etc/node-swift.sh"
fn_install_openstack_swift
;;
3)
/usr/bin/bash ./etc/create-initial-rings.sh
fn_log "/usr/bin/bash ./etc/create-initial-rings.sh"
fn_install_openstack_swift
;;
0)
fn_install_openstack
;;
*)
echo -e "\033[41;37m please input one number. \033[0m"
fn_install_openstack_swift
;;
esac
}
function fn_install_openstack ()
{
cat << EOF
1) Install Controller Node Service.
2) Install Computer Node Service.
3) Install Block Node Service (Cinder).
0) Quit
EOF
read -p "please input one number for install :" install_number
case ${install_number} in
1)
fn_install_openstack_controller
fn_log "fn_install_openstack_controller"
fn_install_openstack_controller
;;
2)
fn_install_openstack_computer
fn_log "fn_install_openstack_computer"
fn_install_openstack_computer
;;
3)
fn_install_openstack_block
fn_log "fn_install_openstack_block"
fn_install_openstack_block
;;
0)
exit 1
;;
*)
echo -e "\033[41;37m please input one number. \033[0m"
fn_install_openstack
;;
esac
}
function fn_install_openstack_block () {
cat << EOF
1) Configure System Environment.
2) Install Block Service.
0) Quit
EOF
read -p "please input one number for install :" install_number
case ${install_number} in
1)
/usr/bin/bash ./etc/openstack-block_storage_system.sh
fn_log "/usr/bin/bash ./etc/openstack-block_storage_system.sh"
fn_install_openstack_block
;;
2)
/usr/bin/bash ./etc/openstack-block_install.sh
fn_log "/usr/bin/bash ./etc/openstack-block_install.sh"
fn_install_openstack_block
;;
0)
fn_install_openstack
;;
*)
echo -e "\033[41;37m please input one number. \033[0m"
fn_install_openstack_block
;;
esac
}
fn_install_openstack