Skip to content

Instantly share code, notes, and snippets.

@pcn
Created January 13, 2012 17:54
Show Gist options
  • Save pcn/1607780 to your computer and use it in GitHub Desktop.
Save pcn/1607780 to your computer and use it in GitHub Desktop.
Example grover cluster definition
cluster_type = 'Grover'
differentiator = 'test'
# cluster_name = "#{cluster_type}_#{differentiator}"
cluster_name = "Grover"
require "Chef"
data = Chef::DataBagItem.load('cluster_template_values', cluster_type)['default']
ClusterChef.cluster cluster_name do
recipe "tuning"
data['default_roles'].each do |role|
role "#{role}"# "knewton_base_u1110" # Mediums are 32-bit, I don't have a prepared AMI, so use what's provided here
end
cloud do
ssh_identity_dir File.expand_path('~/.ssh/')
backing data['default_backing_store']
image_name data['default_release_flavor']
flavor data['default_instance_flavor']
availability_zones data['default_availability_zones']
bootstrap_distro data['default_bootstrap_template'] # 'ubuntu11.04-cluster_chef_knewton'
# keypair data['keypair']
data['default_security_group_list'].each do |g|
security_group "#{g}"
end
end
facet 'service' do
instances data['facet']['service']['instance_count'].to_i
begin
data['facet']['datanode']['role_list'].each do |role|
role "#{role}"
end
rescue NoMethodError => e
p "Error while setting up the facet role list: #{e}"
p "ignoring and continuing"
end
begin
data['facet']['datanode']['recipe_list'].each do |recipe|
recipe "#{recipe}"
end
rescue NoMethodError => e
p "Error while setting up the facet recipe list: #{e}"
p "ignoring and continuing"
end
a = data['facet']['service']['override_attributes']
facet_role do
override_attributes({ :java => a['java'],
:package_set => a['package_set'],
:firewall => {
:allow_port => {
:ssh => {
:port => 22,
:proto => "tcp"
},
:grover_thrift => {
:port => a['grover_thrift_port'],
:proto => "tcp"
}
}
}
})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment