-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·152 lines (108 loc) · 5.01 KB
/
install.sh
File metadata and controls
executable file
·152 lines (108 loc) · 5.01 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
#!/bin/bash
# This is only to be used as a prep for the Pure Test Drive Environment
# Brian Kuebler 4/17/20
# Install necessary packages, only python2 installed
echo "#####################################"
APACKG=( epel-release python3 python3-pip centos-release-ansible-29 ansible vim python2-jmespath )
echo "#### Installing Python3 and Ansible ####"
for pkg in "${APACKG[@]}";do
if yum -q list installed "$pkg" > /dev/null 2>&1; then
echo -e "$pkg is already installed"
else
yum install "$pkg" -y && echo "Successfully installed $pkg"
fi
done
# Install SDK
echo "#### Installing the Pure Storage SDK ####"
pip3 install purestorage
pip3 install jmespath
# Install the Pure Storage collection
echo "#### Installing the Purestorage Ansible Collection ####"
ansible-galaxy collection install purestorage.flasharray
echo "#### Making VIM feel right ####"
cat << 'EOF' >> ~/.vimrc
set incsearch " search as characters are entered
set hlsearch " highlight matches
colo torte " set colorscheme
syntax on " syntax highlighing on
set expandtab " tabs are spaces
set softtabstop=4 " number of spaces in tab when editing
set tabstop=4 " number of visual spaces per TAB
EOF
# We need to change the hostname of this host. Note that it's "linux" on the FA
# and it's "Linux" on the host.
echo "#### Changing hostname ####"
echo "linux" > /etc/hostname
systemctl restart systemd-hostnamed
sleep 3
HNAME=$(hostname)
for lname in 'linux';do
if [ "$HNAME" = "$lname" ]; then
echo "Hostname is linux, matches FlashArray."
else
echo "Hostname still needs to be changed!"
fi
done
#systemctl restart multipathd
#/usr/sbin/multipath -r
# Save a second and create a mount point in /mnt - Actually, Ansible will create the mount point.
# mkdir /mnt/ansible-src
# Typing "ansible-playbook" everytime is a hassle...
echo "" >> ~/.bashrc
echo "alias ap='ansible-playbook'" >> ~/.bashrc
echo "alias P='cd ~/newstack_testdrive/ansible_playbooks'" >> ~/.bashrc
source ~/.bashrc
# Should be able to remove this after 1.23 is released
# Don't need this anymore
#v ~/.ansible/collections/ansible_collections/purestorage/flasharray/plugins/modules/purefa_pod.py ~/purefa_pod.orig
#cp ~/newstack_testdrive/purefa_pod.py ~/.ansible/collections/ansible_collections/purestorage/flasharray/plugins/modules/
#generate an ssh key for local login:
echo "#### Generate SSH keys on local install ####"
ssh-keygen -t rsa -N '' -q -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
#clone required repositories
echo "#### Clone kubespray repo and copy inventory in to repo ####"
git clone https://github.com/kubernetes-sigs/kubespray ~/kubespray
cp -rfv ~/newstack_testdrive/inventory/testdrive ~/kubespray/inventory/
cd ~/kubespray
# Install prereqs as we now have pip3
echo "#### Install kubespray prereqs ####"
pip3 install -r requirements.txt
# Install kubernetes
echo "#### Install kubernetes ####"
ansible-playbook -i inventory/testdrive/inventory.ini cluster.yml -b
# Move to beta API for snapshot provider:
# Remove old API
#kubectl delete crd volumesnapshotcontents.snapshot.storage.k8s.io
#kubectl delete crd volumesnapshots.snapshot.storage.k8s.io
#kubectl delete crd volumesnapshotclasses.snapshot.storage.k8s.io
# Recreate CRD with Beta release
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-2.0/config/crd/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-2.0/config/crd/snapshot.storage.k8s.io_volumesnapshotcontents.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-2.0/config/crd/snapshot.storage.k8s.io_volumesnapshots.yaml
#Add the snap controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-2.0/deploy/kubernetes/snapshot-controller/rbac-snapshot-controller.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-csi/external-snapshotter/release-2.0/deploy/kubernetes/snapshot-controller/setup-snapshot-controller.yaml
sleep 15
#Install PSO
echo "#### Update helm repos and install PSO ####"
helm repo add pure https://purestorage.github.io/pso-csi
helm repo update
helm install pure-storage-driver pure/pure-pso --namespace default -f ~/newstack_testdrive/kubernetes_yaml/pso_values.yaml
sleep 30
#Install the purestorage snapshot class
kubectl apply -f https://raw.githubusercontent.com/purestorage/pso-csi/master/pure-pso/snapshotclass.yaml
# We need to change the hostname of this host. Note that it's "linux" on the FA
# and it's "Linux" on the host. It was changed by kubespray.
echo "#### Changing hostname ####"
echo "linux" > /etc/hostname
systemctl restart systemd-hostnamed
sleep 3
HNAME=$(hostname)
for lname in 'linux';do
if [ "$HNAME" = "$lname" ]; then
echo "Hostname is linux, matches FlashArray."
else
echo "Hostname still needs to be changed!"
fi
done