From 29c964cca12cbaa1e2cb5e2e0a5b066c9953ccab Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:04:52 -0400 Subject: [PATCH] Set kafka.nodes state to run first to populate kafka.nodes pillar Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com> --- salt/kafka/init.sls | 4 ++++ salt/kafka/nodes.sls | 10 ++++------ 2 files changed, 8 insertions(+), 6 deletions(-) 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