Set kafka.nodes state to run first to populate kafka.nodes pillar

Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com>
This commit is contained in:
reyesj2
2024-04-29 09:04:52 -04:00
parent 36573d6005
commit 29c964cca1
2 changed files with 8 additions and 6 deletions

View File

@@ -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 %}

View File

@@ -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 %}
COMBINED_KAFKANODES: {{ COMBINED_KAFKANODES }}