Created
February 21, 2015 03:35
-
-
Save zznate/ff27ff37c161d6fed991 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server_count = 5 | |
network = '192.168.50.' | |
first_ip = 100 | |
servers = [] | |
seeds = [] | |
cassandra_tokens = [] | |
(0..server_count-1).each do |i| | |
name = 'node' + (i + 1).to_s | |
ip = network + (first_ip + i).to_s | |
seeds << ip | |
servers << {'name' => name, | |
'ip' => ip, | |
'initial_token' => (2**64 / server_count * i) - 2**63} | |
end | |
Vagrant.configure("2") do |config| | |
# Plugin-specific configurations | |
# Detects vagrant-cachier plugin | |
if Vagrant.has_plugin?('vagrant-cachier') | |
puts 'INFO: Vagrant-cachier plugin detected. Optimizing caches.' | |
config.cache.auto_detect = true | |
config.cache.enable :chef | |
config.cache.enable :apt | |
else | |
puts 'WARN: Vagrant-cachier plugin not detected. Continuing unoptimized.' | |
end | |
# Detects vagrant-omnibus plugin | |
if Vagrant.has_plugin?('vagrant-omnibus') | |
puts 'INFO: Vagrant-omnibus plugin detected.' | |
config.omnibus.chef_version = :latest | |
else | |
puts "FATAL: Vagrant-omnibus plugin not detected. Please install the plugin with\n 'vagrant plugin install vagrant-omnibus' from any other directory\n before continuing." | |
exit | |
end | |
# Detects vagrant-berkshelf plugin | |
if Vagrant.has_plugin?('berkshelf') | |
# The path to the Berksfile to use with Vagrant Berkshelf | |
puts 'INFO: Vagrant-berkshelf plugin detected.' | |
config.berkshelf.berksfile_path = './Berksfile' | |
else | |
puts "FATAL: Vagrant-berkshelf plugin not detected. Please install the plugin with\n 'vagrant plugin install vagrant-berkshelf' from any other directory\n before continuing." | |
exit | |
end | |
servers.each do |server| | |
config.vm.define server['name'] do |config2| | |
config2.vm.box_check_update = "false" | |
config2.vm.box = "learningchef/centos65" | |
config2.vm.synced_folder "../../", "/home/vagrant/chef-repo" | |
config2.vm.host_name = server['name'] | |
config2.vm.provider "virtualbox" do |v| | |
v.memory = 1024 | |
end | |
config2.berkshelf.enabled = true | |
config2.vm.network "private_network", ip: server['ip'] | |
config2.vm.provision :chef_solo do |chef| | |
chef.run_list = [ | |
'recipe[neo-cassandra::default]', | |
'recipe[neo-cassandra::metrics-reporters]', | |
# 'recipe[neo-sensu::client]' | |
] | |
chef.json = { | |
:cassandra => {'cluster_name' => 'VerifyCluster', | |
'package_name' => 'dsc20', | |
'version' => '2.0.11', | |
'release' => '1', | |
'setup_jna' => false, | |
'max_heap_size' => '512M', | |
'heap_new_size' => '100M', | |
'initial_token' => server['initial_token'], | |
'seeds' => "192.168.50.100", | |
'listen_address' => server['ip'], | |
'broadcast_address' => server['ip'], | |
'rpc_address' => server['ip'], | |
'conconcurrent_reads' => "2", | |
'concurrent_writes' => "2", | |
'memtable_flush_queue_size' => "2", | |
'compaction_throughput_mb_per_sec' => "8", | |
'key_cache_size_in_mb' => "4", | |
'key_cache_save_period' => "0", | |
'native_transport_min_threads' => "2", | |
'native_transport_max_threads' => "4", | |
'notify_restart' => true, | |
'reporter' => { | |
'riemann' => { | |
'enable' => false, | |
'host' => '192.168.33.51' | |
}, | |
'graphite' => { | |
'enable' => false, | |
'host' => '192.168.33.51' | |
} | |
} | |
}, | |
:java => {'jdk_version' => '7'} | |
} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment