From 6448ddc31afeae46db102c49910283df2d78fa28 Mon Sep 17 00:00:00 2001 From: TOoSmOotH Date: Thu, 17 Dec 2020 20:08:21 -0500 Subject: [PATCH] Allow SNs to resolve the ES master --- salt/elasticsearch/init.sls | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/salt/elasticsearch/init.sls b/salt/elasticsearch/init.sls index 300921807..c72e4ce26 100644 --- a/salt/elasticsearch/init.sls +++ b/salt/elasticsearch/init.sls @@ -23,6 +23,7 @@ {% set FEATURES = salt['pillar.get']('elastic:features', False) %} {% set NODEIP = salt['pillar.get']('elasticsearch:mainip', '') -%} {% set TRUECLUSTER = salt['pillar.get']('elasticsearch:true_cluster', False) %} +{% set MANAGERIP = salt['pillar.get']('global:managerip') %} {% if FEATURES is sameas true %} {% set FEATUREZ = "-features" %} @@ -192,11 +193,16 @@ so-elasticsearch: - name: so-elasticsearch - user: elasticsearch - extra_hosts: - - "{{ grains.host }}:{{ NODEIP }}" - {% if salt['pillar.get']('nodestab', {}) %} - {% for SN, SNDATA in salt['pillar.get']('nodestab', {}).items() %} - - "{{ SN.split('_')|first }}:{{ SNDATA.ip }}" - {% endfor %} + - extra_hosts: + {% if ismanager %} + - {{ grains.host }}:{{ NODEIP }} + {% if salt['pillar.get']('nodestab', {}) %} + {% for SN, SNDATA in salt['pillar.get']('nodestab', {}).items() %} + - {{ SN.split('_')|first }}:{{ SNDATA.ip }} + {% endfor %} + {% endif %} + {% else %} + - {{ MANAGER }}:{{ MANAGERIP }} {% endif %} - environment: {% if TRUECLUSTER is sameas false or (TRUECLUSTER is sameas true and not salt['pillar.get']('nodestab', {})) %}