mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-22 17:03:07 +01:00
create node_data pillar from mine data, use node_data pillar for filebeat config
This commit is contained in:
23
pillar/node_data/ips.sls
Normal file
23
pillar/node_data/ips.sls
Normal file
@@ -0,0 +1,23 @@
|
||||
{% set node_types = {} %}
|
||||
{% for minionid, ip in salt.saltutil.runner('mine.get', tgt='*', fun='network.ip_addrs', tgt_type='glob') | dictsort() %}
|
||||
{% set hostname = minionid.split('_')[0] %}
|
||||
{% set node_type = minionid.split('_')[1] %}
|
||||
{% if node_type not in node_types.keys() %}
|
||||
{% do node_types.update({node_type: {hostname: ip[0]}}) %}
|
||||
{% else %}
|
||||
{% if hostname not in node_types[node_type] %}
|
||||
{% do node_types[node_type].update({hostname: ip[0]}) %}
|
||||
{% else %}
|
||||
{% do node_types[node_type][hostname].update(ip[0]) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
node_data:
|
||||
{% for node_type, values in node_types.items() %}
|
||||
{{node_type}}:
|
||||
{% for hostname, ip in values.items() %}
|
||||
{{hostname}}:
|
||||
ip: {{ip}}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
23
pillar/node_data/test_ping.sls
Normal file
23
pillar/node_data/test_ping.sls
Normal file
@@ -0,0 +1,23 @@
|
||||
{% set node_types = {} %}
|
||||
{% for minionid, test_ping in salt.saltutil.runner('mine.get', tgt='*', fun='test.ping', tgt_type='glob') | dictsort() %}
|
||||
{% set node_type = minionid.split('_')[1] %}
|
||||
{% set hostname = minionid.split('_')[0] %}
|
||||
{% if node_type not in node_types.keys() %}
|
||||
{% do node_types.update({node_type: {hostname: test_ping}}) %}
|
||||
{% else %}
|
||||
{% if hostname not in node_types[node_type] %}
|
||||
{% do node_types[node_type].update({hostname: test_ping}) %}
|
||||
{% else %}
|
||||
{% do node_types[node_type][hostname].update(test_ping) %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
node_data:
|
||||
{% for node_type, values in node_types.items() %}
|
||||
{{node_type}}:
|
||||
{% for hostname, test_ping in values.items() %}
|
||||
{{hostname}}:
|
||||
test_ping: {{test_ping}}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -2,6 +2,8 @@ base:
|
||||
'*':
|
||||
- patch.needs_restarting
|
||||
- logrotate
|
||||
- node_data.ips
|
||||
- node_data.test_ping
|
||||
|
||||
'*_eval or *_helixsensor or *_heavynode or *_sensor or *_standalone or *_import':
|
||||
- match: compound
|
||||
|
||||
Reference in New Issue
Block a user