This repository has been archived by the owner on Nov 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vagrantfile
67 lines (52 loc) · 2.08 KB
/
Vagrantfile
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
$provision_root = <<'SCRIPT_ROOT'
echo "deb http://packages.cloud.google.com/apt cloud-sdk-bionic main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
apt-get update
apt-get upgrade -y
apt-get install -y build-essential docker.io git google-cloud-sdk jq libltdl-dev python3-pip whois
apt-get autoremove -y
usermod -aG docker vagrant
SCRIPT_ROOT
$provision_user = <<'SCRIPT_USER'
mkdir -p ${HOME}/local
mkdir -p ${HOME}/golang/src
ln -s /vagrant/network ${HOME}/golang/src
cd
wget --quiet https://redirector.gvt1.com/edgedl/go/go1.10.3.linux-amd64.tar.gz
tar -xf go1.10.3.linux-amd64.tar.gz
mv go ${HOME}/local/
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go
pip3 install --user ansible
pip3 install --user apache-libcloud
pip3 install --user boto
pip3 install --user boto3
pip3 install --user docker-compose
pip3 install --user google-api-python-client
pip3 install --user softlayer
cat <<'EOF_BASHRC' > $HOME/.bashrc
export GOROOT=${HOME}/local/go
export GOPATH=${HOME}/golang
export PATH=${GOROOT}/bin:${HOME}/local/bin:${HOME}/.local/bin:${PATH}
cd /vagrant
EOF_BASHRC
SCRIPT_USER
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provision :shell, inline: $provision_root
config.vm.provision :shell, privileged: false, inline: $provision_user
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--name", "fabric"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
vb.customize ["modifyvm", :id, "--memory", "4096"]
end
config.vm.hostname = "fabric"
if File.exists?(File.expand_path("~/.gitconfig"))
config.vm.provision "file", source: "~/.gitconfig", destination: "~/.gitconfig"
end
if File.exists?(File.expand_path("~/.vimrc"))
config.vm.provision "file", source: "~/.vimrc", destination: "~/.vimrc"
end
end