diff --git a/ELK/elasticsearch/defaults/main.yml b/ELK/elasticsearch/defaults/main.yml index b2c89769..4dade064 100644 --- a/ELK/elasticsearch/defaults/main.yml +++ b/ELK/elasticsearch/defaults/main.yml @@ -1,8 +1,9 @@ --- elasticsearch_repo_key: https://packages.elastic.co/GPG-KEY-elasticsearch -elasticsearch_repo_version: 2.x +elasticsearch_major_version: 2 +elasticsearch_repo_version: '{{ elasticsearch_major_version }}.x' elasticsearch_repo: 'deb http://packages.elastic.co/elasticsearch/{{ elasticsearch_repo_version }}/debian stable main' -#elasticsearch_repo_version: 5.x +#elasticsearch_major_version: 5 #elasticsearch_repo: 'deb https://artifacts.elastic.co/packages/{{ elasticsearch_repo_version }}/apt stable main' elasticsearch_packages: - elasticsearch diff --git a/ELK/elasticsearch/templates/elasticsearch-default.j2 b/ELK/elasticsearch/templates/elasticsearch-default.j2 index 2787fd59..8f1ff171 100644 --- a/ELK/elasticsearch/templates/elasticsearch-default.j2 +++ b/ELK/elasticsearch/templates/elasticsearch-default.j2 @@ -17,6 +17,7 @@ LOG_DIR={{ elasticsearch_log_dir }} # Elasticsearch PID directory #PID_DIR=/var/run/elasticsearch +{% if elasticsearch_major_version <= 2 %} # Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g ES_HEAP_SIZE={{ elasticsearch_heap_size }} # Heap new generation @@ -27,7 +28,7 @@ ES_HEAP_SIZE={{ elasticsearch_heap_size }} # Additional Java OPTS ES_JAVA_OPTS="{{ elasticsearch_additional_java_opts }}" - +{% endif %} # Configure restart on package upgrade (true, every other setting will lead to not restarting) #ES_RESTART_ON_UPGRADE=true diff --git a/ELK/elasticsearch/templates/elasticsearch.yml.j2 b/ELK/elasticsearch/templates/elasticsearch.yml.j2 index 7c045f71..0858b9ea 100644 --- a/ELK/elasticsearch/templates/elasticsearch.yml.j2 +++ b/ELK/elasticsearch/templates/elasticsearch.yml.j2 @@ -36,6 +36,7 @@ path.data: {{ elasticsearch_data_dir }} # path.logs: {{ elasticsearch_log_dir }} # +{% if elasticsearch_major_version <= 2 %} # ----------------------------------- Memory ----------------------------------- # # Lock the memory on startup: @@ -46,6 +47,7 @@ bootstrap.mlockall: true # available on the system and that the owner of the process is allowed to use this limit. # # Elasticsearch performs poorly when the system is swapping the memory. +{% endif %} # # ---------------------------------- Network ----------------------------------- #