-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathVagrantfile
More file actions
85 lines (65 loc) · 1.71 KB
/
Vagrantfile
File metadata and controls
85 lines (65 loc) · 1.71 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "centos/7"
config.vm.box_check_update = false
config.vm.provision "shell", inline: <<-SHELL
echo "Disabling SELINUX"
sudo tee /etc/selinux/config <<-'EOF'
SELINUX=disabled
SELINUXTYPE=targeted
EOF
echo "Setting hostname"
sudo tee /etc/hostname <<-'EOF'
gt
EOF
echo "Updating"
yum update -y
echo "Getting Git"
yum install -y git
echo "Getting Go"
curl -o /tmp/go.tgz https://storage.googleapis.com/golang/go1.7.4.linux-amd64.tar.gz
echo "Extracting Go"
tar -C /usr/local -zxf /tmp/go.tgz
rm /tmp/go.tgz
echo "Setting up Go environment"
sudo tee /etc/profile.d/go.sh <<-'EOF'
export GOROOT=/usr/local/go
if [[ ${PATH} != *"${GOROOT}/bin"* ]]; then
export PATH=${PATH}:${GOROOT}/bin
fi
EOF
SHELL
config.vm.provision :reload
config.vm.provision "shell", inline: <<-SHELL
echo "Setting tutorial enviornment"
su - vagrant -c "git clone https://github.com/cmceniry/gotutorial.git tutorial"
tee /home/vagrant/.bashrc <<-'EOF'
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
export GOPATH=/home/vagrant/tutorial/workspace
EOF
chmod 0600 /home/vagrant/.bashrc
chown vagrant:vagrant /home/vagrant/.bashrc
sudo tee /home/vagrant/.bash_profile <<-'EOF'
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
if [ ! -e $HOME/tutorial ]; then
git clone https://github.com/cmceniry/gotutorial.git tutorial
fi
EOF
sudo chown vagrant:vagrant /home/vagrant/.bash_profile
sudo chmod 0600 /home/vagrant/.bash_profile
echo "Done"
SHELL
end