2013-03-12 17:33:00 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2013-03-27 00:57:47 +00:00
|
|
|
def local_apt_cache(box_name)
|
2013-03-12 17:33:00 +00:00
|
|
|
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
|
|
|
|
|
2013-03-27 00:57:47 +00:00
|
|
|
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
|
|
|
|
|
2013-03-29 16:31:57 +00:00
|
|
|
# Required to make sure vagrant picks it up during development
|
2013-03-12 17:33:00 +00:00
|
|
|
Vagrant.require_plugin 'vagrant-lxc'
|
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
config.vm.box = "quantal64"
|
|
|
|
|
2013-03-30 19:40:33 +00:00
|
|
|
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root'
|
2013-03-12 17:33:00 +00:00
|
|
|
|
2013-03-27 00:57:47 +00:00
|
|
|
cache_dir = local_apt_cache(config.vm.box)
|
2013-03-30 19:40:33 +00:00
|
|
|
config.vm.synced_folder cache_dir, "/var/cache/apt/archives", id: "vagrant-apt-cache"
|
2013-03-27 00:57:47 +00:00
|
|
|
|
|
|
|
cache_dir = local_gem_cache(config.vm.box)
|
2013-03-30 19:40:33 +00:00
|
|
|
config.vm.synced_folder cache_dir, "/home/vagrant/gems/cache", id: "vagrant-gem-cache"
|
2013-03-12 17:33:00 +00:00
|
|
|
|
|
|
|
config.vm.define :vbox do |vb_config|
|
|
|
|
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|
|
2013-03-27 00:56:52 +00:00
|
|
|
# Configure VM to use 1.5gb of ram and 2 cpus
|
2013-03-12 17:33:00 +00:00
|
|
|
vb.customize [
|
|
|
|
"modifyvm", :id,
|
|
|
|
"--memory", '1536',
|
2013-03-27 00:56:52 +00:00
|
|
|
"--cpus", '2'
|
2013-03-12 17:33:00 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
config.vm.define :lxc do |lxc_config|
|
|
|
|
lxc_config.vm.hostname = 'lxc-dev-box'
|
2013-03-29 16:31:57 +00:00
|
|
|
lxc_config.vm.box_url = 'http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-03-26.box'
|
2013-03-27 05:52:41 +00:00
|
|
|
# Uncomment to test boxes built locally:
|
|
|
|
# lxc_config.vm.box_url = '../boxes/output/lxc-quantal64.box'
|
2013-03-12 17:33:00 +00:00
|
|
|
|
|
|
|
lxc_config.vm.provider :lxc do |lxc|
|
|
|
|
# Required to boot nested containers
|
|
|
|
lxc.start_opts << 'lxc.aa_profile=unconfined'
|
2013-03-29 16:31:57 +00:00
|
|
|
# Change this to override the path where the rootfs gets stored
|
|
|
|
# lxc.target_rootfs_path = '/path/to/vagrant-lxc-dev-box-rootfs'
|
2013-03-12 17:33:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-27 00:56:52 +00:00
|
|
|
config.vm.provision :shell, :path => 'shell-provisioning/upgrade-kernel'
|
|
|
|
|
2013-03-12 17:33:00 +00:00
|
|
|
config.vm.provision :puppet do |puppet|
|
|
|
|
puppet.manifests_path = "."
|
|
|
|
puppet.manifest_file = "site.pp"
|
|
|
|
puppet.options << [ '--verbose', '--debug' ]
|
|
|
|
end
|
|
|
|
end
|