Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.
To achieve its magic, Vagrant stands on the shoulders of giants. Machines are provisioned on top of VirtualBox, VMware, AWS, or any other provider. Then, industry-standard provisioning tools such as shell scripts, Chef, or Puppet, can be used to automatically install and configure software on the machine.
Installation
We need to install these prerequisites in order to install VirtualBox in the desired version:
# -*- mode: ruby -*-# vi: set ft=ruby :ENV['LANG']='C'# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!VAGRANTFILE_API_VERSION="2"# Insert all your Vms with configsboxes=[{:name=>:mon1,:role=>'mon'},{:name=>:mon2,:role=>'mon'},{:name=>:mon3,:role=>'mon'},{:name=>:osd1,:role=>'osd',:ip=>'192.168.33.31'},{:name=>:osd2,:role=>'osd',:ip=>'192.168.33.32'},{:name=>:osd3,:role=>'osd',:ip=>'192.168.33.33'},]$install=<<INSTALLwget -q -O- 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudo apt-key add -echo deb http://ceph.com/debian/ $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph.listaptitude updateaptitude -y install ceph ceph-deploy openntpdINSTALLVagrant::Config.rundo|config|# Default box OSvm_default=procdo|boxcnf|boxcnf.vm.box="deimosfr/debian-wheezy"end# For each VM, add a public and private card. Then install Cephboxes.eachdo|opts|vm_default.call(config)config.vm.defineopts[:name]do|config|config.vm.network:bridged,:bridge=>"eth0"config.vm.host_name="%s.vm"%opts[:name].to_sconfig.vm.provision"shell",inline:$install# Create 8G disk file and add private interface for OSD VMsifopts[:role]=='osd'config.vm.network:hostonly,opts[:ip]file_to_disk='osd-disk_'+opts[:name].to_s+'.vdi'config.vm.customize['createhd','--filename',file_to_disk,'--size',8*1024]config.vm.customize['storageattach',:id,'--storagectl','SATA','--port',1,'--device',0,'--type','hdd','--medium',file_to_disk]endendendend
To boot them, simply "vagrant up".
Conclusion
I've written here basic commands as an introduction but you can do more than that with Vagrant. Read the documentation for more information.
FAQ
VirtualBox is complaining that the kernel module is not loaded
If you got this kind of error message while doing a "vagrant up" command: