only add node to pillar if returned ip from mine

This commit is contained in:
m0duspwnens
2023-10-17 17:28:28 -04:00
parent d9862aefcf
commit 928fb23e96
3 changed files with 27 additions and 19 deletions

View File

@@ -7,6 +7,8 @@
tgt_type='compound') | dictsort()
%}
# only add a node to the pillar if it returned an ip from the mine
{% if ip[0] | length > 0%}
{% set hostname = cached_grains[minionid]['host'] %}
{% set node_type = minionid.split('_')[1] %}
{% if node_type not in node_types.keys() %}
@@ -18,8 +20,10 @@
{% do node_types[node_type][hostname].update(ip[0]) %}
{% endif %}
{% endif %}
{% fi %}
{% endfor %}
logstash:
nodes:
{% for node_type, values in node_types.items() %}

View File

@@ -4,6 +4,9 @@
{% set hostname = minionid.split('_')[0] %}
{% set node_type = minionid.split('_')[1] %}
{% set is_alive = False %}
# only add a node to the pillar if it returned an ip from the mine
{% if ip | length > 0%}
{% if minionid in manage_alived.keys() %}
{% if ip[0] == manage_alived[minionid] %}
{% set is_alive = True %}
@@ -18,6 +21,7 @@
{% do node_types[node_type][hostname].update({'ip':ip[0], 'alive':is_alive}) %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
node_data:

View File