github.com/icebourg/terraform@v0.6.5-0.20151015205227-263cc1b85535/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  SRCROOT="/opt/go"
     9  SRCPATH="/opt/gopath"
    10  
    11  # Get the ARCH
    12  ARCH=`uname -m | sed 's|i686|386|' | sed 's|x86_64|amd64|'`
    13  
    14  # Install Prereq Packages
    15  sudo apt-get update
    16  sudo apt-get install -y build-essential curl git-core libpcre3-dev mercurial pkg-config zip
    17  
    18  # Install Go
    19  cd /tmp
    20  wget -q https://storage.googleapis.com/golang/go1.4.2.linux-${ARCH}.tar.gz
    21  tar -xf go1.4.2.linux-${ARCH}.tar.gz
    22  sudo mv go $SRCROOT
    23  sudo chmod 775 $SRCROOT
    24  sudo chown vagrant:vagrant $SRCROOT
    25  
    26  # Setup the GOPATH; even though the shared folder spec gives the working
    27  # directory the right user/group, we need to set it properly on the
    28  # parent path to allow subsequent "go get" commands to work.
    29  sudo mkdir -p $SRCPATH
    30  sudo chown -R vagrant:vagrant $SRCPATH 2>/dev/null || true
    31  # ^^ silencing errors here because we expect this to fail for the shared folder
    32  
    33  cat <<EOF >/tmp/gopath.sh
    34  export GOPATH="$SRCPATH"
    35  export GOROOT="$SRCROOT"
    36  export PATH="$SRCROOT/bin:$SRCPATH/bin:\$PATH"
    37  EOF
    38  sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh
    39  sudo chmod 0755 /etc/profile.d/gopath.sh
    40  source /etc/profile.d/gopath.sh
    41  SCRIPT
    42  
    43  Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    44    config.vm.box = "chef/ubuntu-12.04"
    45    config.vm.hostname = "terraform"
    46  
    47    config.vm.provision "shell", inline: $script, privileged: false
    48    config.vm.synced_folder '.', '/opt/gopath/src/github.com/hashicorp/terraform'
    49  
    50    ["vmware_fusion", "vmware_workstation"].each do |p|
    51      config.vm.provider p do |v|
    52        v.vmx["memsize"] = "4096"
    53        v.vmx["numvcpus"] = "2"
    54      end
    55    end
    56  end