# {{ ansible_managed }}


# Path to directory where to store index data allocated for this node.
#
path.data: {{ elasticsearch_data_dir }}

# Path to log files:
#
path.logs: {{ elasticsearch_log_dir }}

# ElasticSearch performs poorly when JVM starts swapping: you should ensure that
# it _never_ swaps.
#
# Set this property to true to lock the memory:
#
bootstrap.mlockall: true

# Disable dynamic scripting as it is insecure and we don't use it
# See: http://bouk.co/blog/elasticsearch-rce/
# CVE: CVE-2014-3120
script.disable_dynamic: true

# Unicast discovery allows to explicitly control which nodes will be used
# to discover the cluster. It can be used when multicast is not present,
# or to restrict the cluster communication-wise.
#
# 1. Disable multicast discovery (enabled by default):
#
# discovery.zen.ping.multicast.enabled: false
#
# 2. Configure an initial list of master nodes in the cluster
#    to perform discovery when new nodes (master or data) are started:
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2:port", "host3[portX-portY]"]
{%- if ELASTICSEARCH_CLUSTERED -%}
  {%- set hosts= [] -%}

  {%- for host in hostvars.keys() -%}
    {% do hosts.append(host) %}
  {%- endfor %}

discovery.zen.ping.unicast.hosts: ['{{hosts|join("\',\'") }}']

{% endif -%}

{% if vagrant_cluster|bool %}
network:
  host: {{ ansible_ssh_host }}
{% endif %}
