summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/recipes/05-titanSchemaCreation.rb
blob: fa9ae7969091565a74821561cd283cfa57fbd8ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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,
      :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['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",
      :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 => "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