Skip to content

Instantly share code, notes, and snippets.

@itissid
Created March 27, 2012 22:42
Show Gist options
  • Save itissid/2221109 to your computer and use it in GitHub Desktop.
Save itissid/2221109 to your computer and use it in GitHub Desktop.
require 'Shell'
MEMORY_SIZE = 512
CPU_COUNT = 1
Vagrant::Config.run do |config|
#Install java and cassandra
#config.vm.provision :shell, :path => "install_java.sh"
#config.vm.provision :shell, :path => "install_cassandra.sh"
num_nodes = 3
l = 1..num_nodes
seeds = l.map {|x| "192.167.1.1#{x}"}
ports = l.map {|x| "916#{x}"}
#generate configs for cassandra yaml
for i in 0...num_nodes
print "Iteration: #{i}\n"
config.vm.box = "minimal-centos-60"
config.vm.box_url = "http://dl.dropbox.com/u/9227672/CentOS-6.0-x86_64-netboot-4.1.6.box"
config.vm.define "Cassandra#{i}" do |iconfig|
iconfig.vm.network :hostonly, seeds[i]
iconfig.vm.provision :shell do |shell|
shell.inline = "echo $1 > ~/blah.txt"
shell.args = "'Index: #{i}'"
end
iconfig.vm.customize do |vm|
vm.name = "Cassandra#{i}"
if vm.hw_virt.enabled?
if vm.cpu_count < CPU_COUNT
vm.bios.io_apic_enabled = true
vm.cpu_count = CPU_COUNT
end
end
if vm.memory_size < MEMORY_SIZE
vm.memory_size = MEMORY_SIZE
end
end # iconfig.vm.customize
end # config.vm.define
end # for
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment