chef-lctp/Vagrantfile
2014-01-19 15:34:01 +01:00

53 lines
1.4 KiB
Ruby

# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
boxes = [
{ name: "head_node", ip: '172.28.128.2', role: :head_node },
#{ name: "compute_node", role: :compute_node, mac: "5CA1AB1E0001" }
]
["vbguest", "berkshelf"].each do |plugin|
begin
require "vagrant-#{plugin}"
rescue LoadError
puts "#{plugin} plugin not installed!"
puts "run:"
puts "\tvagrant plugin install vagrant-#{plugin}"
exit(1)
end
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "opscode_ubuntu-12.04_chef-11.4.4"
config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.4.box"
# Enabling the Berkshelf plugin. To enable this globally, add this configuration
# option to your ~/.vagrant.d/Vagrantfile file
config.berkshelf.enabled = true
chef_default = proc do |chef|
chef.cookbooks_path = "cookbooks"
chef.roles_path = "roles"
chef.data_bags_path = "data_bags"
end
boxes.each do |box|
config.vm.define box[:name] do |node|
if box[:ip]
node.vm.network :private_network, ip: box[:ip]
else
node.vm.network :private_network, type: :dhcp, mac: box[:mac]
end
config.vm.provision :chef_solo do |chef|
chef_default.call(chef)
chef.add_role box[:role].to_s
end
end
end
end