diff options
Diffstat (limited to 'sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb')
-rw-r--r-- | sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb new file mode 100644 index 0000000000..9313aa87ff --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb @@ -0,0 +1,49 @@ +cluster_name = '' +cluster_name = node['cassandra'][:cluster_name]+node.chef_environment + +cas_ips='' +cas_ips=node['Nodes'][:CS] + +interface = node['interfaces']['application'] +application_host = '' +node['network']['interfaces'][interface][:addresses].each do | addr , details | + if details['family'] == ('inet') + application_host = addr + end +end + + +template "cassandra-yaml-config" do + path "/etc/cassandra/cassandra.yaml" + source "cassandra.yaml.erb" + owner "cassandra" + group "cassandra" + mode "0755" + variables ({ + :cassandra_cluster => cluster_name, + :cassandra_data_dir => node['cassandra'][:data_dir], + :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir], + :cassandra_cache_dir => node['cassandra'][:cache_dir], + :seeds_address => cas_ips, + :listen_address => application_host, + :broadcast_address => application_host, + :broadcast_rpc_address => application_host, + :rpc_address => "0.0.0.0", + :num_tokens => node['cassandra'][:num_tokens], + :internode_encryption => "none", + :cassandra_truststore_dir => "/etc/cassandra/cs_trust" + }) +end + +rackNum=1 +template "cassandra-rackdc.properties" do + path "/etc/cassandra/cassandra-rackdc.properties" + source "cassandra-rackdc.properties.erb" + owner "cassandra" + group "cassandra" + mode "0755" + variables ({ + :dc => "DC-"+node.chef_environment, + :rack => "Rack"+"#{rackNum}-"+node.chef_environment + }) +end |