diff --git a/elk_metrics_7x/roles/elastic_data_hosts/defaults/main.yml b/elk_metrics_7x/roles/elastic_data_hosts/defaults/main.yml index 5c31b2b3..edc8bba0 100644 --- a/elk_metrics_7x/roles/elastic_data_hosts/defaults/main.yml +++ b/elk_metrics_7x/roles/elastic_data_hosts/defaults/main.yml @@ -34,3 +34,6 @@ elastic_data_interface: "{{ ansible_default_ipv4['alias'] }}" ## Elasticsearch index template settings # Set the default max number of fields used in a query # elastic_max_docvalue_fields_search: "100" + +# The set of nodes used for elasticsearch discovery +# elasticsearch_discovery_seed_hosts: "{{ (elastic_hosts | union(groups['kibana'])) | map('extract', hostvars, 'ansible_host') | list }}" diff --git a/elk_metrics_7x/roles/elastic_data_hosts/vars/data-node-variables.yml b/elk_metrics_7x/roles/elastic_data_hosts/vars/data-node-variables.yml index b72bcc5b..f167cb87 100644 --- a/elk_metrics_7x/roles/elastic_data_hosts/vars/data-node-variables.yml +++ b/elk_metrics_7x/roles/elastic_data_hosts/vars/data-node-variables.yml @@ -91,9 +91,10 @@ coordination_nodes: |- | map('regex_replace', '(.*)' ,'\1:' ~ elastic_port) | list)) }} -zen_nodes: >- +_elasticsearch_discovery_seed_hosts: >- {{ - (groups['elastic'] | union(groups['kibana'])) | map('extract', hostvars, 'ansible_host') | list | shuffle(seed=inventory_hostname) + elasticsearch_discovery_seed_hosts + | default((groups['elastic'] | union(groups['kibana'])) | map('extract', hostvars, 'ansible_host') | list) }} elasticserch_interface_speed: |- diff --git a/elk_metrics_7x/roles/elasticsearch/templates/elasticsearch.yml.j2 b/elk_metrics_7x/roles/elasticsearch/templates/elasticsearch.yml.j2 index d2eb058b..906cfcce 100644 --- a/elk_metrics_7x/roles/elasticsearch/templates/elasticsearch.yml.j2 +++ b/elk_metrics_7x/roles/elasticsearch/templates/elasticsearch.yml.j2 @@ -82,7 +82,8 @@ http.port: {{ elastic_port }} # Pass an initial list of hosts to perform discovery when this node is started: # The default list of hosts is ["127.0.0.1", "[::1]"] # -discovery.seed_hosts: {{ zen_nodes | to_json }} +discovery.seed_hosts: {{ _elasticsearch_discovery_seed_hosts | shuffle(seed=inventory_hostname) | to_json }} + # # Bootstrap the cluster using an initial set of master-eligible nodes: # diff --git a/elk_metrics_7x/showElasticCluster.yml b/elk_metrics_7x/showElasticCluster.yml index b818079f..082150ae 100644 --- a/elk_metrics_7x/showElasticCluster.yml +++ b/elk_metrics_7x/showElasticCluster.yml @@ -42,9 +42,9 @@ debug: msg: "Coordination nodes: {{ coordination_nodes }}" - - name: "Report Zen nodes" + - name: "Report Elasticsearch discovery nodes" debug: - msg: "Zen nodes: {{ zen_nodes }}" + msg: "Elasticsearch discovery nodes: {{ _elasticsearch_discovery_seed_hosts }}" delegate_to: elastic[0] run_once: true