From 451a3400b76511393c62a444f588a4ed15f4a549 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 19 Feb 2017 10:28:42 +0200 Subject: Initial OpenECOMP SDC commit Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando --- .../recipes/01-configureCassandra.rb | 49 ++++++++++++++++++++++ .../cassandra-actions/recipes/02-createCsUser.rb | 8 ++++ .../recipes/03-createDoxKeyspace.rb | 8 ++++ .../cassandra-actions/recipes/04-schemaCreation.rb | 35 ++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/01-configureCassandra.rb create mode 100644 sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb create mode 100644 sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb create mode 100644 sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb (limited to 'sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes') 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 diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb new file mode 100644 index 0000000000..627bd6fe7e --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/02-createCsUser.rb @@ -0,0 +1,8 @@ +template "/tmp/create_cassandra_user.sh" do + source "create_cassandra_user.sh.erb" + mode 0755 + variables({ + :cassandra_ip => "HOSTIP" + }) +end + diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb new file mode 100644 index 0000000000..92a81eb7dc --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/03-createDoxKeyspace.rb @@ -0,0 +1,8 @@ +template "/tmp/create_dox_keyspace.sh" do + source "create_dox_keyspace.sh.erb" + mode 0755 + variables({ + :cassandra_ip => "HOSTIP" + }) +end + diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb new file mode 100644 index 0000000000..7c40c509c2 --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/04-schemaCreation.rb @@ -0,0 +1,35 @@ +cookbook_file "/tmp/sdctool.tar" do + source "sdctool.tar" + mode 0755 +end + +## extract sdctool.tar +bash "install tar" do + cwd "/tmp" + code <<-EOH + /bin/tar xvf /tmp/sdctool.tar -C /tmp + EOH +end + + +template "/tmp/sdctool/config/configuration.yaml" do + source "configuration.yaml.erb" + mode 0755 + variables({ + :host_ip => node['HOST_IP'], + :catalog_port => node['BE'][:http_port], + :ssl_port => node['BE'][:https_port], + :cassandra_ip => node['Nodes']['CS'], + :rep_factor => 1, + :dc1 => "DC-"+node.chef_environment + }) +end + +template "/tmp/sdctool/config/elasticsearch.yml" do + source "elasticsearch.yml.erb" + mode 0755 + variables({ + :elastic_ip => "HOSTIP" + }) +end + -- cgit 1.2.3-korg