-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathocp4-master
More file actions
52 lines (43 loc) · 1.82 KB
/
ocp4-master
File metadata and controls
52 lines (43 loc) · 1.82 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
cat <<EOF >>/etc/bashrc
PS1='[\u@bastion-'$cluster' \W]\$ '
EOF
dnf install -y docker wget
systemctl enable --now docker
# install awscli2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
unzip -o /tmp/awscliv2.zip -d /tmp >/dev/null
/tmp/aws/install
ln -s /usr/local/bin/aws /usr/bin/aws
eval $(ssh-agent)
cd /tmp
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$ocp4_version/openshift-install-linux-$ocp4_version.tar.gz
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.15.38/openshift-client-linux-4.15.38.tar.gz
tar xzf openshift-install-linux-$ocp4_version.tar.gz
tar xzf openshift-client-linux-4.15.38.tar.gz
mv openshift-install oc kubectl /usr/bin
rm -f openshift-install-linux-$ocp4_version.tar.gz openshift-client-linux-$ocp4_version.tar.gz
mkdir /root/ocp4
cd /root/ocp4
while [ ! -f "/tmp/ocp4-install-config.yaml" ]; do sleep 5; done
cp /tmp/ocp4-install-config.yaml /root/ocp4/install-config.yaml
echo "cd /root/ocp4 ; openshift-install destroy cluster" >> /px-deploy/platform-delete/ocp4.sh
openshift-install create cluster --log-level=debug
if [ $? -ne 0 ]; then
echo Failed to deploy Openshift
exit 1
fi
mkdir /root/.kube
cp /root/ocp4/auth/kubeconfig /root/.kube/config
chmod 600 /root/.kube/config
aws configure set default.region $aws_region
URL=$(grep 'Access the OpenShift web-console' /root/ocp4/.openshift_install.log |cut -d\" -f4 | cut -d: -f2-)
echo "url $URL" >> /var/log/px-deploy/completed/tracking
CRED=$(grep 'Login to the console' /root/ocp4/.openshift_install.log | cut -d\\ -f4 | cut -d\" -f2)
echo "cred $CRED" >> /var/log/px-deploy/completed/tracking
cat <<EOF >> /etc/motd
+================================================+
OCP4 Web UI: $URL
Admin User Name: kubeadmin
Password: $CRED
+================================================+
EOF