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