Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 1 | cluster_name = '' |
mahendrr | f454e70 | 2019-04-18 10:39:30 +0000 | [diff] [blame^] | 2 | cluster_name = node['cassandra'][:cluster_name] |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 3 | |
| 4 | cas_ips='' |
| 5 | cas_ips=node['Nodes'][:CS] |
| 6 | |
| 7 | interface = node['interfaces']['application'] |
| 8 | application_host = '' |
| 9 | node['network']['interfaces'][interface][:addresses].each do | addr , details | |
| 10 | if details['family'] == ('inet') |
| 11 | application_host = addr |
| 12 | end |
| 13 | end |
| 14 | |
| 15 | |
| 16 | template "cassandra-yaml-config" do |
| 17 | path "/etc/cassandra/cassandra.yaml" |
| 18 | source "cassandra.yaml.erb" |
Michael Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 19 | sensitive true |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 20 | owner "cassandra" |
| 21 | group "cassandra" |
| 22 | mode "0755" |
| 23 | variables ({ |
Tal Gitelman | c4d387d | 2019-03-28 11:00:54 +0200 | [diff] [blame] | 24 | :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 Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 37 | }) |
| 38 | end |
| 39 | |
| 40 | rackNum=1 |
| 41 | template "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 ({ |
mahendrr | f454e70 | 2019-04-18 10:39:30 +0000 | [diff] [blame^] | 48 | :dc => node['cassandra']['datacenter_name'], |
| 49 | :rack => "Rack"+"#{rackNum}" |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 50 | }) |
mahendrr | f454e70 | 2019-04-18 10:39:30 +0000 | [diff] [blame^] | 51 | end |