create node_data pillar from mine data, use node_data pillar for filebeat config

This commit is contained in:
m0duspwnens
2021-12-13 15:48:30 -05:00
parent 86f67198bf
commit 8d0872bce5
5 changed files with 55 additions and 2 deletions
+6 -2
View File
@@ -324,8 +324,12 @@ output.logstash:
hosts:
{%- set LOADBALANCE = ['false'] %}
{%- if grains.role not in ['so-heavynode', 'so-import', 'so-helix', 'so-eval'] %}
{%- for minionid, ip in salt['mine.get']('G@role:so-standalone or G@role:so-manager or G@role:so-managersearch or G@role:so-receiver', 'network.ip_addrs', tgt_type='compound') | dictsort() %}
- "{{ minionid.split('_')[0] }}:5644" #{{ ip[0] }}
{%- for node_type, node_details in salt['pillar.get']('node_data') | dictsort() %}
{%- if node_type in ['manager', 'managersearch', 'standalone', 'receiver' ] %}
{%- for hostname in node_type.keys() %}
- "{{ hostname }}:5644" #{{ node_details[hostname][ip] }}
{%- endfor %}
{%- endif %}
{%- if loop.index == 2 %}
{%- do LOADBALANCE.insert(0, 'true') %}
{%- endif %}
@@ -1,3 +1,4 @@
mine_functions:
test.ping: []
network.ip_addrs:
- interface: {{ pillar.host.mainint }}