-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient_setup.sh
More file actions
executable file
·486 lines (431 loc) · 16.1 KB
/
client_setup.sh
File metadata and controls
executable file
·486 lines (431 loc) · 16.1 KB
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
#!/bin/bash
# grab the puppet_openstack_builder code
# and update it if it doesn't have the right
# elements already defined for VLAN/VXLan/LB
#
# Also, create a new scenario, and role mapping
# for this enviornment
exec > >(tee /var/log/lb_vxlan_client_setup.log)
exec 2>&1
set -o errexit
usage() {
cat <<EOF
usage: $0 options
OPTIONS:
-h Show this message
-p {proxy_address} http proxy i.e. -p http://username:password@host:port/
-v {vlan} single interface vlan to enable
-m set 8950 MTU
-r run install.sh for all_in_one/lb_vxlan use case
-i {ipaddress} vlan interface ip address
-n {netmask} vlan interfac netmask
-g {gateway} vlan interface gateway
-d {dns} vlan interface dns ip
-t {ntp} ntp server address
-D {default_int} default interface (usually eth0)
-E {external_int} external interface (usually eth1)
-P {puppet_server} FQDN of the puppet master
-I {puppet_ip} IP of the puppet master
The script expects at least one parameter, so at a minimum pass -t to set
the ntp server to something other than 1.pool.ntp.com
more commonly, you may want to use a different Default interface (for API endpoint)
or set the MTU on an interface (the "external" interface).
If you have multiple interfaces, and want the OpenStack config to include them
pass them as a colon separated list to the -I parameter (not this should include
any interface you pass as the -E parameter as they set different components of
the environment).
An example, with the default interface on eth1, the large MTU interface as eth3, and
eth2 and eth4 also being created:
./client_setup.sh -t ntp.esl.cisco.com -m -D eth1 -E eth3 -P build.lab I 10.0.0.10 -r
EOF
}
export -f usage
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root or with sudo"
usage
exit 1
fi
# wrapper all commands with sudo in case this is not run as root
# also map in a proxy in case it was passed as a command line argument
function run_cmd () {
if [ -z "$PROXY" ]; then
sudo $*
else
sudo env http_proxy=$PROXY https_proxy=$PROXY $*
fi
}
export -f run_cmd
# Define some useful APT parameters to make sure you get the latest versions of code
APT_CONFIG="-o Acquire::http::No-Cache=True -o Acquire::BrokenProxy=true -o Acquire::Retries=3"
# check if the environment is set up for http and https proxies
if [ -n "$http_proxy" ]; then
if [ -z "$https_proxy" ]; then
echo "Please set https_proxy env variable."
exit 1
fi
PROXY=$http_proxy
fi
function valid_ip()
{
local ip=$1
local stat=1
if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
OIFS=$IFS
IFS='.'
ip=($ip)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \
&& ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
stat=$?
fi
return $stat
}
export valid_ip
# parse CLI options
while getopts "hmrp:v:i:n:g:d:t:D:E:P:I:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
p)
PROXY=$OPTARG
export http_proxy=$PROXY
export https_proxy=$PROXY
;;
v)
VLAN=$OPTARG
export vlan=$VLAN
;;
m)
export MTU=9000
;;
r)
export run_all_in_one=true
;;
i)
export ip_address=$OPTARG
;;
n)
export ip_netmask=$OPTARG
;;
g)
export ip_gateway=$OPTARG
;;
d)
export dns_address=$OPTARG
;;
t)
export ntp_address=$OPTARG
;;
D)
export default_interface=$OPTARG
;;
E)
export external_interface=$OPTARG
;;
I)
export puppet_ip=$OPTARG
;;
P)
export puppet_server=$OPTARG
esac
done
if [ $# -eq 0 ] ;then
usage
exit 1
fi
if [ -z "${puppet_ip}" ] ;then
echo "You need to set your puppet master for this script!"
echo "-P puppet_master_fqdn and -I puppet_master_ip"
exit 1
fi
if [ -z "${puppet_server}" ] ;then
echo "You need to set your puppet master for this script!"
echo "-P puppet_master_fqdn and -I puppet_master_ip"
exit 1
fi
if [ ! ${puppet_server} ?? '.' ] ;then
echo "You need to pass a FQDN (host.domain) for the puppet server"
exit 1
fi
# Make sure the apt repository list is up to date
echo -e "\n\nUpdate apt repository...\n\n"
if ! run_cmd apt-get $APT_CONFIG update; then
echo "Can't update apt repository"
exit 1
fi
# Install prerequisite packages
echo "Installing prerequisite apps: git, vlan, vim..."
if ! run_cmd apt-get $APT_CONFIG install -qym git vlan vim; then
echo "Can't install prerequisites!..."
exit 1
fi
echo "configure vhost_net module for better VM network performance"
echo 'vhost_net' >> /etc/modules
modprobe vhost_net
echo "Enable 8021q module for VLAN config"
if [ -z "`grep 8021q /etc/modules`" ] ;then
echo 8021q >> /etc/modules
modprobe 8021q
fi
if [ ! -z "${VLAN}" ] ;then
while true; do
if [ -z "$ip_address" ] ;then
while true; do
read -ep "Enter the VLAN:${VLAN} IPv4 Address: " ip_address
if ! valid_ip $ip_address ; then
echo "That's not an IP address"
else
break
fi
done
fi
if [ -z "$ip_netmask" ] ;then
while true; do
read -ep "Enter the VLAN:${VLAN} Netmask: " ip_netmask
if ! valid_ip $ip_netmask ; then
echo "That's not a valid IPv4 Netmask"
else
break
fi
done
fi
if [ -z "$ip_gateway" ] ;then
while true; do
read -ep "Enter the VLAN:${VLAN} IPv4 Gateway: " ip_gateway
if ! valid_ip $ip_gateway ; then
echo "That's not a valid IPv4 address"
else
break
fi
done
fi
if [ -z "$dns_address" ] ;then
while true; do
read -ep "Enter the initial VLAN:${VLAN} DNS Server IP Address: " dns_address
if ! valid_ip $dns_address ; then
echo "That's not a valid IPv4 address"
else
break
fi
done
fi
if [ -z "${MTU}" ] ;then
while true; do
read -n 1 -p "Do you want 9K MTU? [y|n]" yn
case $yn in
[Yy]* ) MTU=9000; echo 'MTU will be set to 8950, configure your VMs appropriately'; break;;
[Nn]* ) echo 'MTU will remain default, it is recommened to set VM MTU to 1450';
esac
done
fi
if [ $# -eq 1 ] ;then
echo -e "IP Address: $ip_address\nNetmask: $ip_netmask\nGateway: $ip_gateway\nDNS: $dns_address\nMTU: ${MTU:-1500}\n"
read -n 1 -p "Is this correct [y|n]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo "Try again."
esac
else
break
fi
done
initial_interface=`grep 'auto eth' /etc/network/interfaces | head -1 | awk '{print $2}'`
if [ ! -z "$initial_interface" ] ;then
sed -e '/gateway/d ' -i /etc/network/interfaces
dns_search=`grep dns-search /etc/network/interfaces | awk '{print $2}'`
if [ -z "`ifconfig -a | grep $initial_interface | grep $VLAN`" ] ;then
vconfig add $initial_interface $VLAN
fi
cat >> /etc/network/interfaces <<EOF
auto $initial_interface.$VLAN
iface $initial_interface.$VLAN inet static
address $ip_address
netmask $ip_netmask
gateway $ip_gateway
dns-nameserver $dns_address
dns-search $dns_search
EOF
fi
if [ ! -z "${default_interface}" ]; then
default_interface=$initial_interface.$VLAN
else
default_interface='eth0'
echo "Setting default interface to eth0, should it be something else? pass it with -D "
fi
if [ ! -z "${external_interface}" ]; then
external_interface=$initial_interface
else
external_interface='eth1'
echo "Setting external interface to eth1, should it be something else? pass it with -E "
fi
if [ ! -z "$MTU" ]; then
sed -e "/iface ${default_interface}/a \ \ mtu ${MTU}" -i /etc/network/interfaces
sed -e "/iface ${external_interface}/a \ \ mtu ${MTU}" -i /etc/network/interfaces
fi
fi
if [ ! -z "$dmz" ]; then
echo 'Acquire::http::Proxy "http://10.0.149.10:3142";' >/etc/apt/apt.conf.d/01proxy
export repo_location=10.0.100.21
fi
## Setup Cisco Repos
REPO_LOC=${repo_location:-openstack-repo.cisco.com}
# Add Cisco repo and puppet repo
cat > /etc/apt/sources.list.d/cisco-openstack-mirror_icehouse.list<<EOF
# cisco-openstack-mirror_icehouse
deb http://$REPO_LOC/openstack/cisco icehouse/snapshots/i.0 main
deb-src http://$REPO_LOC/openstack/cisco icehouse/snapshots/i.0 main
EOF
cat > /etc/apt/sources.list.d/cisco-openstack-puppet_icehouse.list<<EOF
# cisco packaged puppet modules
deb http://$REPO_LOC/openstack/puppet icehouse main
deb-src http://$REPO_LOC/openstack/puppet icehouse main
EOF
# Add the signing key for the Cisco OpenStack repo
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQENBE/oXVkBCACcjAcV7lRGskECEHovgZ6a2robpBroQBW+tJds7B+qn/DslOAN
1hm0UuGQsi8pNzHDE29FMO3yOhmkenDd1V/T6tHNXqhHvf55nL6anlzwMmq3syIS
uqVjeMM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1moFpeqLys2AAY+yXiHDv57ABEB
AAGJAR8EGAECAAkFAk/oXVkCGwwACgkQ6MxnBT7TsZng+AgAnFogD90f3ByTVlNp
Sb+HHd/cPqZ83RB9XUxRRnkIQmOozUjw8nq8I8eTT4t0Sa8G9q1fl14tXIJ9szzz
BUIYyda/RYZszL9rHhucSfFIkpnp7ddfE9NDlnZUvavnnyRsWpIZa6hJq8hQEp92
IQBF6R7wOws0A0oUmME25Rzam9qVbywOh9ZQvzYPpFaEmmjpCRDxJLB1DYu8lnC4
h1jP1GXFUIQDbcznrR2MQDy5fNt678HcIqMwVp2CJz/2jrZlbSKfMckdpbiWNns/
xKyLYs5m34d4a0it6wsMem3YCefSYBjyLGSd/kCI/CgOdGN1ZY1HSdLmmjiDkQPQ
UcXHbA==
=v6jg
-----END PGP PUBLIC KEY BLOCK-----' | apt-key add -
# add cisco puppet repo key
echo '-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.11 (GNU/Linux)
mQINBFMnxckBEADPI5B+wQGZ9DY7vRBN+QxMmDCDsJ3JochAHrQJFGpkJ2ihWoB1
FZ3baZNO1naM5JQW7DZstQY8GAfIGtBU/X/DFm4YlizZfrvfvWOPiJ0NvFwfa445
0q+QzfutubOmh+Wpd29YxSW5W2TTYQ629+jBYYUAsjPpkMXyyoH8BOEc0L/xdD/f
EvfYLSknxgzs/BwKXsvsAv7GdVGp+ywTaRnmBQ/U85AIsK3/lDLcSYWCpd8YHFks
TPoWMQzX+Xw+W2W4Gqg7lg1nC2725ZuzQjdmv1tSTPWG8Aaz6cNk8vPJj045jehM
qHym1TSQCG4cZIQjGZFc7m2XavJHGujIAKx4uSpoyJeiz2j70+Renv9qG3hvkoZE
xZ2fBNJeY9y95l88crSgoqsOuupZGPOQ+jAO66idRgx7yfsiOULXZv5Ku9Gijj5z
YKybb1VEq/LNEBYar5TKjqrDfg5lLGtss91NVQ0wGMCm3031RB/rWqXRUl4fPg2Z
RXGn73JMuilKUpr9ddZonVc1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9dC8eUdjlYIOPcd/EdKELTZb2tc0OnLnUBpWytGm9ou6iCn
dnlC/e3KscvJae+2rI41tag+dnHaybNst42Fv+GJpOInFdhHXWoclTxaMclIhtLj
lKY5AXqs8lbCmiNfdWLIyGlMjXjhsycDClbsvhQlkfjAHw1ft38RnaelegjV0pE+
fUTkyPNXMC7WAb4614ZHSxZQpSUfFyHX0BZnkZoX/AStU0egEfL4hRuLTlkSRokC
HwQYAQIACQUCUyfFyQIbDAAKCRCbvZLr7uiHINDtD/oC/3WMsvtnF3+v/aaxkcwP
AxeRpbSAUWhWaIuPY3G117Prq3xPtK75+MQUV4SxSY/TxX+pxtc5vDlMh0tw85+9
tDOOx1ZUJ/0qh8wTcLMi2wSN3N2P+WIbdN9IQqCWa/sKIVOCw4flAXQzIQXMoQxc
KuQ07C5ToLv9KsFOqG/iEw0dhR6a2RJKH5XTFObs3In68OQJox2c3czdkv3Omg+U
T8Y06I1VxrVv0Dx727E9sdvfIclRho6Hjep4P03myu/2/tYLA++dH1fmKiv8a29m
DbWv/Wg/8oEjLyUhw/VzeagBncK5y5Rk31yc9tVbua1/+WO70dBpoXPdzOtab/wt
osRldrp+DOnufvN/hNC44QyVD+5iGEda2XAGIV2odqKt3P/6uk/iMivF/HTfznhj
TdThjBpbsZGq4fMxgOJuciSxbBSQqvQRcO8J+gQjbGUUmXA4sfeBf7z/VT54Ynbq
8plPjR7MQNG6WUunT/pyjl1TMKD8A5o6lkyqogvrQBvxOYu/WP4n9ahKrz1HXAhp
/t8kxyIVn87vH7Dt0/kFaLx5x8baokCMZ7Vu4VUVjL8qkG79+e/enz+IdBfYCo07
k43yuqjkf/UPWstaCBWRdsHdAezmurdTsejWuQJ2fsIwIuGqUgjJR90tHtV+Ldj9
ykz5a/8840rWqc7sLA7lKA==
=HVuX
-----END PGP PUBLIC KEY BLOCK-----' | apt-key add -
apt-get update && apt-get install -y ipmitool
# Fix puppet, clobbering any existing puppet version to ensure
# PKI gets set up correctly.
apt-get remove --purge --yes puppet puppet-common
rm -rf /etc/puppet/puppet.conf /var/lib/puppet
apt-get install puppet -y
if [ ! -z "${puppet_server}" ] ;then
sed -e "/logdir/ a pluginsync=true" -i /etc/puppet/puppet.conf
sed -e "/logdir/ a server=${puppet_server}" -i /etc/puppet/puppet.conf
if [ -z "`grep ${puppet_server} /etc/hosts`" && ! -z "${puppet_ip}" ] ;then
echo "${puppet_ip} ${puppet_server}" >> /etc/hosts
puppet agent --enable
fi
else
echo "set server={puppet server hostname} and pluginsync=true in /etc/puppet/puppet.conf"
echo "and ensure that the puppet server fqdn is configured in /etc/hosts or in upstream DNS!"
fi
if [ ! -z ${default_interface} ] ;then
echo "Setting default interface (API Interface) to $default_interface"
if [ -z "`grep auto\ ${default_interface} /etc/network/interfaces`" ] ;then
unset run_all_in_one
echo -e "\n\nNOTE: Your API Interface does not appear in /etc/network/interfaces\n\n\
You need to address this or the next phase of installation will fail!!\n\n\n\n"
exit 1
fi
# if [ ! -z "$MTU" ]; then
# sed -e "/iface ${default_interface}/a \ \ mtu ${MTU}" -i /etc/network/interfaces
# fi
fi
if [ ! -z ${external_interface} ] ;then
echo "Setting external interface (Neutron Flat Network) to $external_interface"
if [ -z "`grep ${external_interface} /etc/network/interfaces`" ] ;then
cat >> /etc/network/interfaces <<EOF
auto ${external_interface}
iface ${external_interface} inet manual
up ip link set ${external_interface} promisc on
EOF
if [ ! -z "$MTU" ]; then
sed -e "/iface ${external_interface}/a \ \ mtu ${MTU}" -i /etc/network/interfaces
fi
fi
fi
if [ ! -z "${ntp_address}" ] ;then
apt-get install -y ntp
echo "server ${ntp_address} iburst" >/etc/ntp.conf
service ntp restart
ntpq -p
fi
# Run all_in_one deployment?
if [ ! -z "${run_all_in_one}" ] ;then
puppet agent -v -d -t
fi
#reboot