blob: 5b05e9be57abebd6de14b5a7aa01c3c8b6fd42d9 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001cluster_name = ''
mahendrrf454e702019-04-18 10:39:30 +00002cluster_name = node['cassandra'][:cluster_name]
Michael Lando451a3402017-02-19 10:28:42 +02003
4cas_ips=''
5cas_ips=node['Nodes'][:CS]
6
7interface = node['interfaces']['application']
8application_host = ''
9node['network']['interfaces'][interface][:addresses].each do | addr , details |
10 if details['family'] == ('inet')
11 application_host = addr
12 end
13end
14
15
16template "cassandra-yaml-config" do
17 path "/etc/cassandra/cassandra.yaml"
18 source "cassandra.yaml.erb"
Michael Landoed64b5e2017-06-09 03:19:04 +030019 sensitive true
Michael Lando451a3402017-02-19 10:28:42 +020020 owner "cassandra"
21 group "cassandra"
22 mode "0755"
23 variables ({
Tal Gitelmanc4d387d2019-03-28 11:00:54 +020024 :cassandra_port => node['cassandra']['cassandra_port'],
25 :cassandra_cluster => cluster_name,
26 :cassandra_data_dir => node['cassandra'][:data_dir],
27 :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir],
28 :cassandra_cache_dir => node['cassandra'][:cache_dir],
29 :seeds_address => cas_ips,
30 :listen_address => application_host,
31 :broadcast_address => application_host,
32 :broadcast_rpc_address => application_host,
33 :rpc_address => "0.0.0.0",
34 :num_tokens => node['cassandra'][:num_tokens],
35 :internode_encryption => "none",
36 :cassandra_truststore_dir => "/etc/cassandra/cs_trust"
Michael Lando451a3402017-02-19 10:28:42 +020037 })
38end
39
40rackNum=1
41template "cassandra-rackdc.properties" do
42 path "/etc/cassandra/cassandra-rackdc.properties"
43 source "cassandra-rackdc.properties.erb"
44 owner "cassandra"
45 group "cassandra"
46 mode "0755"
47 variables ({
mahendrrf454e702019-04-18 10:39:30 +000048 :dc => node['cassandra']['datacenter_name'],
49 :rack => "Rack"+"#{rackNum}"
Michael Lando451a3402017-02-19 10:28:42 +020050 })
mahendrrf454e702019-04-18 10:39:30 +000051end