Vagrantfile revision 58fda365
1# -*- mode: ruby -*-
2# vi: set ft=ruby :
3# Copyright (c) 2016 Intel Corporation
4
5Vagrant.configure(2) do |config|
6
7  # Pick the right distro and bootstrap, default is ubuntu1404
8  config.vm.box = "puppetlabs/ubuntu-14.04-64-nocm"
9  vmcpu=(ENV['VPP_VAGRANT_VMCPU'] || 8)
10  vmram=(ENV['VPP_VAGRANT_VMRAM'] || 16384)
11
12  # Define some physical ports for your VMs to be used by DPDK
13  config.vm.network "private_network", type: "dhcp"
14
15  config.vm.provision :shell, :path => File.join(File.dirname(__FILE__),"provision.sh") , privileged: false
16
17  # vagrant-cachier caches apt/yum etc to speed subsequent
18  # vagrant up
19  # to enable, run
20  # vagrant plugin install vagrant-cachier
21  #
22  if Vagrant.has_plugin?("vagrant-cachier")
23    config.cache.scope = :box
24  end
25
26  # use http proxy if avaiable
27  if ENV['http_proxy'] && Vagrant.has_plugin?("vagrant-proxyconf")
28   config.proxy.http     = ENV['http_proxy']
29   config.proxy.https    = ENV['https_proxy']
30   config.proxy.no_proxy = "localhost,127.0.0.1"
31  end
32
33  config.vm.provider :aws do |aws, override|
34      #disable any corporate proxies in the AWS cloud
35      if Vagrant.has_plugin?("vagrant-proxyconf")
36         override.proxy.enabled = false
37      end
38
39      #Use rsync instead of nfs to sync folders.
40      override.vm.synced_folder ".", "/vagrant", type: "rsync",
41         rsync__exclude: ".git/"
42
43      #We don't need a local box, use the vagrant-aws dummy instead
44      override.vm.box = "dummy"
45
46      #These are the credentials required to access AWS Instructure.
47      #vagrant-aws requires these to create the new instance.
48      #These can either be your AWS root account access key (not recommended)
49      #or an IAM user with sufficent rights to create EC2 instances.
50      aws.access_key_id = "abcdefg"
51      aws.secret_access_key = "abcdefg"
52
53      #Your preferred region, Ireland is always a good choice.
54      aws.region = "eu-west-1"
55
56      #The EC2 keypair used to provision remote access creds in the
57      #newly created EC2 instance. These creds permit remote access via ssh.
58      aws.keypair_name = "ec2"
59
60      #Security groups (ACLs) to provision new EC2 instance with.
61      #At least one of the security groups should allow SSH.
62      #to enable `vagrant ssh` to work.
63      aws.security_groups = [ "permit-ssh", "default" ]
64
65      #Amazon Machine Instance (AMI) to use, default is Ubuntu Trusty (HVM).
66      aws.ami = "ami-0c59f37f"
67
68      #EC2 instance type (how much cpu/mem resources to give the instance).
69      aws.instance_type = "t2.micro"
70
71      #Any proxy command required for ssh to workaround corporate firewalls
72      #override.ssh.proxy_command = "nc -x proxy.com:1080 %h %p"
73
74      #Ubuntu AMIs use ubuntu as the default username, not vagrant.
75      override.ssh.username = "ubuntu"
76
77      #Private key to access new EC2 instance via SSH, should be the private
78      #key from the keypair_name created above.
79      override.ssh.private_key_path = "/root/private_key.pem"
80  end
81  config.vm.provider "virtualbox" do |vb|
82      vb.name = "vpp-bootstrap"
83
84      vb.customize ["modifyvm", :id, "--ioapic", "on"]
85      vb.memory = "#{vmram}"
86      vb.cpus = "#{vmcpu}"
87
88      vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.1", "1"]
89      vb.customize ["setextradata", :id, "VBoxInternal/CPUM/SSE4.2", "1"]
90  end
91  config.vm.provider "vmware_fusion" do |fusion,override|
92    fusion.vmx["memsize"] = "#{vmram}"
93    fusion.vmx["numvcpus"] = "#{vmcpu}"
94  end
95  config.vm.provider "libvirt" do |lv|
96    lv.memory = "#{vmram}"
97    lv.cpus = "#{vmcpu}"
98  end
99  config.vm.provider "vmware_workstation" do |vws,override|
100    vws.vmx["memsize"] = "#{vmram}"
101    vws.vmx["numvcpus"] = "#{vmcpu}"
102  end
103end
104