-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu-18.04-kickstart.sh
75 lines (59 loc) · 2.35 KB
/
ubuntu-18.04-kickstart.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
72
73
74
75
#!/usr/bin/env bash
set -e
echo "---------------------Check OS and version---------------------"
os_version=$(lsb_release -a | grep Description | awk '{ print $2}')
if [[ $os_version -ne 'Ubuntu' ]]
then
echo "---------------------This script is for Ubuntu only---------------------"
exit 1
fi
echo "---------------------Os OK. Cheking version---------------------"
os_number=$(lsb_release -a | grep Release | awk '{ print $2}')
if [[ $os_number != 18.04 ]]
then
echo "---------------------Your ubuntu version is not 18.04---------------------"
echo "---------------------That may corrupt your environment setup---------------------"
fi
echo "---------------------Remove current box---------------------"
vbox=$(vagrant box list | grep 'centos/7' | wc -l)
if [[ $vbox -ne 0 ]]
then
vagrant box remove centos/7
fi
echo "---------------------Remove current vagrant---------------------"
apt purge -y vagrant
apt autoremove -y
apt update -y
echo "---------------------Remove current ansible---------------------"
apt purge -y ansible
apt autoremove -y
apt update -y
echo "---------------------Install Vagrant---------------------"
wget -c https://releases.hashicorp.com/vagrant/2.0.3/vagrant_2.0.3_x86_64.deb
sudo dpkg -i vagrant_2.0.3_x86_64.deb
echo "---------------------Install vagrant-vbox plugin---------------------"
vagrant plugin install vagrant-vbguest
echo "---------------------Install latest virtualbox---------------------"
apt install -y virtualbox-qt virtualbox-guest-utils
apt update
# LatestVirtualBoxVersion=$(wget -qO - http://download.virtualbox.org/virtualbox/LATEST.TXT)
wget "http://download.virtualbox.org/virtualbox/5.2.18/Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack"
VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.2.18.vbox-extpack
echo "---------------------Install ansible---------------------"
apt update
apt install -y software-properties-common
apt-add-repository -y ppa:ansible/ansible
pip3 install ansible==2.6.4 && pip3 install netaddr==0.7.19
echo "---------------------Remove downloaded archives---------------------"
vbox=$(ls | grep Oracle_VM_VirtualBox | wc -l)
if [[ $vbox -ne 0 ]]
then
rm Oracle_VM_VirtualBox_*
fi
vbox=$(ls | grep vagrant_ | wc -l)
if [[ $vbox -ne 0 ]]
then
rm vagrant_*
fi
echo "---------------------Done---------------------"
echo "Now you can start vagrant by typing 'vagrant up'"