diff --git a/salt/kafka/init.sls b/salt/kafka/init.sls index acedba3c3..c4351ebfc 100644 --- a/salt/kafka/init.sls +++ b/salt/kafka/init.sls @@ -7,6 +7,10 @@ {% from 'vars/globals.map.jinja' import GLOBALS %} include: +{# Run kafka/nodes.sls before Kafka is enabled, so kafka nodes pillar is setup #} +{% if grains.role in ['so-manager','so-managersearch', 'so-standalone'] %} + - kafka.nodes +{% endif %} {% if GLOBALS.pipeline == "KAFKA" and KAFKAMERGED.enabled %} - kafka.enabled {% else %} diff --git a/salt/kafka/nodes.sls b/salt/kafka/nodes.sls index 5085c6cca..edc5f0701 100644 --- a/salt/kafka/nodes.sls +++ b/salt/kafka/nodes.sls @@ -2,11 +2,10 @@ # or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at # https://securityonion.net/license; you may not use this file except in compliance with the # Elastic License 2.0. -{% from 'vars/globals.map.jinja' import GLOBALS %} -{% if GLOBALS.pipeline == "KAFKA" %} -{% from 'kafka/nodes.map.jinja' import COMBINED_KAFKANODES %} -{# Store kafka pillar in a file rather than memory where values could be lost. Kafka does not support nodeid's changing #} +{% from 'kafka/nodes.map.jinja' import COMBINED_KAFKANODES %} + +{# Write Kafka pillar, so all grid members have access to nodeid of other kafka nodes and their roles #} write_kafka_pillar_yaml: file.managed: - name: /opt/so/saltstack/local/pillar/kafka/nodes.sls @@ -15,5 +14,4 @@ write_kafka_pillar_yaml: - source: salt://kafka/files/managed_node_pillar.jinja - template: jinja - context: - COMBINED_KAFKANODES: {{ COMBINED_KAFKANODES }} -{% endif %} \ No newline at end of file + COMBINED_KAFKANODES: {{ COMBINED_KAFKANODES }} \ No newline at end of file