github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/Vagrantfile (about) 1 # -*- mode: ruby -*- 2 # vi: set ft=ruby : 3 4 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 VAGRANTFILE_API_VERSION = "2" 6 7 $script = <<SCRIPT 8 GOVERSION="1.5.1" 9 SRCROOT="/opt/go" 10 SRCPATH="/opt/gopath" 11 12 # Get the ARCH 13 ARCH=`uname -m | sed 's|i686|386|' | sed 's|x86_64|amd64|'` 14 15 # Install Prereq Packages 16 sudo apt-get update 17 sudo apt-get upgrade -y 18 sudo apt-get install -y build-essential curl git-core libpcre3-dev mercurial pkg-config zip 19 20 # Install Go 21 cd /tmp 22 wget --quiet https://storage.googleapis.com/golang/go${GOVERSION}.linux-${ARCH}.tar.gz 23 tar -xvf go${GOVERSION}.linux-${ARCH}.tar.gz 24 sudo mv go $SRCROOT 25 sudo chmod 775 $SRCROOT 26 sudo chown vagrant:vagrant $SRCROOT 27 28 # Setup the GOPATH; even though the shared folder spec gives the working 29 # directory the right user/group, we need to set it properly on the 30 # parent path to allow subsequent "go get" commands to work. 31 sudo mkdir -p $SRCPATH 32 sudo chown -R vagrant:vagrant $SRCPATH 2>/dev/null || true 33 # ^^ silencing errors here because we expect this to fail for the shared folder 34 35 cat <<EOF >/tmp/gopath.sh 36 export GOPATH="$SRCPATH" 37 export GOROOT="$SRCROOT" 38 export PATH="$SRCROOT/bin:$SRCPATH/bin:\$PATH" 39 EOF 40 sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh 41 sudo chmod 0755 /etc/profile.d/gopath.sh 42 source /etc/profile.d/gopath.sh 43 SCRIPT 44 45 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 46 config.vm.box = "bento/ubuntu-12.04" 47 config.vm.hostname = "terraform" 48 49 config.vm.provision "shell", inline: $script, privileged: false 50 config.vm.synced_folder '.', '/opt/gopath/src/github.com/hashicorp/terraform' 51 52 ["vmware_fusion", "vmware_workstation"].each do |p| 53 config.vm.provider p do |v| 54 v.vmx["memsize"] = "4096" 55 v.vmx["numvcpus"] = "2" 56 end 57 end 58 59 config.vm.provider "virtualbox" do |v| 60 v.memory = 4096 61 v.cpus = 2 62 end 63 end