Skip to content

Commit 796eefc

Browse files
authored
Merge pull request #12965 from Security-Onion-Solutions/orchit
searchnode installation improvements
2 parents af68188 + 1862dea commit 796eefc

File tree

5 files changed

+64
-3
lines changed

5 files changed

+64
-3
lines changed

salt/elasticsearch/download.sls

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
2+
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
3+
# https://securityonion.net/license; you may not use this file except in compliance with the
4+
# Elastic License 2.0.
5+
6+
{% from 'allowed_states.map.jinja' import allowed_states %}
7+
{% if sls.split('.')[0] in allowed_states %}
8+
{% from 'vars/globals.map.jinja' import GLOBALS %}
9+
10+
so-elasticsearch_image:
11+
docker_image.present:
12+
- name: {{ GLOBALS.registry_host }}:5000/{{ GLOBALS.image_repo }}/so-elasticsearch:{{ GLOBALS.so_version }}
13+
14+
{% else %}
15+
16+
{{sls}}_state_not_allowed:
17+
test.fail_without_changes:
18+
- name: {{sls}}_state_not_allowed
19+
20+
{% endif %}

salt/logstash/download.sls

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
2+
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
3+
# https://securityonion.net/license; you may not use this file except in compliance with the
4+
# Elastic License 2.0.
5+
6+
{% from 'allowed_states.map.jinja' import allowed_states %}
7+
{% if sls.split('.')[0] in allowed_states %}
8+
{% from 'vars/globals.map.jinja' import GLOBALS %}
9+
10+
so-logstash_image:
11+
docker_image.present:
12+
- name: {{ GLOBALS.registry_host }}:5000/{{ GLOBALS.image_repo }}/so-logstash:{{ GLOBALS.so_version }}
13+
14+
{% else %}
15+
16+
{{sls}}_state_not_allowed:
17+
test.fail_without_changes:
18+
- name: {{sls}}_state_not_allowed
19+
20+
{% endif %}

salt/manager/tools/sbin/so-minion

+4
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,10 @@ function updateMineAndApplyStates() {
604604
#checkMine "network.ip_addrs"
605605
# calls so-common and set_minionid sets MINIONID to local minion id
606606
set_minionid
607+
# if this is a searchnode or heavynode, start downloading logstash and elasticsearch containers while the manager prepares for the new node
608+
if [[ "$NODETYPE" == "SEARCHNODE" || "$NODETYPE" == "HEAVYNODE" ]]; then
609+
salt-run state.orch orch.container_download pillar="{'setup': {'newnode': $MINION_ID }}" > /dev/null 2>&1 &
610+
fi
607611
# $MINIONID is the minion id of the manager and $MINION_ID is the target node or the node being configured
608612
salt-run state.orch orch.deploy_newnode pillar="{'setup': {'manager': $MINIONID, 'newnode': $MINION_ID }}" > /dev/null 2>&1 &
609613
}

salt/orch/container_download.sls

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
2+
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
3+
# https://securityonion.net/license; you may not use this file except in compliance with the
4+
# Elastic License 2.0.
5+
6+
{% set NEWNODE = salt['pillar.get']('setup:newnode') %}
7+
8+
{% if NEWNODE.split('_')|last in ['searchnode', 'heavynode'] %}
9+
{{NEWNODE}}_download_logstash_elasticsearch:
10+
salt.state:
11+
- tgt: {{ NEWNODE }}
12+
- sls:
13+
- repo.client
14+
- docker
15+
- logstash.download
16+
- elasticsearch.download
17+
{% endif %}

salt/top.sls

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ base:
144144

145145
'*_searchnode and G@saltversion:{{saltversion}}':
146146
- match: compound
147+
- firewall
147148
- ssl
149+
- elasticsearch
150+
- logstash
148151
- sensoroni
149152
- telegraf
150153
- nginx
151-
- firewall
152-
- elasticsearch
153-
- logstash
154154
- elasticfleet.install_agent_grid
155155
- stig
156156

0 commit comments

Comments
 (0)