Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 1 | cluster_name = '' |
| 2 | cluster_name = node['cassandra'][:cluster_name]+node.chef_environment |
| 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 ({ |
| 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 | }) |
| 37 | end |
| 38 | |
| 39 | rackNum=1 |
| 40 | template "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 Lando | ed64b5e | 2017-06-09 03:19:04 +0300 | [diff] [blame] | 47 | :dc => cluster_name, |
Michael Lando | 451a340 | 2017-02-19 10:28:42 +0200 | [diff] [blame] | 48 | :rack => "Rack"+"#{rackNum}-"+node.chef_environment |
| 49 | }) |
Yuli Shlosberg | 0875ce0 | 2018-01-25 13:53:36 +0200 | [diff] [blame] | 50 | end |