116 lines
3.9 KiB
Ruby
116 lines
3.9 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
def local_apt_cache(box_name)
|
|
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
|
'cache',
|
|
'apt',
|
|
box_name)
|
|
partial_dir = File.join(cache_dir, 'partial')
|
|
FileUtils.mkdir_p(partial_dir) unless File.exists? partial_dir
|
|
cache_dir
|
|
end
|
|
|
|
def local_gem_cache(box_name)
|
|
cache_dir = File.join(File.expand_path(Vagrant::Environment::DEFAULT_HOME),
|
|
'cache',
|
|
'gems',
|
|
'source',
|
|
box_name)
|
|
FileUtils.mkdir_p(cache_dir) unless File.exists? cache_dir
|
|
cache_dir
|
|
end
|
|
|
|
# Required to make sure vagrant picks it up during development
|
|
Vagrant.require_plugin 'vagrant-lxc'
|
|
|
|
Vagrant.configure("2") do |config|
|
|
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root', nfs: true
|
|
|
|
config.vm.define :vbox do |vb_config|
|
|
vb_config.vm.network :private_network, ip: "192.168.50.33"
|
|
vb_config.vm.box = 'quantal64'
|
|
vb_config.vm.box_url = "https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box"
|
|
vb_config.vm.hostname = 'vbox'
|
|
|
|
vb_config.vm.provider :virtualbox do |vb|
|
|
# Configure VM to use 1.5gb of ram and 2 cpus
|
|
vb.customize [
|
|
"modifyvm", :id,
|
|
"--memory", '1536',
|
|
"--cpus", '2'
|
|
]
|
|
end
|
|
|
|
cache_dir = local_apt_cache(vb_config.vm.box)
|
|
vb_config.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache"
|
|
|
|
cache_dir = local_gem_cache(vb_config.vm.box)
|
|
vb_config.vm.synced_folder cache_dir, "/home/vagrant/gems/cache", id: "vagrant-gem-cache"
|
|
end
|
|
|
|
config.vm.define :precise do |precise|
|
|
precise.vm.network :private_network, ip: "192.168.50.32"
|
|
precise.vm.box = 'precise64'
|
|
precise.vm.hostname = 'vbox'
|
|
precise.vm.box_url = 'http://files.vagrantup.com/precise64.box'
|
|
|
|
precise.vm.provider :virtualbox do |vb|
|
|
# Configure VM to use 1.5gb of ram and 2 cpus
|
|
vb.customize [
|
|
"modifyvm", :id,
|
|
"--memory", '1536',
|
|
"--cpus", '2'
|
|
]
|
|
end
|
|
|
|
cache_dir = local_apt_cache(precise.vm.box)
|
|
precise.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache"
|
|
|
|
cache_dir = local_gem_cache(precise.vm.box)
|
|
precise.vm.synced_folder cache_dir, "/home/vagrant/gems/cache", id: "vagrant-gem-cache"
|
|
end
|
|
|
|
config.vm.define :raring do |raring|
|
|
raring.vm.network :private_network, ip: "192.168.50.34"
|
|
raring.vm.box = 'raring64'
|
|
raring.vm.hostname = 'vbox'
|
|
raring.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
|
|
|
|
raring.vm.provider :virtualbox do |vb|
|
|
# Configure VM to use 1.5gb of ram and 2 cpus
|
|
vb.customize [
|
|
"modifyvm", :id,
|
|
"--memory", '1536',
|
|
"--cpus", '2'
|
|
]
|
|
end
|
|
|
|
cache_dir = local_apt_cache(raring.vm.box)
|
|
raring.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache"
|
|
|
|
cache_dir = local_gem_cache(raring.vm.box)
|
|
raring.vm.synced_folder cache_dir, "/home/vagrant/gems/cache", id: "vagrant-gem-cache"
|
|
end
|
|
|
|
config.vm.define :lxc do |lxc_config|
|
|
lxc_config.vm.box = 'quantal64'
|
|
lxc_config.vm.hostname = 'lxc-dev-box'
|
|
lxc_config.vm.box_url = 'http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-04-21.box'
|
|
# Uncomment to test boxes built locally:
|
|
# lxc_config.vm.box_url = '../boxes/output/lxc-quantal64.box'
|
|
|
|
lxc_config.vm.provider :lxc do |lxc|
|
|
# Required to boot nested containers
|
|
lxc.customize 'aa_profile', 'unconfined'
|
|
end
|
|
end
|
|
|
|
config.vm.provision :shell, :path => 'shell-provisioning/upgrade-kernel'
|
|
|
|
config.vm.provision :puppet do |puppet|
|
|
puppet.manifests_path = "."
|
|
puppet.manifest_file = "site.pp"
|
|
puppet.options << [ '--verbose', '--debug' ]
|
|
end
|
|
end
|