add logic in orch

This commit is contained in:
m0duspwnens
2024-05-03 09:56:52 -04:00
parent 2929877042
commit bbc374b56e
3 changed files with 44 additions and 24 deletions

View File

@@ -607,20 +607,20 @@ function updateMineAndApplyStates() {
# tell the minion to populate the mine with data from mine_functions which is populated during setup
# this only needs to happen on non managers since they handle this during setup
# and they need to wait for ca creation to update the mine
updateMine
checkMine "network.ip_addrs"
#updateMine
#checkMine "network.ip_addrs"
# apply the elasticsearch state to the manager if a new searchnode was added
if [[ "$NODETYPE" == "SEARCHNODE" || "$NODETYPE" == "HEAVYNODE" ]]; then
#if [[ "$NODETYPE" == "SEARCHNODE" || "$NODETYPE" == "HEAVYNODE" ]]; then
# calls so-common and set_minionid sets MINIONID to local minion id
set_minionid
set_minionid
#salt $MINIONID state.apply elasticsearch queue=True --async
# salt $MINIONID state.apply soc queue=True --async
# $MINIONID is the minion id of the manager and $MINION_ID is the target node or the node being configured
salt-run state.orch orch.deploy_searchnode pillar="{'setup': {'manager': $MINIONID, 'searchnode': $MINION_ID }}"
else
salt-run state.orch orch.deploy_newnode pillar="{'setup': {'manager': $MINIONID, 'newnode': $MINION_ID }}"
#else
# run this async so the cli doesn't wait for a return
salt "$MINION_ID" state.highstate --async queue=True
fi
# salt "$MINION_ID" state.highstate --async queue=True
#fi
}
function setupMinionFiles() {

View File

@@ -0,0 +1,36 @@
{% set MANAGER = salt['pillar.get']('setup:manager') %}
{% set NEWNODE = salt['pillar.get']('setup:newnode') %}
{{NEWNODE}}_update_mine:
salt.function:
- name: mine.update
- tgt: {{ NEWNODE }}
- retry:
attempts: 24
interval: 5
{% if NEWNODE.split('_')|last in ['searchnode', 'heavynode'] %}
manager_run_es_soc:
salt.state:
- tgt: {{ MANAGER }}
- sls:
- elasticsearch
- soc
- kwarg:
queue: True
- retry:
attempts: 30
interval: 10
- require:
- salt: new_node_update_mine
{% endif %}
{{NEWNODE}}_run_highstate:
salt.state:
- tgt: {{ NEWNODE }}
- highstate: True
- kwarg:
queue: True
- retry:
attempts: 30
interval: 10

View File

@@ -1,16 +0,0 @@
{% set MANAGER = salt['pillar.get']('setup:manager') %}
{% set SEARCHNODE = salt['pillar.get']('setup:searchnode') %}
manager_run_es_soc:
salt.state:
- tgt: {{ MANAGER }}
- sls:
- elasticsearch
- soc
searchnode_run_highstate:
salt.state:
- tgt: {{ SEARCHNODE }}
- highstate: True
- require:
- salt: manager_run_es_soc