Skip to content

Instantly share code, notes, and snippets.

@hughsaunders
Created March 21, 2013 15:47
Show Gist options
  • Save hughsaunders/5214083 to your computer and use it in GitHub Desktop.
Save hughsaunders/5214083 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
server_ip = '172.20.0.1'
instances = [
{ :name => 'server', :roles => ['server','dashboard'], :ip => server_ip,
:forwards => [8080, 3000] },
{ :name => :chef, :roles => ['agent'], :ip => '172.20.0.2' },
{ :name => :controller, :roles => ['agent'], :ip => '172.20.0.3' },
{ :name => :compute, :roles => ['agent'], :ip => '172.20.0.3' },
]
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.gui = true
end
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
instances.each do |instance|
config.vm.define instance[:name] do |config|
config.vm.network :private_network, ip: instance[:ip]
if instance[:forwards]
instance[:forwards].each do |port|
config.vm.network :forwarded_port, guest: port, host: port
end
end
instance[:roles].each do |role|
config.vm.provision :shell, :inline => "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get -q -y install curl; curl https://blahblah}"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment