blob: 47ab456dec3dffa818070737239fc7003368352f [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001cluster_name = ''
2cluster_name = node['cassandra'][:cluster_name]+node.chef_environment
3
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 ({
Michael Landoed64b5e2017-06-09 03:19:04 +030048 :dc => cluster_name,
Michael Lando451a3402017-02-19 10:28:42 +020049 :rack => "Rack"+"#{rackNum}-"+node.chef_environment
50 })
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020051end