summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
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.rb49
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