Switched vagrant for ~/git/vpp to /vpp
[vpp.git] / build-root / vagrant / Vagrantfile
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 Vagrant.configure(2) do |config|
5
6   # Pick the right distro and bootstrap, default is ubuntu1404
7   distro = ENV['VPP_VAGRANT_DISTRO']
8   if distro == 'centos7'
9     config.vm.box = "puppetlabs/centos-7.0-64-nocm"
10     config.vm.provision 'shell', path: 'bootstrap.centos7.sh'
11   else
12     config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
13     config.vm.provision 'shell', path: 'bootstrap.ubuntu1404.sh'
14   end
15
16   # Add .gnupg dir in so folks can sign patches
17   # Note, as gnupg puts socket files in that dir, we have
18   # to be cautious and make sure we are dealing with a plain file
19   homedir = File.expand_path("~/")
20   Dir["#{homedir}/.gnupg/**/*"].each do |fname|
21     if File.file?(fname)
22       destname = fname.sub(Regexp.escape("#{homedir}/"),'')
23       config.vm.provision "file", source: fname, destination: destname
24     end
25   end
26
27   # Copy in the .gitconfig if it exists
28   if File.file?(File.expand_path("~/.gitconfig"))
29     config.vm.provision  "file", source: "~/.gitconfig", destination: ".gitconfig"
30   end
31
32   # vagrant-cachier caches apt/yum etc to speed subsequent
33   # vagrant up
34   # to enable, run
35   # vagrant plugin install vagrant-cachier
36   #
37   if Vagrant.has_plugin?("vagrant-cachier")
38     config.cache.scope = :box
39   end
40
41   # Define some physical ports for your VMs to be used by DPDK
42   nics = 0
43   if ENV.key?('VPP_VAGRANT_NICS')
44     nics = ENV['VPP_VAGRANT_NICS'].to_i(10)
45   end
46   for i in 1..nics
47     config.vm.network "private_network", type: "dhcp"
48   end
49
50   # use http proxy if avaiable
51   if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
52    config.proxy.http     = "$http_proxy"
53    config.proxy.https    = "$https_proxy"
54    config.proxy.no_proxy = "localhost,127.0.0.1"
55   end
56
57   config.vm.synced_folder "../../", "/vpp", disabled: false
58   config.vm.provider "virtualbox" do |vb|
59     vb.memory = "4096"
60   end
61   config.vm.provider "vmware_fusion" do |fusion,override|
62     fusion.vmx["memsize"] = "4096"
63   end
64   config.vm.provider "vmware_workstation" do |vws,override|
65     vws.vmx["memsize"] = "8192"
66     vws.vmx["numvcpus"] = "4"
67   end
68 end