Break out install.sh from build.sh
[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.2-64-nocm"
10   else
11     config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
12   end
13
14   config.vm.provision :shell, :path => "update.sh"
15   config.vm.provision :shell, :path => "build.sh", :args => "/vpp vagrant"
16   config.vm.provision :shell, :path => "install.sh", :args => "/vpp"
17   config.vm.provision :shell, :path => "clearinterfaces.sh"
18   config.vm.provision :shell, :path => "run.sh"
19
20   # Add .gnupg dir in so folks can sign patches
21   # Note, as gnupg puts socket files in that dir, we have
22   # to be cautious and make sure we are dealing with a plain file
23   homedir = File.expand_path("~/")
24   Dir["#{homedir}/.gnupg/**/*"].each do |fname|
25     if File.file?(fname)
26       destname = fname.sub(Regexp.escape("#{homedir}/"),'')
27       config.vm.provision "file", source: fname, destination: destname
28     end
29   end
30
31   # Copy in the .gitconfig if it exists
32   if File.file?(File.expand_path("~/.gitconfig"))
33     config.vm.provision  "file", source: "~/.gitconfig", destination: ".gitconfig"
34   end
35
36   # vagrant-cachier caches apt/yum etc to speed subsequent
37   # vagrant up
38   # to enable, run
39   # vagrant plugin install vagrant-cachier
40   #
41   if Vagrant.has_plugin?("vagrant-cachier")
42     config.cache.scope = :box
43   end
44
45   # Define some physical ports for your VMs to be used by DPDK
46   nics = 2
47   if ENV.key?('VPP_VAGRANT_NICS')
48     nics = ENV['VPP_VAGRANT_NICS'].to_i(10)
49   end
50   for i in 1..nics
51     config.vm.network "private_network", type: "dhcp"
52   end
53
54   # use http proxy if avaiable
55   if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
56    config.proxy.http     = ENV['http_proxy']
57    config.proxy.https    = ENV['https_proxy']
58    config.proxy.no_proxy = "localhost,127.0.0.1"
59   end
60
61   config.vm.synced_folder "../../", "/vpp", disabled: false
62   config.vm.provider "virtualbox" do |vb|
63       vb.customize ["modifyvm", :id, "--ioapic", "on"]
64       vb.memory = 4096
65       vb.cpus = 2
66   end
67   config.vm.provider "vmware_fusion" do |fusion,override|
68     fusion.vmx["memsize"] = "4096"
69   end
70   config.vm.provider "libvirt" do |lv|
71     lv.memory = 4096
72     lv.cpus = 8
73   end
74   config.vm.provider "vmware_workstation" do |vws,override|
75     vws.vmx["memsize"] = "8192"
76     vws.vmx["numvcpus"] = "4"
77   end
78 end