-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathundercloud-install.sh
executable file
·44 lines (36 loc) · 1.78 KB
/
undercloud-install.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
#!/bin/bash -e
my_file="$(readlink -e "$0")"
my_dir="$(dirname $my_file)"
# common setting from create_env.sh
if [[ -z "$NUM" ]] ; then
echo "Please set NUM variable to specific environment number. (export NUM=4)"
exit 1
fi
BASE_ADDR=${BASE_ADDR:-172}
IMAGES=${IMAGES:-"/home/stack/images-$OPENSTACK_VERSION.tar"}
NETDEV=${NETDEV:-'eth1'}
SKIP_SSH_TO_HOST_KEY=${SKIP_SSH_TO_HOST_KEY:-'no'}
# on kvm host do once: create stack user, create home directory, add him to libvirtd group
((env_addr=BASE_ADDR+NUM*10))
ip_addr="192.168.${env_addr}.2"
ssh_opts="-i $my_dir/kp-$NUM -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
ssh_addr="root@${ip_addr}"
if [ -f $IMAGES ] ; then
# copy images for overcloud to it. (images can be build manually but it's too long - use previously built images)
scp $ssh_opts -B $IMAGES ${ssh_addr}:/tmp/images.tar
fi
for fff in __undercloud-install-1-as-root.sh __undercloud-install-2-as-stack-user.sh tripleo.mitaka.diff tripleo.newton.diff ; do
scp $ssh_opts -B "$my_dir/$fff" ${ssh_addr}:/root/$fff
done
ssh -t $ssh_opts $ssh_addr "NUM=$NUM NETDEV=$NETDEV SKIP_SSH_TO_HOST_KEY=$SKIP_SSH_TO_HOST_KEY OPENSTACK_VERSION=$OPENSTACK_VERSION /root/__undercloud-install-1-as-root.sh"
# TODO: temporary solution - 'overcloud' directory will be moved to separate repository later
rm -f "$my_dir/oc.tar"
pushd "$my_dir"
echo " PackagesSourceURL: \"ftp://QNzgdxXix:[email protected]/RH/${SCALEIO_VERSION}\"" >> overcloud/scaleio-env.yaml
tar cvf oc.tar overcloud
popd
scp $ssh_opts "$my_dir/oc.tar" ${ssh_addr}:/home/stack/oc.tar
rm -f "$my_dir/oc.tar"
scp $ssh_opts "$my_dir/overcloud-install.sh" ${ssh_addr}:/home/stack/overcloud-install.sh
scp $ssh_opts "$my_dir/save_logs.sh" ${ssh_addr}:/home/stack/save_logs.sh
echo "SSH into undercloud: ssh -t $ssh_opts $ssh_addr"