2013-03-12 17:33:00 +00:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
|
2013-05-07 13:15:16 +00:00
|
|
|
require 'pathname'
|
2013-11-07 00:08:13 +00:00
|
|
|
BASE_URL = 'http://bit.ly/'
|
|
|
|
LAST_RELEASE_DATE = '2013-09-28'
|
2013-05-07 13:15:16 +00:00
|
|
|
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")
|
2013-05-07 13:15:16 +00:00
|
|
|
|
|
|
|
local_box_file.exist? ?
|
|
|
|
local_box_file.to_s :
|
2013-11-07 00:08:13 +00:00
|
|
|
"#{BASE_URL}/#{box_name}"
|
2013-03-12 17:33:00 +00:00
|
|
|
end
|
|
|
|
|
2013-05-07 13:15:16 +00:00
|
|
|
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'),
|
2013-11-06 03:09:54 +00:00
|
|
|
vbox_url: 'http://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box'
|
2013-05-07 13:15:16 +00:00
|
|
|
},
|
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'
|
|
|
|
},
|
2013-05-07 13:15:16 +00:00
|
|
|
squeeze: {
|
2013-05-08 18:42:44 +00:00
|
|
|
lxc_url: lxc_box_url('squeeze'),
|
2013-06-02 22:13:17 +00:00
|
|
|
# https://gist.github.com/henare/1964037
|
|
|
|
vbox_url: 'http://dl.dropbox.com/u/174733/debian-squeeze-64.box'
|
2013-05-07 13:15:16 +00:00
|
|
|
},
|
|
|
|
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'
|
2013-05-07 13:15:16 +00:00
|
|
|
},
|
|
|
|
sid: {
|
|
|
|
lxc_url: lxc_box_url('sid'),
|
|
|
|
}
|
|
|
|
}
|
2013-03-27 00:57:47 +00:00
|
|
|
|
2013-03-12 17:33:00 +00:00
|
|
|
Vagrant.require_plugin 'vagrant-lxc'
|
2013-05-07 13:15:16 +00:00
|
|
|
Vagrant.require_plugin 'vagrant-cachier'
|
2013-07-12 23:27:16 +00:00
|
|
|
Vagrant.require_plugin 'vagrant-pristine'
|
2013-03-12 17:33:00 +00:00
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
2013-04-21 21:56:05 +00:00
|
|
|
config.vm.synced_folder "../", "/vagrant", id: 'vagrant-root', nfs: true
|
2013-03-12 17:33:00 +00:00
|
|
|
|
2013-05-17 21:50:25 +00:00
|
|
|
config.cache.scope = :machine
|
|
|
|
|
2013-05-07 13:15:16 +00:00
|
|
|
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]
|
2013-06-27 13:39:14 +00:00
|
|
|
lxc_config.vm.hostname = 'lxc-dev-box'
|
2013-05-07 13:15:16 +00:00
|
|
|
|
|
|
|
# Required to boot nested containers
|
2013-05-08 18:42:59 +00:00
|
|
|
lxc.customize 'aa_profile', 'unconfined' unless %w(squeeze wheezy sid).include? box_name.to_s
|
2013-05-07 13:15:16 +00:00
|
|
|
end
|
|
|
|
end
|
2013-03-12 17:33:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
config.vm.provision :puppet do |puppet|
|
|
|
|
puppet.manifests_path = "."
|
|
|
|
puppet.manifest_file = "site.pp"
|
|
|
|
puppet.options << [ '--verbose', '--debug' ]
|
|
|
|
end
|
|
|
|
end
|