mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
update mine instead of failing highstate if no node_data
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if node_types %}
|
||||
node_data:
|
||||
{% for node_type, host_values in node_types.items() %}
|
||||
{% for hostname, details in host_values.items() %}
|
||||
@@ -33,3 +34,6 @@ node_data:
|
||||
role: {{node_type}}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
node_data: False
|
||||
{% endif %}
|
||||
|
||||
7
salt/mine/update.sls
Normal file
7
salt/mine/update.sls
Normal file
@@ -0,0 +1,7 @@
|
||||
# This state sends an event to the salt-master event bus
|
||||
# The event will be caught by the reactor and trigger the mine_update orchestration
|
||||
|
||||
send_mine_update_event:
|
||||
module.run:
|
||||
- name: event.send
|
||||
- tag: salt/minion/{{grains.id}}/mine_update
|
||||
21
salt/orch/mine_update.sls
Normal file
21
salt/orch/mine_update.sls
Normal file
@@ -0,0 +1,21 @@
|
||||
# Get the minion ID from the pillar
|
||||
{% set MINION_ID = salt['pillar.get']('minion_id') %}
|
||||
|
||||
# Run mine.update on all minions
|
||||
update_mine_all_minions:
|
||||
salt.function:
|
||||
- name: mine.update
|
||||
- tgt: '*'
|
||||
- batch: 50
|
||||
- retry:
|
||||
attempts: 3
|
||||
interval: 1
|
||||
|
||||
# Run highstate on the original minion
|
||||
run_highstate_on_original_minion:
|
||||
salt.state:
|
||||
- tgt: {{ MINION_ID }}
|
||||
- highstate: True
|
||||
- queue: True
|
||||
- require:
|
||||
- salt: update_mine_all_minions
|
||||
8
salt/reactor/mine_update.sls
Normal file
8
salt/reactor/mine_update.sls
Normal file
@@ -0,0 +1,8 @@
|
||||
# This reactor triggers the mine_update orchestration when it receives a mine_update event
|
||||
|
||||
trigger_mine_update_orchestration:
|
||||
runner.state.orchestrate:
|
||||
- args:
|
||||
- mods: orch.mine_update
|
||||
- pillar:
|
||||
minion_id: {{ data['id'] }}
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
include:
|
||||
- salt.minion
|
||||
- salt.master.reactor_config_mine_update
|
||||
|
||||
hold_salt_master_package:
|
||||
module.run:
|
||||
|
||||
30
salt/top.sls
30
salt/top.sls
@@ -22,7 +22,11 @@ base:
|
||||
- salt.minion-state-apply-test
|
||||
- salt.minion
|
||||
|
||||
'* and G@saltversion:{{saltversion}}':
|
||||
'*_eval or *_manager* or *_standalone or *_import and I@node_data:False':
|
||||
- match: compound
|
||||
- mine.update
|
||||
|
||||
'* and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.minion
|
||||
- patch.os.schedule
|
||||
@@ -33,7 +37,7 @@ base:
|
||||
- docker
|
||||
- docker_clean
|
||||
|
||||
'*_sensor and G@saltversion:{{saltversion}}':
|
||||
'*_sensor and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- sensor
|
||||
- ssl
|
||||
@@ -49,7 +53,7 @@ base:
|
||||
- elasticfleet.install_agent_grid
|
||||
- stig
|
||||
|
||||
'*_eval and G@saltversion:{{saltversion}}':
|
||||
'*_eval and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.master
|
||||
- sensor
|
||||
@@ -81,7 +85,7 @@ base:
|
||||
- utility
|
||||
- elasticfleet
|
||||
|
||||
'*_manager and G@saltversion:{{saltversion}}':
|
||||
'*_manager and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.master
|
||||
- ca
|
||||
@@ -112,7 +116,7 @@ base:
|
||||
- stig
|
||||
- kafka
|
||||
|
||||
'*_standalone and G@saltversion:{{saltversion}}':
|
||||
'*_standalone and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.master
|
||||
- sensor
|
||||
@@ -148,7 +152,7 @@ base:
|
||||
- stig
|
||||
- kafka
|
||||
|
||||
'*_searchnode and G@saltversion:{{saltversion}}':
|
||||
'*_searchnode and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- firewall
|
||||
- ssl
|
||||
@@ -161,7 +165,7 @@ base:
|
||||
- stig
|
||||
- kafka
|
||||
|
||||
'*_managersearch and G@saltversion:{{saltversion}}':
|
||||
'*_managersearch and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.master
|
||||
- ca
|
||||
@@ -192,7 +196,7 @@ base:
|
||||
- stig
|
||||
- kafka
|
||||
|
||||
'*_heavynode and G@saltversion:{{saltversion}}':
|
||||
'*_heavynode and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- sensor
|
||||
- ssl
|
||||
@@ -211,7 +215,7 @@ base:
|
||||
- elasticfleet.install_agent_grid
|
||||
- elasticagent
|
||||
|
||||
'*_import and G@saltversion:{{saltversion}}':
|
||||
'*_import and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- salt.master
|
||||
- sensor
|
||||
@@ -239,7 +243,7 @@ base:
|
||||
- zeek
|
||||
- elasticfleet
|
||||
|
||||
'*_receiver and G@saltversion:{{saltversion}}':
|
||||
'*_receiver and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- ssl
|
||||
- sensoroni
|
||||
@@ -251,7 +255,7 @@ base:
|
||||
- kafka
|
||||
- stig
|
||||
|
||||
'*_idh and G@saltversion:{{saltversion}}':
|
||||
'*_idh and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- ssl
|
||||
- sensoroni
|
||||
@@ -260,7 +264,7 @@ base:
|
||||
- elasticfleet.install_agent_grid
|
||||
- idh
|
||||
|
||||
'*_fleet and G@saltversion:{{saltversion}}':
|
||||
'*_fleet and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- match: compound
|
||||
- ssl
|
||||
- sensoroni
|
||||
@@ -272,7 +276,7 @@ base:
|
||||
- elasticfleet.install_agent_grid
|
||||
- schedule
|
||||
|
||||
'*_desktop and G@saltversion:{{saltversion}}':
|
||||
'*_desktop and G@saltversion:{{saltversion}} and not I@node_data:False':
|
||||
- ssl
|
||||
- sensoroni
|
||||
- telegraf
|
||||
|
||||
Reference in New Issue
Block a user