diff --git a/manifests/elasticsearch.pp b/manifests/elasticsearch.pp index c16d86e..68018b9 100644 --- a/manifests/elasticsearch.pp +++ b/manifests/elasticsearch.pp @@ -14,7 +14,9 @@ # # Class to install elasticsearch. # -class logstash::elasticsearch { +class logstash::elasticsearch ( + discover_node = 'localhost' +) { # install java runtime package { 'java7-runtime-headless': ensure => present, @@ -40,7 +42,7 @@ class logstash::elasticsearch { file { '/etc/elasticsearch/elasticsearch.yml': ensure => present, - source => 'puppet:///modules/logstash/elasticsearch.yml', + content => template('logstash/elasticsearch.yml.erb'), replace => true, owner => 'root', group => 'root', diff --git a/manifests/web.pp b/manifests/web.pp index 1e3172e..a60fe4c 100644 --- a/manifests/web.pp +++ b/manifests/web.pp @@ -18,7 +18,7 @@ class logstash::web ( $vhost_name = $::fqdn, $serveradmin = "webmaster@${::fqdn}", $frontend = 'internal', - $elasticsearch_host = 'localhost', + $discover_node = 'localhost', $proxy_elasticsearch = false ) { include apache @@ -57,7 +57,7 @@ class logstash::web ( 'kibana': { class { 'kibana': - elasticsearch_host => $elasticsearch_host, + discover_node => $discover_node, } $vhost = 'logstash/kibana.vhost.erb' } diff --git a/files/elasticsearch.yml b/templates/elasticsearch.yml.erb similarity index 98% rename from files/elasticsearch.yml rename to templates/elasticsearch.yml.erb index 8bc5d1a..1803562 100644 --- a/files/elasticsearch.yml +++ b/templates/elasticsearch.yml.erb @@ -37,7 +37,7 @@ # Node names are generated dynamically on startup, so you're relieved # from configuring them manually. You can tie this node to a specific name: # -# node.name: "Franz Kafka" +node.name: "<%= scope.lookupvar("::hostname") %>" # Every node can be configured to allow or deny being eligible as the master, # and to allow or deny to store the data. @@ -139,7 +139,7 @@ index.store.compress.stored: true index.store.compress.tv: true -indices.memory.index_buffer_size: "40%" +indices.memory.index_buffer_size: "33%" #################################### Paths #################################### @@ -184,7 +184,7 @@ indices.memory.index_buffer_size: "40%" # # Set this property to true to lock the memory: # -# bootstrap.mlockall: true +bootstrap.mlockall: true # Make sure that the ES_MIN_MEM and ES_MAX_MEM environment variables are set # to the same value, and that the machine has enough memory to allocate @@ -327,7 +327,7 @@ discovery.zen.ping.multicast.enabled: false # to perform discovery when new nodes (master or data) are started: # # discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"] -discovery.zen.ping.unicast.hosts: ["localhost"] +discovery.zen.ping.unicast.hosts: ["<%= discover_node %>"] # EC2 discovery allows to use AWS EC2 API in order to perform discovery. # diff --git a/templates/kibana.vhost.erb b/templates/kibana.vhost.erb index 63c5e26..341c65f 100644 --- a/templates/kibana.vhost.erb +++ b/templates/kibana.vhost.erb @@ -11,9 +11,9 @@ <% if proxy_elasticsearch == true %> # Proxy for elasticsearch _aliases, .*/_status, and .*/_search. - ProxyPassMatch http://<%= scope.lookupvar("::logstash::web::elasticsearch_host") %>:9200/$1 + ProxyPassMatch http://<%= scope.lookupvar("::logstash::web::discover_node") %>:9200/$1 - ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::elasticsearch_host") %>:9200/ + ProxyPassReverse /elasticsearch/ http://<%= scope.lookupvar("::logstash::web::discover_node") %>:9200/ <% end %> ProxyPass / http://127.0.0.1:5601/ retry=0