aboutsummaryrefslogtreecommitdiffstats
path: root/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes
diff options
context:
space:
mode:
Diffstat (limited to 'asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes')
-rw-r--r--asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb18
-rw-r--r--asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb38
-rw-r--r--asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb72
-rw-r--r--asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importComformance.rb20
4 files changed, 148 insertions, 0 deletions
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb
new file mode 100644
index 0000000000..2eb6d58cc3
--- /dev/null
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb
@@ -0,0 +1,18 @@
+template "/tmp/create_cassandra_user.sh" do
+ source "create_cassandra_user.sh.erb"
+ sensitive true
+ mode 0755
+ variables({
+ :cassandra_ip => node['Nodes']['CS'],
+ :cassandra_pwd => ENV['CS_PASSWORD'],
+ :sdc_usr => ENV['SDC_USER'],
+ :sdc_pwd => ENV['SDC_PASSWORD']
+ })
+end
+
+
+bash "create-sdc-user" do
+ code <<-EOH
+ cd /tmp ; /tmp/create_cassandra_user.sh
+ EOH
+end
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb
new file mode 100644
index 0000000000..87edf8c358
--- /dev/null
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb
@@ -0,0 +1,38 @@
+template "/tmp/create_dox_keyspace.sh" do
+ source "create_dox_keyspace.sh.erb"
+ sensitive true
+ mode 0755
+ variables({
+ :cassandra_ip => node['Nodes']['CS'],
+ :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment,
+ :cassandra_pwd => node['cassandra'][:cassandra_password],
+ :cassandra_usr => node['cassandra'][:cassandra_user]
+ })
+end
+
+
+remote_directory '/tmp/tools' do
+ source 'tools'
+ mode '0755'
+ files_mode '0755'
+ action :create
+end
+
+
+bash "onboard-db-schema-creation" do
+ ignore_failure true
+ code <<-EOH
+ cd /tmp/tools/build/scripts
+ chmod +x onboard-db-schema-creation.sh
+ bash /tmp/tools/build/scripts/onboard-db-schema-creation.sh
+ EOH
+end
+
+bash "create-DOX-schema" do
+ ignore_failure true
+ code <<-EOH
+ cd /tmp
+ chmod +x /tmp/create_dox_keyspace.sh
+ /tmp/create_dox_keyspace.sh
+ EOH
+end
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
new file mode 100644
index 0000000000..ea8daf02ec
--- /dev/null
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb
@@ -0,0 +1,72 @@
+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 xf /tmp/sdctool.tar -C /tmp
+ EOH
+end
+
+
+template "titan.properties" do
+ sensitive true
+ path "/tmp/sdctool/config/titan.properties"
+ source "titan.properties.erb"
+ mode "0755"
+ variables({
+ :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment,
+ :cassandra_ip => node['Nodes']['CS'],
+ :cassandra_pwd => node['cassandra'][:cassandra_password],
+ :cassandra_usr => node['cassandra'][:cassandra_user],
+ :titan_connection_timeout => node['cassandra']['titan_connection_timeout']
+ })
+end
+
+
+template "/tmp/sdctool/config/configuration.yaml" do
+ sensitive true
+ source "configuration.yaml.erb"
+ mode 0755
+ variables({
+ :host_ip => node['Nodes']['BE'],
+ :catalog_port => node['BE'][:http_port],
+ :ssl_port => node['BE'][:https_port],
+ :cassandra_ip => node['Nodes']['CS'],
+ :rep_factor => 1,
+ :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment,
+ :titan_Path => "/tmp/sdctool/config/",
+ :socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
+ :socket_read_timeout => node['cassandra']['socket_read_timeout'],
+ :cassandra_pwd => node['cassandra'][:cassandra_password],
+ :cassandra_usr => node['cassandra'][:cassandra_user]
+ })
+end
+
+
+template "/tmp/sdctool/config/elasticsearch.yml" do
+ sensitive true
+ source "elasticsearch.yml.erb"
+ mode 0755
+ variables({
+ :elastic_ip => node['Nodes']['ES']
+ })
+end
+
+bash "excuting-schema-creation" do
+ code <<-EOH
+ cd /tmp
+ chmod +x /tmp/sdctool/scripts/schemaCreation.sh
+ /tmp/sdctool/scripts/schemaCreation.sh /tmp/sdctool/config
+ EOH
+end
+
+bash "excuting-titanSchemaCreation.sh" do
+ code <<-EOH
+ chmod +x /tmp/sdctool/scripts/titanSchemaCreation.sh
+ /tmp/sdctool/scripts/titanSchemaCreation.sh /tmp/sdctool/config
+ EOH
+end
diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importComformance.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importComformance.rb
new file mode 100644
index 0000000000..3b293e88b9
--- /dev/null
+++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importComformance.rb
@@ -0,0 +1,20 @@
+working_directory = "/tmp"
+cl_release=node['version'].split('.')[0..2].join('.').split('-')[0]
+printf("\033[33mcl_release=[%s]\n\033[0m", cl_release)
+
+
+
+bash "import-Comformance" do
+ cwd "#{working_directory}"
+ code <<-EOH
+ conf_dir=/tmp/sdctool/config
+ tosca_dir=/tmp/sdctool/tosca
+
+ cl_version=`grep 'toscaConformanceLevel:' $conf_dir/configuration.yaml |awk '{print $2}'`
+
+ cd /tmp/sdctool/scripts
+ /bin/chmod +x sdcSchemaFileImport.sh
+ echo "execute /tmp/sdctool/scripts/sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir} "
+ ./sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir}
+ EOH
+end \ No newline at end of file