diff options
Diffstat (limited to 'sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes')
6 files changed, 134 insertions, 4 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 index 9313aa87ff..f167c3ec8d 100644 --- 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 @@ -16,6 +16,7 @@ end template "cassandra-yaml-config" do path "/etc/cassandra/cassandra.yaml" source "cassandra.yaml.erb" + sensitive true owner "cassandra" group "cassandra" mode "0755" @@ -43,7 +44,7 @@ template "cassandra-rackdc.properties" do group "cassandra" mode "0755" variables ({ - :dc => "DC-"+node.chef_environment, + :dc => cluster_name, :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 index 627bd6fe7e..1ebc80d5e4 100644 --- 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 @@ -1,8 +1,15 @@ template "/tmp/create_cassandra_user.sh" do source "create_cassandra_user.sh.erb" + sensitive true mode 0755 variables({ :cassandra_ip => "HOSTIP" }) end + +bash "create-sdc-user" do + code <<-EOH + cd /tmp ; /tmp/create_cassandra_user.sh + EOH +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 index 92a81eb7dc..e54932d1c4 100644 --- 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 @@ -1,8 +1,32 @@ template "/tmp/create_dox_keyspace.sh" do source "create_dox_keyspace.sh.erb" + sensitive true mode 0755 variables({ - :cassandra_ip => "HOSTIP" + :cassandra_ip => "HOSTIP", + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment }) end + +cookbook_file "/tmp/create_dox_db.cql" do + sensitive true + source "create_dox_db.cql" + mode 0755 +end + +cookbook_file "/tmp/alter_dox_db.cql" do + sensitive true + source "alter_dox_db.cql" + mode 0755 +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/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 index 7c40c509c2..5890603829 100644 --- 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 @@ -7,12 +7,24 @@ end bash "install tar" do cwd "/tmp" code <<-EOH - /bin/tar xvf /tmp/sdctool.tar -C /tmp + /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 + }) +end + + template "/tmp/sdctool/config/configuration.yaml" do + sensitive true source "configuration.yaml.erb" mode 0755 variables({ @@ -21,11 +33,14 @@ template "/tmp/sdctool/config/configuration.yaml" do :ssl_port => node['BE'][:https_port], :cassandra_ip => node['Nodes']['CS'], :rep_factor => 1, - :dc1 => "DC-"+node.chef_environment + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, + :titan_Path => "/tmp/sdctool/config/" }) end + template "/tmp/sdctool/config/elasticsearch.yml" do + sensitive true source "elasticsearch.yml.erb" mode 0755 variables({ @@ -33,3 +48,11 @@ template "/tmp/sdctool/config/elasticsearch.yml" do }) 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 diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb new file mode 100644 index 0000000000..a3af2f490f --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb @@ -0,0 +1,61 @@ +cookbook_file "/tmp/sdctool.tar" do + sensitive true + 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 + }) +end + + +template "/tmp/sdctool/config/configuration.yaml" do + sensitive true + 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, + :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, + :titan_Path => "/tmp/sdctool/config" + }) +end + +template "/tmp/sdctool/config/elasticsearch.yml" do + sensitive true + source "elasticsearch.yml.erb" + mode 0755 + variables({ + :elastic_ip => "HOSTIP" + }) +end + + +bash "excuting-titanSchemaCreation.sh" do + code <<-EOH + echo "XXXXXXXXXXXX executing /tmp/sdctool/scripts/titanSchemaCreation.sh XXXXXXXXXXXX" + chmod +x /tmp/sdctool/scripts/titanSchemaCreation.sh + /tmp/sdctool/scripts/titanSchemaCreation.sh /tmp/sdctool/config + EOH +end + + + diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/06-migrateZusammenFromDox.rb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/06-migrateZusammenFromDox.rb new file mode 100644 index 0000000000..e1fcf4f556 --- /dev/null +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/06-migrateZusammenFromDox.rb @@ -0,0 +1,14 @@ +#onboarding_version = "#{node['onboarding'][:version]}" +#GROUP_ID = "com/att/asdc/onboarding/#{onboarding_version}" +#NEXUS_IP = "#{node['nexus_ip']}" + +bash "Excuting openecomp-zusammen-migration-1707.0.0-SNAPSHOT.jar" do + code <<-EOH + [ -d /var/tmp/onboarding/migration ] && rm -rf /var/tmp/onboarding || mkdir -p /var/tmp/onboarding/migration + cd /var/tmp/onboarding/migration + /bin/tar -xzf /root/chef-solo/cookbooks/cassandra-actions/files/default/zusammen.tgz -C /var/tmp/onboarding/migration + cd /var/tmp/onboarding/migration + java -Dlog.home=/var/tmp/onboarding/migration/logs -Dconfiguration.yaml=/tmp/sdctool/config/configuration.yaml -jar openecomp-zusammen-migration-1707.0.0-SNAPSHOT.jar org.openecomp.core.migration.MigrationMain + EOH +end + |