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