blob: 32e89c9b218229a2401c0e1077be2f0b28898134 (
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
|
cluster_name = ''
cluster_name = node['cassandra'][:cluster_name]+node.chef_environment
cas_ips=''
cas_ips=node['Nodes'][:CS]
interface = node['interfaces']['application']
application_host = ''
node['network']['interfaces'][interface][:addresses].each do | addr , details |
if details['family'] == ('inet')
application_host = addr
end
end
template "cassandra-yaml-config" do
path "/etc/cassandra/cassandra.yaml"
source "cassandra.yaml.erb"
sensitive true
owner "cassandra"
group "cassandra"
mode "0755"
variables ({
:cassandra_cluster => cluster_name,
:cassandra_data_dir => node['cassandra'][:data_dir],
:cassandra_commitlog_dir => node['cassandra'][:commitlog_dir],
:cassandra_cache_dir => node['cassandra'][:cache_dir],
:seeds_address => cas_ips,
:listen_address => application_host,
:broadcast_address => application_host,
:broadcast_rpc_address => application_host,
:rpc_address => "0.0.0.0",
:num_tokens => node['cassandra'][:num_tokens],
:internode_encryption => "none",
:cassandra_truststore_dir => "/etc/cassandra/cs_trust"
})
end
rackNum=1
template "cassandra-rackdc.properties" do
path "/etc/cassandra/cassandra-rackdc.properties"
source "cassandra-rackdc.properties.erb"
owner "cassandra"
group "cassandra"
mode "0755"
variables ({
:dc => cluster_name,
:rack => "Rack"+"#{rackNum}-"+node.chef_environment
})
end
|