vagrant-lxc-ng/development/Vagrantfile

93 lines
2.7 KiB
Text
Raw Permalink Normal View History

# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'pathname'
2013-11-07 00:08:13 +00:00
BASE_URL = 'http://bit.ly/'
LAST_RELEASE_DATE = '2013-09-28'
LOCAL_BOXES_PATH = Pathname('../boxes/output').expand_path
def lxc_box_url(release_name)
2013-11-07 00:08:13 +00:00
box_name = "vagrant-lxc-#{release_name}-amd64-#{LAST_RELEASE_DATE}"
local_box_file = LOCAL_BOXES_PATH.join("#{box_name}.box")
local_box_file.exist? ?
local_box_file.to_s :
2013-11-07 00:08:13 +00:00
"#{BASE_URL}/#{box_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'
},
2013-09-21 04:30:15 +00:00
saucy: {
vbox_url: 'http://cloud-images.ubuntu.com/vagrant/saucy/current/saucy-server-cloudimg-amd64-vagrant-disk1.box'
},
squeeze: {
2013-05-08 18:42:44 +00:00
lxc_url: lxc_box_url('squeeze'),
# https://gist.github.com/henare/1964037
vbox_url: 'http://dl.dropbox.com/u/174733/debian-squeeze-64.box'
},
wheezy: {
lxc_url: lxc_box_url('wheezy'),
2013-06-02 22:14:03 +00:00
vbox_url: 'http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box'
},
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.require_plugin 'vagrant-pristine'
Vagrant.configure("2") do |config|
2013-04-21 21:56:05 +00:00
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root', nfs: true
config.cache.scope = :machine
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'
# Required to boot nested containers
lxc.customize 'aa_profile', 'unconfined' unless %w(squeeze wheezy sid).include? box_name.to_s
end
end
end
end
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "."
puppet.manifest_file = "site.pp"
puppet.options << [ '--verbose', '--debug' ]
end
end