forked from gshipley/installcentos
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-openshift.sh
More file actions
executable file
·104 lines (77 loc) · 3 KB
/
Copy pathinstall-openshift.sh
File metadata and controls
executable file
·104 lines (77 loc) · 3 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
#!/bin/bash
## see: https://www.youtube.com/watch?v=-OOnGK-XeVY
export DOMAIN=${DOMAIN:="$(curl ipinfo.io/ip).nip.io"}
export USERNAME=${USERNAME:="$(whoami)"}
export PASSWORD=${PASSWORD:=password}
export VERSION=${VERSION:="v3.7.1"}
export SCRIPT_REPO=${SCRIPT_REPO:="https://raw.githubusercontent.com/gshipley/installcentos/master"}
export IP="$(ip route get 8.8.8.8 | awk '{print $NF; exit}')"
echo "******"
echo "* Your domain is $DOMAIN "
echo "* Your username is $USERNAME "
echo "* Your password is $PASSWORD "
echo "* OpenShift version: $VERSION "
echo "******"
yum install -y epel-release
yum install -y git wget zile nano net-tools docker \
python-cryptography pyOpenSSL.x86_64 python2-pip \
openssl-devel python-devel httpd-tools NetworkManager python-passlib \
java-1.8.0-openjdk-headless "@Development Tools"
systemctl | grep "NetworkManager.*running"
if [ $? -eq 1 ]; then
systemctl start NetworkManager
systemctl enable NetworkManager
fi
which ansible || pip install -Iv ansible
[ ! -d openshift-ansible ] && git clone https://github.com/openshift/openshift-ansible.git
cd openshift-ansible && git fetch && git checkout release-3.7 && cd ..
cat <<EOD > /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
${IP} $(hostname) console console.${DOMAIN}
EOD
if [ -z $DISK ]; then
echo "Not setting the Docker storage."
else
cp /etc/sysconfig/docker-storage-setup /etc/sysconfig/docker-storage-setup.bk
echo DEVS=$DISK > /etc/sysconfig/docker-storage-setup
echo VG=DOCKER >> /etc/sysconfig/docker-storage-setup
echo SETUP_LVM_THIN_POOL=yes >> /etc/sysconfig/docker-storage-setup
echo DATA_SIZE="100%FREE" >> /etc/sysconfig/docker-storage-setup
systemctl stop docker
rm -rf /var/lib/docker
wipefs --all $DISK
docker-storage-setup
fi
systemctl restart docker
systemctl enable docker
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -q -f ~/.ssh/id_rsa -N ""
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh -o StrictHostKeyChecking=no root@$IP "pwd" < /dev/null
fi
export METRICS="True"
export LOGGING="True"
memory=$(cat /proc/meminfo | grep MemTotal | sed "s/MemTotal:[ ]*\([0-9]*\) kB/\1/")
if [ "$memory" -lt "4194304" ]; then
export METRICS="False"
fi
if [ "$memory" -lt "8388608" ]; then
export LOGGING="False"
fi
curl -o inventory.download $SCRIPT_REPO/inventory.ini
envsubst < inventory.download > inventory.ini
ansible-playbook -i inventory.ini openshift-ansible/playbooks/byo/config.yml
htpasswd -b /etc/origin/master/htpasswd ${USERNAME} ${PASSWORD}
oc adm policy add-cluster-role-to-user cluster-admin ${USERNAME}
systemctl restart origin-master-api
echo "******"
echo "* Your conosle is https://console.$DOMAIN:8443"
echo "* Your username is $USERNAME "
echo "* Your password is $PASSWORD "
echo "*"
echo "* Login using:"
echo "*"
echo "$ oc login -u ${USERNAME} -p ${PASSWORD} https://console.$DOMAIN:8443/"
echo "******"
oc login -u ${USERNAME} -p ${PASSWORD} https://console.$DOMAIN:8443/