forked from fultonj/oooq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaster.sh
executable file
·71 lines (61 loc) · 2.54 KB
/
master.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
#!/usr/bin/env bash
# Filename: master.sh
# Description: Sets up my dev env
# Supported Langauge(s): GNU Bash 4.3.x
# Time-stamp: <2017-03-02 13:31:09 jfulton>
# -------------------------------------------------------
CLONEQ=1
RUNQ=1
PKGS=0
DISK=0
IMG=0
SCRIPTS=1
LOCAL=0
# -------------------------------------------------------
export SSH_ENV=~/.quickstart/ssh.config.ansible
export VIRTHOST=$(hostname)
if [ $CLONEQ -eq 1 ]; then
rm -rf tripleo-quickstart/ 2> /dev/null
git clone https://github.com/openstack/tripleo-quickstart
ln -s tripleo-quickstart/quickstart.sh
fi
if [ $RUNQ -eq 1 ]; then
bash quickstart.sh -e supported_distro_check=false -e enable_vnc_console=true --teardown all --release ocata -e @myconfigfile.yml $VIRTHOST
fi
if [ $PKGS -eq 1 ]; then
bash pkgs.sh
fi
if [ $DISK -eq 1 ]; then
# shouldn't be necessary now the tripleo-quickstart supports something like it
bash run-add-disks.sh
fi
if [ $IMG -eq 1 ]; then
bash overcloud-image-tweak.sh
fi
if [ $SCRIPTS -eq 1 ]; then
# make it easy to pull this repo to the underlcoud
ssh -F $SSH_ENV stack@undercloud "echo 'git clone [email protected]:fultonj/oooq.git ; ln -s oooq/tht' >> sh_me"
fi
if [ $LOCAL -eq 1 ]; then
# set default to source stackrc
ssh -F $SSH_ENV stack@undercloud "echo 'source /home/stack/stackrc' >> ~/.bashrc"
if [ -f ~/.ssh/id_rsa.pub ]; then
# install my personal key on undercloud using key provided by quickstart
scp -F $SSH_ENV cat ~/.ssh/id_rsa.pub stack@undercloud:/home/stack/
ssh -F $SSH_ENV stack@undercloud "cat ~/id_rsa.pub >> ~/.ssh/authorized_keys"
else
# set a known password for the stack user
ssh -F $SSH_ENV stack@undercloud "sudo su -c \"echo abc123 | passwd --stdin stack\""
fi
# get local simple IP that either the local emacs tramp OR tunnel.sh can reach
ip=$(ssh -F $SSH_ENV stack@undercloud "/sbin/ip a | grep 192.168.23" | awk {'print $2'} | sed s/\\/24//g)
if [ -f ~/.emacs ]; then
# update tramp entry (assuming my .emacs only talks to 192.168.23.0/24 for underlap)
echo "updating local ~/.emacs"
sed -i -e s/192.168.23.[0-9]*/$ip/g ~/.emacs
else
echo "Undercloud IP for tunnel.sh is $ip"
fi
echo "Configuring SSH on undercloud to not warn about unknown hosts"
ssh -F $SSH_ENV stack@undercloud "cat /dev/null > ~/.ssh/config ; echo StrictHostKeyChecking\ no >> ~/.ssh/config ; echo UserKnownHostsFile=/dev/null >> ~/.ssh/config ; echo LogLevel\ ERROR >> ~/.ssh/config ; chmod 0600 ~/.ssh/config ; chmod 0700 ~/.ssh/"
fi