From f0c5a54f9d627f2f270e66a389e0b2aa55e956d3 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Wed, 12 Feb 2020 17:25:58 +0100 Subject: [PATCH] elasticsearch: support versions >= 6 --- library/roles/ELK/elasticsearch/defaults/main.yml | 3 +++ library/roles/ELK/elasticsearch/tasks/elasticsearch.yml | 4 +--- .../roles/ELK/elasticsearch/templates/elasticsearch.yml.j2 | 7 ++++++- library/roles/ELK/elasticsearch/templates/jvm.options.j2 | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/library/roles/ELK/elasticsearch/defaults/main.yml b/library/roles/ELK/elasticsearch/defaults/main.yml index 79f7923e..5ac05201 100644 --- a/library/roles/ELK/elasticsearch/defaults/main.yml +++ b/library/roles/ELK/elasticsearch/defaults/main.yml @@ -31,6 +31,9 @@ elasticsearch_define_heap_size: False elasticsearch_heap_size: 2g elasticsearch_additional_java_opts: '-server -Djava.awt.headless=true -Dfile.encoding=UTF-8' elasticsearch_max_open_files: 65536 +elasticsearch_cluster_routing_allocation_disk_threshold_enabled: 'true' +elasticsearch_cluster_routing_allocation_disk_watermark_low: '85%' +elasticsearch_cluster_routing_allocation_disk_watermark_high: '90%' # Compatibility with kernels <= 3.5. Set to False if you are using a newer kernel elasticsearch_disable_bootstrap_syscall_filter: True diff --git a/library/roles/ELK/elasticsearch/tasks/elasticsearch.yml b/library/roles/ELK/elasticsearch/tasks/elasticsearch.yml index ae9d0742..d59c5fbd 100644 --- a/library/roles/ELK/elasticsearch/tasks/elasticsearch.yml +++ b/library/roles/ELK/elasticsearch/tasks/elasticsearch.yml @@ -7,8 +7,7 @@ apt_repository: repo='{{ elasticsearch_repo }}' state=present update_cache=yes - name: Install the elasticsearch deb packages - apt: name='{{ item }}' state={{ elasticsearch_package_state }} update_cache=yes cache_valid_time=1800 - with_items: '{{ elasticsearch_packages }}' + apt: name='{{ elasticsearch_packages }}' state={{ elasticsearch_package_state }} update_cache=yes cache_valid_time=1800 - name: Install the elasticsearch startup default template: src=elasticsearch-default.j2 dest=/etc/default/elasticsearch owner=root group=elasticsearch mode=0640 @@ -24,5 +23,4 @@ notify: Restart elasticsearch tags: [ 'ELK', 'elasticsearch', 'elk', 'elasticsearch_conf' ] - tags: [ 'ELK', 'elasticsearch', 'elk' ] diff --git a/library/roles/ELK/elasticsearch/templates/elasticsearch.yml.j2 b/library/roles/ELK/elasticsearch/templates/elasticsearch.yml.j2 index 35444a54..99c7b03e 100644 --- a/library/roles/ELK/elasticsearch/templates/elasticsearch.yml.j2 +++ b/library/roles/ELK/elasticsearch/templates/elasticsearch.yml.j2 @@ -24,7 +24,7 @@ node.name: {{ ansible_fqdn }} {% if elasticsearch_major_version >= 7 %} cluster.initial_master_nodes: -{% for n in elasticsearch_bootstrap_known_masters 5} +{% for n in elasticsearch_bootstrap_known_masters %} - {{ n }} {% endfor %} {% endif %} @@ -106,6 +106,11 @@ node.max_local_storage_nodes: {{ elasticsearch_max_local_storage_nodes }} # action.destructive_requires_name: {{ elasticsearch_destructive_requires_name }} +# +cluster.routing.allocation.disk.threshold_enabled: {{ elasticsearch_cluster_routing_allocation_disk_threshold_enabled }} +cluster.routing.allocation.disk.watermark.low: {{ elasticsearch_cluster_routing_allocation_disk_watermark_low }} +cluster.routing.allocation.disk.watermark.high: {{ elasticsearch_cluster_routing_allocation_disk_watermark_high }} + {% if elasticsearch_disable_bootstrap_syscall_filter %} # When using an old kernel bootstrap.system_call_filter: false diff --git a/library/roles/ELK/elasticsearch/templates/jvm.options.j2 b/library/roles/ELK/elasticsearch/templates/jvm.options.j2 index 8caf4fbd..d71d715a 100644 --- a/library/roles/ELK/elasticsearch/templates/jvm.options.j2 +++ b/library/roles/ELK/elasticsearch/templates/jvm.options.j2 @@ -71,7 +71,9 @@ -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true +{% if elasticsearch_major_version >= 6 %} -Djava.io.tmpdir=${ES_TMPDIR} +{% endif %} ## heap dumps