blob: 32e89c9b218229a2401c0e1077be2f0b28898134 [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 ({
24 :cassandra_cluster => cluster_name,
25 :cassandra_data_dir => node['cassandra'][:data_dir],
26 :cassandra_commitlog_dir => node['cassandra'][:commitlog_dir],
27 :cassandra_cache_dir => node['cassandra'][:cache_dir],
28 :seeds_address => cas_ips,
29 :listen_address => application_host,
30 :broadcast_address => application_host,
31 :broadcast_rpc_address => application_host,
32 :rpc_address => "0.0.0.0",
33 :num_tokens => node['cassandra'][:num_tokens],
34 :internode_encryption => "none",
35 :cassandra_truststore_dir => "/etc/cassandra/cs_trust"
36 })
37end
38
39rackNum=1
40template "cassandra-rackdc.properties" do
41 path "/etc/cassandra/cassandra-rackdc.properties"
42 source "cassandra-rackdc.properties.erb"
43 owner "cassandra"
44 group "cassandra"
45 mode "0755"
46 variables ({
Michael Landoed64b5e2017-06-09 03:19:04 +030047 :dc => cluster_name,
Michael Lando451a3402017-02-19 10:28:42 +020048 :rack => "Rack"+"#{rackNum}-"+node.chef_environment
49 })
Yuli Shlosberg0875ce02018-01-25 13:53:36 +020050end