Revert "Upgrade SDC to use common cassandra cluster"
[sdc.git] / asdctool / sdc-cassandra-init / chef-repo / cookbooks / cassandra-actions / recipes / 03-schemaCreation.rb
1 cookbook_file "/tmp/sdctool.tar" do
2   source "sdctool.tar"
3   mode 0755
4 end
5
6 ## extract sdctool.tar
7 bash "install tar" do
8   cwd "/tmp"
9   code <<-EOH
10      /bin/tar xf /tmp/sdctool.tar -C /tmp
11   EOH
12 end
13
14
15 template "titan.properties" do
16   sensitive true
17   path "/tmp/sdctool/config/titan.properties"
18   source "titan.properties.erb"
19   mode "0755"
20   variables({
21      :DC_NAME      => node['cassandra']['datacenter_name']+node.chef_environment,
22      :cassandra_ip  => node['Nodes']['CS'].first,
23      :cassandra_pwd => node['cassandra'][:cassandra_password],
24      :cassandra_usr => node['cassandra'][:cassandra_user],
25      :titan_connection_timeout => node['cassandra']['titan_connection_timeout']
26   })
27 end
28
29
30 template "/tmp/sdctool/config/configuration.yaml" do
31   sensitive true
32   source "configuration.yaml.erb"
33   mode 0755
34   variables({
35       :host_ip                => node['Nodes']['BE'],
36       :catalog_port           => node['BE'][:http_port],
37       :ssl_port               => node['BE'][:https_port],
38       :cassandra_ip           => node['Nodes']['CS'].first,
39       :cassandra_port         => node['cassandra']['cassandra_port'],
40       :rep_factor             => 1,
41       :DC_NAME                => node['cassandra']['datacenter_name']+node.chef_environment,
42       :titan_Path             => "/tmp/sdctool/config/",
43       :socket_connect_timeout => node['cassandra']['socket_connect_timeout'],
44       :socket_read_timeout    => node['cassandra']['socket_read_timeout'],
45       :cassandra_pwd          => node['cassandra'][:cassandra_password],
46       :cassandra_usr          => node['cassandra'][:cassandra_user]
47   })
48 end
49
50
51 template "/tmp/sdctool/config/elasticsearch.yml" do
52   sensitive true
53   source "elasticsearch.yml.erb"
54   mode 0755
55   variables({
56      :elastic_ip => node['Nodes']['ES']
57   })
58 end
59
60 bash "excuting-schema-creation" do
61    code <<-EOH
62      cd /tmp
63      chmod +x /tmp/sdctool/scripts/schemaCreation.sh
64      /tmp/sdctool/scripts/schemaCreation.sh /tmp/sdctool/config
65    EOH
66 end
67
68 bash "excuting-titanSchemaCreation.sh" do
69   code <<-EOH
70      chmod +x /tmp/sdctool/scripts/titanSchemaCreation.sh
71      /tmp/sdctool/scripts/titanSchemaCreation.sh /tmp/sdctool/config
72    EOH
73 end