Skip to content

Instantly share code, notes, and snippets.

@rrichards
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rrichards/874ee4ccb281d0aaf2a4 to your computer and use it in GitHub Desktop.
Save rrichards/874ee4ccb281d0aaf2a4 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# inspired from https://gist.github.com/dlutzy/2469037
boxes = [
{ :name => :web, ip: '192.168.33.10', ssh_port: 2223 },
{ :name => :db, ip: '192.168.33.11', ssh_port: 2224 },
{ :name => :zookeeper, ip: '192.168.33.12', ssh_port: 2225 },
{ :name => :kafka, ip: '192.168.33.13', ssh_port: 2226 },
{ :name => :storm, ip: '192.168.33.14', ssh_port: 2227 },
{ :name => :elasticsearch, ip: '192.168.33.15', ssh_port: 2228 },
]
CUSTOM_CONFIG = {
"BOX_NAME" => "precise64",
"BOX_URL" => "http://files.vagrantup.com/precise64.box",
"HEADLESS" => false
}
Vagrant.configure("2") do |config|
# headless? uncomment this to have the VM's window available
config.vm.provider :virtualbox do |vb|
vb.gui = CUSTOM_CONFIG['HEADLESS']
end
# Disable default ssh in order to manually assign to a known value
# https://github.com/mitchellh/vagrant/issues/3232
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", disabled: true
boxes.each do |opts|
config.vm.define opts[:name] do |boxconfig|
boxconfig.vm.box = CUSTOM_CONFIG['BOX_NAME']
boxconfig.vm.box_url = CUSTOM_CONFIG['BOX_URL']
boxconfig.vm.hostname = "%s.vagrant" % opts[:name].to_s
boxconfig.vm.network "private_network", ip: opts[:ip]
boxconfig.vm.network :forwarded_port, guest: 22, host: opts[:ssh_port]
end
end
# provisioning with ansible
# config.vm.provision :ansible do |ansible|
# ansible.playbook = "./provisioning/site.yml"
# end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment