diff --git a/roles/elasticsearch/templates/elasticsearch.yml.j2 b/roles/elasticsearch/templates/elasticsearch.yml.j2 index 6005f522..dd55dee2 100644 --- a/roles/elasticsearch/templates/elasticsearch.yml.j2 +++ b/roles/elasticsearch/templates/elasticsearch.yml.j2 @@ -2,9 +2,11 @@ node.name: "{{ ansible_hostname }}" path.data: {{ elasticsearch_datapath }} path.logs: /var/log/elasticsearch network.host: ["_local_","_site_"] +{% if elastic_release < 8 or groups['elasticsearch'] | length > 1 %} discovery.seed_hosts: [ {% for host in groups['elasticsearch'] %} "{{ hostvars[host].ansible_default_ipv4.address | default(hostvars[host].ansible_all_ipv4_addresses[0]) }}"{% if not loop.last %},{% endif %} {% endfor %} ] +{% endif %} cluster.initial_master_nodes: [ {% for host in groups['elasticsearch'] %} "{{ hostvars[host].ansible_hostname }}"{% if not loop.last %},{% endif %} {% endfor %} ]