Skip to main content

Vagrant Hands on

Vagrant Hands on
  1. Vagrant installation and Configuration
  1. Installation of Vagrant
  • apt-get install vagrant
  1. Default hypervisor is virtualbox, wants to change libvirt/kvm hypervisor needs to do the following steps        
  1. Install vagrant mutate and vagrant libvirt plugin
  • vagrant plugin install vagrant-mutate
  •  vagrant plugin install vagrant-libvirt
  1. Add the virtualbox image into vagrant
  •  vagrant box add ubuntu/trusty64
  1. Convert virtualbox image into vagrant libvirt box
  •  vagrant mutate ubuntu/trusty64 libvirt
  1.  Vagrant box list      
ubuntu/trusty64 (libvirt, 20170613.0.0)
ubuntu/trusty64 (virtualbox, 20170613.0.0)

  1. Working on Vagrant
  1. vagrant init
  2. vim Vagrantfile
        Libvirt+ovs configuration
# -*- mode: ruby -*-
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'libvirt'
vagrant.configure("2") do |config|
  config.vm.define :devstack do |machine|
    machine.vm.box = "ubuntu/trusty64"
    machine.vm.network :public_network,
                       :dev=> "br-eth0",
                       :ovs=>true ,
                       :type=>"bridge",
                       :use_dhcp_assigned_default_route=>true        
    machine.vm.provider :libvirt do |setting|
      setting.memory = 2048
      setting.cpus = 2
    end
  end
end
 3) vagrant up --provider=libvirt
Reference:
========
3) Vagrant Patch update
Create a file => vagrant-plugin.patch
---
 lib/vagrant/bundler.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb
index 5a5c185..c4a3837 100644
--- a/lib/vagrant/bundler.rb
+++ b/lib/vagrant/bundler.rb
@@ -272,7 +272,6 @@ module Vagrant
       # Reset the all specs override that Bundler does
       old_all = Gem::Specification._all
-      Gem::Specification.all = nil
       # /etc/gemrc and so on.
       old_config = nil
@@ -286,6 +285,8 @@ module Vagrant
       end
       Gem.configuration = NilGemConfig.new
+      Gem::Specification.reset
+
       # Use a silent UI so that we have no output
       Gem::DefaultUserInteraction.use_ui(Gem::SilentUI.new) do
     return yield
2) sudo patch --directory /usr/lib/ruby/vendor_ruby/vagrant < vagrant-plugin.patch
3) Now install vagrant plugin

Comments