library/roles/ELK/elasticsearch: install the elasticsearch configuration and the debian default from templates.
This commit is contained in:
parent
51d5e37310
commit
c8645263ce
|
@ -7,3 +7,16 @@ elasticsearch_packages:
|
|||
elasticsearch_cluster_name: 'Elasticsearch Cluster'
|
||||
elasticsearch_enabled: True
|
||||
elasticsearch_http_port: 9200
|
||||
elasticsearch_data_dir: /var/lib/elasticsearch
|
||||
elasticsearch_log_dir: /var/log/elasticsearch
|
||||
elasticsearch_bind_ip: 127.0.0.1
|
||||
elasticsearch_discovery_host_list: '["127.0.0.1", "[::1]"]'
|
||||
elasticsearch_define_majority_of_nodes: False
|
||||
elasticsearch_majority_of_nodes: 3
|
||||
elasticsearch_recover_after_nodes: 3
|
||||
elasticsearch_max_local_storage_nodes: 1
|
||||
elasticsearch_destructive_requires_name: True
|
||||
elasticsearch_define_heap_size: False
|
||||
elasticsearch_heap_size: 2g
|
||||
elasticsearch_additional_java_opts: ''
|
||||
elasticsearch_max_open_files: 65535
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Restart elasticsearch
|
||||
service: name=elasticsearch state=restarted enabled=yes
|
||||
when: elasticsearch_enabled
|
||||
|
|
@ -12,8 +12,23 @@
|
|||
with_items: '{{ elasticsearch_packages }}'
|
||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||
|
||||
- name: Install the elasticsearch startup default
|
||||
template: src=elasticsearch-default.j2 dest=/etc/default/elasticsearch owner=root group=elasticsearch mode=0640
|
||||
notify: Restart elasticsearch
|
||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||
|
||||
- name: Install the elasticsearch configuration
|
||||
template: src=elasticsearch.yml.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root group=elasticsearch mode=0640
|
||||
notify: Restart elasticsearch
|
||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||
|
||||
- name: Ensure that elasticsearch is enabled and running
|
||||
service: name=elasticsearch state=started enabled=yes
|
||||
when: elasticsearch_enabled
|
||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||
|
||||
- name: Ensure that elasticsearch is disabled and stopped
|
||||
service: name=elasticsearch state=stopped enabled=no
|
||||
when: not elasticsearch_enabled
|
||||
tags: [ 'ELK', 'elasticsearch', 'elk' ]
|
||||
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
################################
|
||||
# Elasticsearch
|
||||
################################
|
||||
|
||||
# Elasticsearch home directory
|
||||
#ES_HOME=/usr/share/elasticsearch
|
||||
|
||||
# Elasticsearch configuration directory
|
||||
#CONF_DIR=/etc/elasticsearch
|
||||
|
||||
# Elasticsearch data directory
|
||||
DATA_DIR={{ elasticsearch_data_dir }}
|
||||
|
||||
# Elasticsearch logs directory
|
||||
LOG_DIR={{ elasticsearch_log_dir }}
|
||||
|
||||
# Elasticsearch PID directory
|
||||
#PID_DIR=/var/run/elasticsearch
|
||||
|
||||
{% if elasticsearch_define_heap_size %}
|
||||
# Heap size defaults to 256m min, 1g max
|
||||
# Set ES_HEAP_SIZE to 50% of available RAM, but no more than 31g
|
||||
ES_HEAP_SIZE={{ elasticsearch_heap_size }}
|
||||
# Heap new generation
|
||||
#ES_HEAP_NEWSIZE=
|
||||
|
||||
# Maximum direct memory
|
||||
#ES_DIRECT_SIZE=
|
||||
{% endif %}
|
||||
|
||||
# Additional Java OPTS
|
||||
ES_JAVA_OPTS={{ elasticsearch_additional_java_opts }}
|
||||
|
||||
# Configure restart on package upgrade (true, every other setting will lead to not restarting)
|
||||
#ES_RESTART_ON_UPGRADE=true
|
||||
|
||||
# Path to the GC log file
|
||||
#ES_GC_LOG_FILE=/var/log/elasticsearch/gc.log
|
||||
|
||||
################################
|
||||
# Elasticsearch service
|
||||
################################
|
||||
|
||||
# SysV init.d
|
||||
#
|
||||
# When executing the init script, this user will be used to run the elasticsearch service.
|
||||
# The default value is 'elasticsearch' and is declared in the init.d file.
|
||||
# Note that this setting is only used by the init script. If changed, make sure that
|
||||
# the configured user can read and write into the data, work, plugins and log directories.
|
||||
# For systemd service, the user is usually configured in file /usr/lib/systemd/system/elasticsearch.service
|
||||
ES_USER=elasticsearch
|
||||
ES_GROUP=elasticsearch
|
||||
|
||||
# The number of seconds to wait before checking if Elasticsearch started successfully as a daemon process
|
||||
ES_STARTUP_SLEEP_TIME=5
|
||||
|
||||
################################
|
||||
# System properties
|
||||
################################
|
||||
|
||||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
# When using Systemd, this setting is ignored and the LimitNOFILE defined in
|
||||
# /usr/lib/systemd/system/elasticsearch.service takes precedence
|
||||
MAX_OPEN_FILES={{ elasticsearch_max_open_files }}
|
||||
|
||||
{% if elasticsearch_define_heap_size %}
|
||||
# The maximum number of bytes of memory that may be locked into RAM
|
||||
# Set to "unlimited" if you use the 'bootstrap.mlockall: true' option
|
||||
# in elasticsearch.yml (ES_HEAP_SIZE must also be set).
|
||||
# When using Systemd, the LimitMEMLOCK property must be set
|
||||
# in /usr/lib/systemd/system/elasticsearch.service
|
||||
MAX_LOCKED_MEMORY=unlimited
|
||||
{% endif %}
|
||||
|
||||
# Maximum number of VMA (Virtual Memory Areas) a process can own
|
||||
# When using Systemd, this setting is ignored and the 'vm.max_map_count'
|
||||
# property is set at boot time in /usr/lib/sysctl.d/elasticsearch.conf
|
||||
#MAX_MAP_COUNT=262144
|
|
@ -0,0 +1,99 @@
|
|||
# ======================== Elasticsearch Configuration =========================
|
||||
#
|
||||
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
|
||||
# Before you set out to tweak and tune the configuration, make sure you
|
||||
# understand what are you trying to accomplish and the consequences.
|
||||
#
|
||||
# The primary way of configuring a node is via this file. This template lists
|
||||
# the most important settings you may want to configure for a production cluster.
|
||||
#
|
||||
# Please see the documentation for further information on configuration options:
|
||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
|
||||
#
|
||||
# ---------------------------------- Cluster -----------------------------------
|
||||
#
|
||||
# Use a descriptive name for your cluster:
|
||||
#
|
||||
cluster.name: {{ elasticsearch_cluster_name }}
|
||||
#
|
||||
# ------------------------------------ Node ------------------------------------
|
||||
#
|
||||
# Use a descriptive name for the node:
|
||||
#
|
||||
node.name: {{ ansible_fqdn }}
|
||||
#
|
||||
# Add custom attributes to the node:
|
||||
#
|
||||
# node.rack: r1
|
||||
#
|
||||
# ----------------------------------- Paths ------------------------------------
|
||||
#
|
||||
# Path to directory where to store the data (separate multiple locations by comma):
|
||||
#
|
||||
path.data: {{ elasticsearch_data_dir }}
|
||||
#
|
||||
# Path to log files:
|
||||
#
|
||||
path.logs: {{ elasticsearch_log_dir }}
|
||||
#
|
||||
{% if elasticsearch_define_heap_size %}
|
||||
# ----------------------------------- Memory -----------------------------------
|
||||
#
|
||||
# Lock the memory on startup:
|
||||
#
|
||||
bootstrap.mlockall: true
|
||||
#
|
||||
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
|
||||
# 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 -----------------------------------
|
||||
#
|
||||
# Set the bind address to a specific IP (IPv4 or IPv6):
|
||||
#
|
||||
network.host: {{ elasticsearch_bind_ip }}
|
||||
#
|
||||
# Set a custom port for HTTP:
|
||||
#
|
||||
http.port: {{ elasticsearch_http_port }}
|
||||
#
|
||||
# For more information, see the documentation at:
|
||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
|
||||
#
|
||||
# --------------------------------- Discovery ----------------------------------
|
||||
#
|
||||
# Pass an initial list of hosts to perform discovery when new node is started:
|
||||
# The default list of hosts is ["127.0.0.1", "[::1]"]
|
||||
#
|
||||
discovery.zen.ping.unicast.hosts: {{ elasticsearch_discovery_host_list }}
|
||||
#
|
||||
{% if elasticsearch_define_majority_of_nodes %}
|
||||
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
|
||||
#
|
||||
discovery.zen.minimum_master_nodes: {{ elasticsearch_majority_of_nodes }}
|
||||
#
|
||||
# For more information, see the documentation at:
|
||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
|
||||
#
|
||||
# ---------------------------------- Gateway -----------------------------------
|
||||
#
|
||||
# Block initial recovery after a full cluster restart until N nodes are started:
|
||||
#
|
||||
gateway.recover_after_nodes:
|
||||
#
|
||||
# For more information, see the documentation at:
|
||||
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
|
||||
#
|
||||
{% endif %}
|
||||
# ---------------------------------- Various -----------------------------------
|
||||
#
|
||||
# Disable starting multiple nodes on a single system:
|
||||
#
|
||||
node.max_local_storage_nodes: {{ elasticsearch_max_local_storage_nodes }}
|
||||
#
|
||||
# Require explicit names when deleting indices:
|
||||
#
|
||||
action.destructive_requires_name: {{ elasticsearch_destructive_requires_name }}
|
||||
|
Loading…
Reference in New Issue