|
| 1 | +{# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one |
| 2 | + or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at |
| 3 | + https://securityonion.net/license; you may not use this file except in compliance with the |
| 4 | + Elastic License 2.0. #} |
| 5 | + |
1 | 6 | {% from 'vars/globals.map.jinja' import GLOBALS %}
|
2 | 7 | {% import_yaml 'elasticsearch/defaults.yaml' as ELASTICSEARCHDEFAULTS with context %}
|
3 | 8 |
|
4 | 9 | {% set HIGHLANDER = salt['pillar.get']('global:highlander', False) %}
|
5 | 10 |
|
6 |
| -{# ES_LOGSTASH_NODES is the same as LOGSTASH_NODES from logstash/map.jinja but heavynodes and fleet nodes are removed #} |
7 |
| -{% set ES_LOGSTASH_NODES = [] %} |
8 |
| -{% set node_data = salt['pillar.get']('logstash:nodes', {GLOBALS.role.split('-')[1]: {GLOBALS.hostname: {'ip': GLOBALS.node_ip}}}) %} |
| 11 | +{# this is a list of dicts containing hostname:ip for elasticsearch nodes that need to know about each other for cluster #} |
| 12 | +{% set ELASTICSEARCH_SEED_HOSTS = [] %} |
| 13 | +{% set node_data = salt['pillar.get']('elasticsearch:nodes', {GLOBALS.role.split('-')[1]: {GLOBALS.hostname: {'ip': GLOBALS.node_ip}}}) %} |
9 | 14 | {% for node_type, node_details in node_data.items() | sort %}
|
10 |
| -{% if node_type not in ['heavynode', 'fleet'] %} |
| 15 | +{% if node_type != 'heavynode' %} |
11 | 16 | {% for hostname in node_data[node_type].keys() %}
|
12 |
| -{% do ES_LOGSTASH_NODES.append({hostname:node_details[hostname].ip}) %} |
| 17 | +{% do ELASTICSEARCH_SEED_HOSTS.append({hostname:node_details[hostname].ip}) %} |
13 | 18 | {% endfor %}
|
14 | 19 | {% endif %}
|
15 | 20 | {% endfor %}
|
16 | 21 |
|
| 22 | +{# this is a list of dicts containing hostname:ip of all nodes running elasticsearch #} |
| 23 | +{% set ELASTICSEARCH_NODES = [] %} |
| 24 | +{% set node_data = salt['pillar.get']('elasticsearch:nodes', {GLOBALS.role.split('-')[1]: {GLOBALS.hostname: {'ip': GLOBALS.node_ip}}}) %} |
| 25 | +{% for node_type, node_details in node_data.items() %} |
| 26 | +{% for hostname in node_data[node_type].keys() %} |
| 27 | +{% do ELASTICSEARCH_NODES.append({hostname:node_details[hostname].ip}) %} |
| 28 | +{% endfor %} |
| 29 | +{% endfor %} |
| 30 | + |
17 | 31 | {% if grains.id.split('_') | last in ['manager','managersearch','standalone'] %}
|
18 |
| - {% if ES_LOGSTASH_NODES | length > 1 %} |
| 32 | + {% if ELASTICSEARCH_SEED_HOSTS | length > 1 %} |
19 | 33 | {% do ELASTICSEARCHDEFAULTS.elasticsearch.config.update({'discovery': {'seed_hosts': []}}) %}
|
20 |
| - {% for NODE in ES_LOGSTASH_NODES %} |
| 34 | + {% for NODE in ELASTICSEARCH_SEED_HOSTS %} |
21 | 35 | {% do ELASTICSEARCHDEFAULTS.elasticsearch.config.discovery.seed_hosts.append(NODE.keys()|first) %}
|
22 | 36 | {% endfor %}
|
23 | 37 | {% endif %}
|
|
0 commit comments