vagrant-lxc-ng/development/Vagrantfile

91 lines
2.6 KiB
Text
Raw Normal View History

# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'pathname'
BASE_URL = 'http://dl.dropbox.com/u/13510779'
2013-05-08 18:41:38 +00:00
LAST_RELEASE_DATE = '2013-05-08'
LOCAL_BOXES_PATH = Pathname('../boxes/output').expand_path
def lxc_box_url(release_name)
file_name = "lxc-#{release_name}-amd64-#{LAST_RELEASE_DATE}.box"
local_box_file = LOCAL_BOXES_PATH.join(file_name)
local_box_file.exist? ?
local_box_file.to_s :
"#{BASE_URL}/#{file_name}"
end
BOXES = {
precise: {
lxc_url: lxc_box_url('precise'),
vbox_url: 'http://files.vagrantup.com/precise64.box'
},
quantal: {
lxc_url: lxc_box_url('quantal'),
vbox_url: 'https://github.com/downloads/roderik/VagrantQuantal64Box/quantal64.box'
},
raring: {
lxc_url: lxc_box_url('raring'),
vbox_url: 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
},
squeeze: {
2013-05-08 18:42:44 +00:00
lxc_url: lxc_box_url('squeeze'),
vbox_url: 'http://f.willianfernandes.com.br/vagrant-boxes/DebianSqueeze64.box'
},
wheezy: {
lxc_url: lxc_box_url('wheezy'),
},
sid: {
lxc_url: lxc_box_url('sid'),
}
}
2013-03-27 00:57:47 +00:00
Vagrant.require_plugin 'vagrant-lxc'
Vagrant.require_plugin 'vagrant-cachier'
Vagrant.configure("2") do |config|
2013-04-21 21:56:05 +00:00
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root', nfs: true
ip_suffix = 30
BOXES.each do |box_name, box_config|
config.vm.define(box_name.to_sym) do |vm_config|
vm_config.vm.network :private_network, ip: "192.168.50.#{ip_suffix += 1}"
vm_config.vm.box = "#{box_name}64"
if box_config[:vbox_url]
vm_config.vm.provider :virtualbox do |vb, vb_config|
vb_config.vm.box_url = box_config[:vbox_url]
vb_config.vm.hostname = 'vbox'
vb.customize [
"modifyvm", :id,
"--memory", '1536',
"--cpus", '2'
]
end
end
if box_config[:lxc_url]
vm_config.vm.provider :lxc do |lxc, lxc_config|
lxc_config.vm.box_url = box_config[:lxc_url]
lxc_config.vm.hostname = 'lxc-dev-box' unless %w(squeeze wheezy sid).include? box_name.to_s
# Required to boot nested containers
lxc.customize 'aa_profile', 'unconfined' unless %w(squeeze wheezy sid).include? box_name.to_s
end
end
vm_config.cache.enable :apt
vm_config.cache.enable :gem
end
end
config.vm.provision :shell, :inline => 'sudo apt-get update'
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