diff --git a/elk_metrics_6x/roles/elastic_data_hosts/vars/data-node-variables.yml b/elk_metrics_6x/roles/elastic_data_hosts/vars/data-node-variables.yml
index a161df10..0cb7de96 100644
--- a/elk_metrics_6x/roles/elastic_data_hosts/vars/data-node-variables.yml
+++ b/elk_metrics_6x/roles/elastic_data_hosts/vars/data-node-variables.yml
@@ -47,8 +47,13 @@ data_nodes: |-
   {% for node in groups['elastic-logstash'] %}
   {%   if (hostvars[node]['elasticsearch_node_data'] is defined) and (hostvars[node]['elasticsearch_node_data'] | bool) %}
   {%     set _ = nodes.append(node) %}
-  {%   elif (node in _data_nodes) %}
-  {%     set _ = nodes.append(node) %}
+  {%   endif %}
+  {% endfor %}
+  {% for node in groups['elastic-logstash'] %}
+  {%   if (nodes | length) <= (_data_nodes | length) %}
+  {%     if (node in _data_nodes) %}
+  {%       set _ = nodes.append(node) %}
+  {%     endif %}
   {%   endif %}
   {% endfor %}
   {{ nodes }}
@@ -62,8 +67,13 @@ logstash_nodes: |-
   {% for node in groups['elastic-logstash'] %}
   {%   if (hostvars[node]['elasticsearch_node_ingest'] is defined) and (hostvars[node]['elasticsearch_node_ingest'] | bool) %}
   {%     set _ = nodes.append(node) %}
-  {%   elif (node in _logstash_nodes) %}
-  {%     set _ = nodes.append(node) %}
+  {%   endif %}
+  {% endfor %}
+  {% for node in groups['elastic-logstash'] %}
+  {%   if (nodes | length) <= (_logstash_nodes | length) %}
+  {%     if (node in _logstash_nodes) %}
+  {%       set _ = nodes.append(node) %}
+  {%     endif %}
   {%   endif %}
   {% endfor %}
   {{ nodes }}
@@ -77,8 +87,13 @@ ingest_nodes: |-
   {% for node in groups['elastic-logstash'] %}
   {%   if (hostvars[node]['elasticsearch_node_ingest'] is defined) and (hostvars[node]['elasticsearch_node_ingest'] | bool) %}
   {%     set _ = nodes.append(node) %}
-  {%   elif (node in _ingest_nodes) %}
-  {%     set _ = nodes.append(node) %}
+  {%   endif %}
+  {% endfor %}
+  {% for node in groups['elastic-logstash'] %}
+  {%   if (nodes | length) <= (_ingest_nodes | length) %}
+  {%     if (node in _ingest_nodes) %}
+  {%       set _ = nodes.append(node) %}
+  {%     endif %}
   {%   endif %}
   {% endfor %}
   {{ nodes }}
diff --git a/elk_metrics_6x/roles/elasticsearch/templates/elasticsearch.yml.j2 b/elk_metrics_6x/roles/elasticsearch/templates/elasticsearch.yml.j2
index 655aa494..3abdee83 100644
--- a/elk_metrics_6x/roles/elasticsearch/templates/elasticsearch.yml.j2
+++ b/elk_metrics_6x/roles/elasticsearch/templates/elasticsearch.yml.j2
@@ -64,7 +64,7 @@ http.port: {{ elastic_port }}
 #<https://www.elastic.co/guide/en/elasticsearch/reference/6.2/modules-node.html>
 discovery.zen.ping.unicast.hosts: {{ zen_nodes | to_json }}
 # Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
-discovery.zen.minimum_master_nodes: {{ ((master_node_count | int) // 2) + 1 }}
+discovery.zen.minimum_master_nodes: {{ elasticsearch_master_node_count | default(((master_node_count | int) // 2) + 1) }}
 # The first set of nodes in the master_node_count are marked as such
 node.master: {{ elasticsearch_node_master | default(master_node) }}
 # Every node in the master list and every other node after will be a data node
@@ -91,7 +91,7 @@ search.remote.connect: {{ data_node }}
 #
 # Block initial recovery after a full cluster restart until N nodes are started:
 #
-gateway.recover_after_nodes: {{ ((master_node_count | int) // 2) + 1 }}
+gateway.recover_after_nodes: {{ elasticsearch_master_node_count | default(((master_node_count | int) // 2) + 1) }}
 #
 # For more information, see the documentation at:
 # <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>