{% from 'vars/globals.map.jinja' import GLOBALS %} {% import_yaml 'elasticsearch/defaults.yaml' as ESCONFIG with context %} {% from 'logstash/map.jinja' import REDIS_NODES with context %} {% set HIGHLANDER = salt['pillar.get']('global:highlander', False) %} {% if grains.id.split('_') | last in ['manager','managersearch'] %} {% if REDIS_NODES | length > 1 %} {% do ESCONFIG.elasticsearch.config.node.update({'roles': ['master', 'data', 'remote_cluster_client']}) %} {% if HIGHLANDER %} {% do ESCONFIG.elasticsearch.config.node.roles.extend(['ml', 'transform']) %} {% endif %} {% do ESCONFIG.elasticsearch.config.update({'discovery': {'seed_hosts': [GLOBALS.manager]}}) %} {% for SN in REDIS_NODES.keys() %} {% do ESCONFIG.elasticsearch.config.discovery.seed_hosts.append(SN) %} {% endfor %} {% endif %} {% if grains.id.split('_') | last == 'manager' %} {% do ESCONFIG.elasticsearch.config.node.attr.update({'box_type': ''}) %} {% endif %} {% elif grains.id.split('_') | last not in ['eval', 'standalone', 'import'] %} {% do ESCONFIG.elasticsearch.config.node.update({'roles': ['data', 'ingest']}) %} {% if HIGHLANDER %} {% do ESCONFIG.elasticsearch.config.node.roles.extend(['ml', 'master', 'transform']) %} {% endif %} {% do ESCONFIG.elasticsearch.config.node.attr.update({'box_type': 'hot'}) %} {% do ESCONFIG.elasticsearch.config.update({'discovery': {'seed_hosts': [GLOBALS.manager]}}) %} {% endif %} {% if HIGHLANDER %} {% do ESCONFIG.elasticsearch.config.xpack.ml.update({'enabled': true}) %} {% endif %} {% do ESCONFIG.elasticsearch.config.node.update({'name': GLOBALS.hostname}) %} {% do ESCONFIG.elasticsearch.config.cluster.update({'name': GLOBALS.hostname}) %} {% do ESCONFIG.elasticsearch.config.transport.update({'publish_host': GLOBALS.hostname}) %} {# merge with the elasticsearch pillar #} {% set ESCONFIG = salt['pillar.get']('elasticsearch:config', default=ESCONFIG.elasticsearch.config, merge=True) %} {% if salt['pillar.get']('elasticsearch:config:path:repo', False) %} {% for repo in pillar.elasticsearch.config.path.repo %} {# remove elasticsearch.config.path.repo value if the directory doesn't exist on the node #} {% if not salt['file.directory_exists'](repo) %} {% do ESCONFIG.path.repo.remove(repo) %} {% endif %} {% endfor %} {% endif %}