Compare commits

..
8 changed files with 71 additions and 187 deletions

No files matched your search

+2 -1
View File
@@ -11,7 +11,8 @@
{% set DATA_RETENTION_METHOD = ELASTICSEARCHMERGED.data_retention_method %}
{% set PILLAR_GLOBAL_OVERRIDES = {} %}
{% set ES_INDEX_PILLAR = salt['pillar.get']('elasticsearch:index_settings', {}) %}
{# merge into a copy: pillar.get returns a live reference and this map pops/updates ES_INDEX_PILLAR #}
{% set ES_INDEX_PILLAR = salt['defaults.merge'](salt['pillar.get']('elasticsearch:index_settings', {}), {}, in_place=False) %}
{% if ES_INDEX_PILLAR.global_overrides is defined %}
{% set PILLAR_GLOBAL_OVERRIDES = ES_INDEX_PILLAR.pop('global_overrides') %}
{% endif %}
+3 -51
View File
@@ -16,9 +16,7 @@ For each intent file under /opt/so/state/push_pending/*.json whose last_touch
is older than debounce_seconds, this script:
* concatenates the actions lists from every ready intent
* dedupes by (state or __highstate__, tgt, tgt_type)
* narrows each target to minions that have completed a highstate
* drops actions whose target matches no accepted minion (e.g. a role with no nodes yet)
* holds everything for a later pass while salt-master has only just started
* dispatches a single `salt-run state.orchestrate orch.push_batch --async`
with the deduped actions list passed as pillar kwargs
* deletes the contributed intent files on successful dispatch
@@ -48,20 +46,11 @@ PENDING_DIR = '/opt/so/state/push_pending'
LOCK_FILE = os.path.join(PENDING_DIR, '.lock')
LOG_FILE = '/opt/so/log/salt/so-push-drainer.log'
MASTER_CONFIG = '/etc/salt/master'
MASTER_PIDFILE = '/var/run/salt-master.pid'
# Minions rejoin a restarted master's publisher up to ~22s after it returns (zmq reconnect interval
# plus jitter, each up to recon_default + recon_max) and a job published before then reaches nobody.
# Doubled to allow for a slow master start.
MASTER_SETTLE_SECONDS = 45
DISPATCHED_DIR = '/opt/so/state/push_dispatched'
HIGHSTATE_SENTINEL = '__highstate__'
# Grain written by setup and removed by salt.lasthighstate at the end of the node's first highstate.
PENDING_GRAIN = 'first_highstate_pending'
RESULT_CHECK_DELAY = 30
RESULT_RECHECK_MAX = 300
RESULT_MAX_AGE = 7200
@@ -71,8 +60,6 @@ TEXT_LIMIT = 500
# Lead-in salt puts on the comment of an orchestration step that raised.
STEP_RAISED = 'An exception occurred in this state:'
NO_RETURN = 'no return received'
# salt-run --async reports the jid only in a log line (stderr by default).
JID_RE = re.compile(r'salt/run/(\d{20})')
@@ -130,18 +117,9 @@ def _dedupe_actions(actions):
return deduped
def _skip_pending(action):
"""Narrows a compound target to minions that have completed a highstate. A newly accepted node matches
its role's targets before orch.deploy_newnode has highstated it, and a single state fails there."""
if action.get('tgt_type', 'compound') != 'compound':
return action
return dict(action, tgt='( {} ) and not G@{}:True'.format(action.get('tgt'), PENDING_GRAIN))
def _targeted(actions, log):
"""Drops actions whose target matches no accepted minion (e.g. a role with no nodes yet), which
the orchestration would otherwise report as failed with 'No minions responded'."""
actions = [_skip_pending(action) for action in actions]
try:
ckminions = salt.utils.minions.CkMinions(salt.config.master_config(MASTER_CONFIG))
except Exception:
@@ -162,14 +140,6 @@ def _targeted(actions, log):
return targeted
def _master_settling(now):
try:
age = now - os.path.getmtime(MASTER_PIDFILE)
except OSError:
return False
return 0 <= age < MASTER_SETTLE_SECONDS
def _dispatch(actions, log):
pillar_arg = json.dumps({'actions': actions})
cmd = [
@@ -251,10 +221,6 @@ def _lookup_jid(jid, log):
def _minion_failure(minion_ret):
# What salt.state records for a minion it stopped waiting on: no reply to a saltutil.find_job
# poll within gather_job_timeout, though the state run may still be queued or running.
if minion_ret == {}:
return NO_RETURN
if isinstance(minion_ret, dict):
return '; '.join(
'{}: {}'.format(state.get('__id__', state_key), _trim(state.get('comment', '')))
@@ -317,21 +283,11 @@ def _failed_steps(ret):
return steps
def _lost_track(step):
changes = step.get('changes')
minion_rets = changes.get('ret') if isinstance(changes, dict) else None
if not isinstance(minion_rets, dict):
return False
failed = [text for text in map(_minion_failure, minion_rets.values()) if text]
return bool(failed) and all(text == NO_RETURN for text in failed)
def _result_unknown(ret):
# A step that raised (e.g. salt-master restarted while it waited on a queued state run) or
# stopped waiting never collected the minion's return, so the state run may still have completed.
# A step that raised (e.g. salt-master restarted while it waited on a queued state run)
# never collected the minion's return, so the state run may still have completed.
steps = _failed_steps(ret)
return bool(steps) and all(
str(step.get('comment', '')).startswith(STEP_RAISED) or _lost_track(step) for step in steps)
return bool(steps) and all(str(step.get('comment', '')).startswith(STEP_RAISED) for step in steps)
def _recheck_delay(age):
@@ -454,10 +410,6 @@ def main():
log.debug('no ready intents (%d still in debounce window)', skipped)
return 0
if _master_settling(now):
log.info('salt-master just started; holding %d intent(s) until minions reconnect', len(ready))
return 0
combined_actions = []
oldest_first_touch = now
all_paths = []
@@ -34,7 +34,6 @@ JID = '20260930171554259426'
ASYNC_STDERR = ('[WARNING ] Running in asynchronous mode. Results of this execution may be collected '
'by attaching to the master event bus or by examining the master job cache, if '
'configured. This execution is running under tag salt/run/{}\n'.format(JID))
NOT_PENDING = ' and not G@first_highstate_pending:True'
CONFLICT = ('The function "state.sls" is running as PID 372218 and was started at '
'2026, Sep 30 17:15:40.466233 with jid 20260930171540466233')
@@ -89,22 +88,6 @@ RAISED_RET = _orch_ret(dict(REFRESH_STEP, **{
},
}), success=False)
LOST_RET = _orch_ret(dict(REFRESH_STEP, **{
'salt_|-apply_soc_1_|-apply_soc_1_|-state': {
'__id__': 'apply_soc_1', 'result': False,
'changes': {'out': 'highstate', 'ret': {'manager_standalone': {}}},
'comment': 'Run failed on minions: manager_standalone',
},
}), success=False)
LOST_AND_FAILED_RET = _orch_ret({
'salt_|-apply_soc_1_|-apply_soc_1_|-state': {
'__id__': 'apply_soc_1', 'result': False,
'changes': {'out': 'highstate', 'ret': {'manager_standalone': {}, 'sensor1_sensor': [CONFLICT]}},
'comment': 'Run failed on minions: manager_standalone, sensor1_sensor',
},
}, success=False)
SUCCESS_RET = _orch_ret(dict(REFRESH_STEP, **{
'salt_|-apply_telegraf_1_|-apply_telegraf_1_|-state': {
'__id__': 'apply_telegraf_1', 'result': True,
@@ -216,17 +199,6 @@ class TestHelpers(DrainerTestCase):
drainer._unlink(self.tmpdir, self.log)
self.log.exception.assert_called_once()
def test_master_settling(self):
pidfile = os.path.join(self.tmpdir, 'salt-master.pid')
now = time.time()
with patch.object(drainer, 'MASTER_PIDFILE', pidfile):
self.assertFalse(drainer._master_settling(now))
self.write_json(self.tmpdir, 'salt-master.pid', '1100')
for age, settling in ((0, True), (drainer.MASTER_SETTLE_SECONDS - 1, True),
(drainer.MASTER_SETTLE_SECONDS, False), (-60, False)):
os.utime(pidfile, (now - age, now - age))
self.assertIs(drainer._master_settling(now), settling, age)
class TestDispatch(DrainerTestCase):
@@ -293,13 +265,6 @@ class TestResults(DrainerTestCase):
self.assertEqual(drainer._minion_failure('Rendering SLS failed'), 'Rendering SLS failed')
self.assertEqual(drainer._minion_failure(True), '')
self.assertEqual(drainer._minion_failure({'a': {'result': True}}), '')
self.assertEqual(drainer._minion_failure({}), drainer.NO_RETURN)
def test_orch_failures_lost(self):
self.assertEqual(drainer._orch_failures(LOST_RET), [
'apply_soc_1: Run failed on minions: manager_standalone',
'manager_standalone: no return received',
])
def test_orch_failures_conflict(self):
failures = drainer._orch_failures(CONFLICT_RET)
@@ -343,17 +308,7 @@ class TestResults(DrainerTestCase):
def test_result_unknown(self):
self.assertTrue(drainer._result_unknown(RAISED_RET))
self.assertTrue(drainer._result_unknown(LOST_RET))
changed = json.loads(json.dumps(LOST_RET))
changed[MASTER]['return']['data'][MASTER]['salt_|-apply_soc_1_|-apply_soc_1_|-state']['changes']['ret'][
'sensor1_sensor'] = {'file_|-a_|-a_|-managed': {'result': True, 'changes': {'diff': 'x'}}}
self.assertTrue(drainer._result_unknown(changed))
odd = _orch_ret({'salt_|-apply_soc_1_|-apply_soc_1_|-state': {
'__id__': 'apply_soc_1', 'result': False, 'changes': 'Run failed', 'comment': 'Run failed on minions',
}}, success=False)
self.assertFalse(drainer._result_unknown(odd))
for ret in (CONFLICT_RET, STATE_FAIL_RET, SUCCESS_RET, LOST_AND_FAILED_RET, ['No minions matched'],
{MASTER: 'odd'},
for ret in (CONFLICT_RET, STATE_FAIL_RET, SUCCESS_RET, ['No minions matched'], {MASTER: 'odd'},
{MASTER: {'return': {'data': {MASTER: ['Rendering SLS failed']}}, 'success': False}}):
self.assertFalse(drainer._result_unknown(ret), ret)
mixed = _orch_ret(dict(RAISED_RET[MASTER]['return']['data'][MASTER],
@@ -395,21 +350,6 @@ class TestResults(DrainerTestCase):
self.assertIn('AuthenticationError: Authentication error occurred.', self.logged('warning'))
self.assertNotIn('6_unknown', self.logged('error'))
def test_check_dispatched_lost(self):
now = time.time()
results = {'1_lost': LOST_RET, '2_lost_and_failed': LOST_AND_FAILED_RET}
paths = [self.record(jid, 60, now) for jid in results]
with patch.object(drainer, '_lookup_jid', side_effect=lambda jid, log: results[jid]):
drainer._check_dispatched(self.log, now)
for path in paths:
self.assertFalse(os.path.exists(path), path)
self.assertIn('push result unknown jid=1_lost', self.logged('warning'))
self.assertIn('manager_standalone: no return received', self.logged('warning'))
self.assertNotIn('1_lost', self.logged('error'))
self.assertIn('push failed jid=2_lost_and_failed', self.logged('error'))
self.assertIn('is running as PID 372218', self.logged('error'))
def test_check_dispatched_survives_bad_result(self):
now = time.time()
bad = self.record('1_bad', 60, now)
@@ -491,19 +431,8 @@ class TestTargeted(DrainerTestCase):
self.CkMinions = patcher.start()
self.addCleanup(patcher.stop)
def test_skip_pending(self):
self.assertEqual(drainer._skip_pending({'state': 'soc', 'tgt': 'G@role:so-eval or G@role:so-manager'}),
{'state': 'soc', 'tgt': '( G@role:so-eval or G@role:so-manager )' + NOT_PENDING})
self.assertEqual(drainer._skip_pending({'highstate': True, 'tgt': '*', 'tgt_type': 'compound'}),
{'highstate': True, 'tgt': '( * )' + NOT_PENDING, 'tgt_type': 'compound'})
listed = {'state': 'soc', 'tgt': 'manager_manager', 'tgt_type': 'list'}
self.assertEqual(drainer._skip_pending(listed), listed)
def test_drops_unmatched(self):
sensor = '( G@role:so-sensor )' + NOT_PENDING
heavynode = '( G@role:so-heavynode )' + NOT_PENDING
idh = '( G@role:so-idh )' + NOT_PENDING
matches = {sensor: ['sensor_sensor'], 'manager_manager': ['manager_manager']}
matches = {'G@role:so-sensor': ['sensor_sensor'], 'manager_manager': ['manager_manager']}
self.ckminions.check_minions.side_effect = lambda tgt, tgt_type: {'minions': matches.get(tgt, [])}
actions = [
{'state': 'strelka', 'tgt': 'G@role:so-sensor'},
@@ -511,27 +440,28 @@ class TestTargeted(DrainerTestCase):
{'highstate': True, 'tgt': 'G@role:so-idh'},
{'state': 'soc', 'tgt': 'manager_manager', 'tgt_type': 'list'},
]
self.assertEqual(drainer._targeted(actions, self.log), [{'state': 'strelka', 'tgt': sensor}, actions[3]])
self.assertEqual(drainer._targeted(actions, self.log), [actions[0], actions[3]])
self.CkMinions.assert_called_once()
self.assertEqual([c.args for c in self.ckminions.check_minions.call_args_list], [
(sensor, 'compound'), (heavynode, 'compound'), (idh, 'compound'), ('manager_manager', 'list'),
('G@role:so-sensor', 'compound'), ('G@role:so-heavynode', 'compound'),
('G@role:so-idh', 'compound'), ('manager_manager', 'list'),
])
info = self.logged('info')
self.assertIn('skipping suricata: no minions match tgt=' + heavynode, info)
self.assertIn('skipping highstate: no minions match tgt=' + idh, info)
self.assertIn('skipping suricata: no minions match tgt=G@role:so-heavynode', info)
self.assertIn('skipping highstate: no minions match tgt=G@role:so-idh', info)
self.assertNotIn('strelka', info)
def test_master_config_error_keeps_actions(self):
actions = [{'state': 'soc', 'tgt': '*'}]
with patch.object(drainer.salt.config, 'master_config', side_effect=OSError('no config')):
self.assertEqual(drainer._targeted(actions, self.log), [{'state': 'soc', 'tgt': '( * )' + NOT_PENDING}])
self.assertEqual(drainer._targeted(actions, self.log), actions)
self.log.exception.assert_called_once()
self.CkMinions.assert_not_called()
def test_check_error_keeps_action(self):
actions = [{'state': 'soc', 'tgt': 'G@role:'}]
self.ckminions.check_minions.side_effect = RuntimeError('bad target')
self.assertEqual(drainer._targeted(actions, self.log), [{'state': 'soc', 'tgt': '( G@role: )' + NOT_PENDING}])
self.assertEqual(drainer._targeted(actions, self.log), actions)
self.log.exception.assert_called_once()
@@ -545,7 +475,6 @@ class TestMain(DrainerTestCase):
('_load_push_cfg', {'side_effect': lambda: self.cfg}),
('_check_dispatched', {}),
('_targeted', {'side_effect': lambda actions, log: actions}),
('_master_settling', {'return_value': False}),
):
patcher = patch.object(drainer, name, **kwargs)
setattr(self, name, patcher.start())
@@ -599,16 +528,6 @@ class TestMain(DrainerTestCase):
with patch.object(drainer.os, 'unlink', side_effect=OSError('busy')):
self.assertEqual(drainer.main(), 0)
def test_holds_while_master_settling(self):
path = self.intent('pillar_soc.json')
self._master_settling.return_value = True
with patch.object(drainer, '_dispatch') as dispatch:
self.assertEqual(drainer.main(), 0)
dispatch.assert_not_called()
self._check_dispatched.assert_called_once()
self.assertTrue(os.path.exists(path))
self.assertIn('holding 1 intent(s)', self.logged('info'))
def test_dispatch_failure_keeps_intents(self):
path = self.intent('pillar_soc.json')
with patch.object(drainer, '_dispatch', return_value=None):
@@ -20,6 +20,8 @@ CRITICAL_AGENTS_FILE="/opt/so/conf/agents/critical-agents.txt"
OFFLINE_THRESHOLD_HOURS={{ OFFLINE_THRESHOLD_HOURS }}
REALERT_THRESHOLD={{ REALERT_THRESHOLD }}
PAGE_SIZE="{{ PAGE_SIZE }}"
# Safety limit on pagination loops. Very large fleets should raise page_size instead.
MAX_PAGES=100
log_message() {
local level="$1"
@@ -135,14 +137,16 @@ main() {
local page=1
local total_agents=0
local processed_agents=0
local agents_in_page=0
local agents=()
local current_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
{%- if CUSTOM_KQUERY != None and CUSTOM_KQUERY | length > 0 %}
log_message "INFO" "Using custom kquery: {{ CUSTOM_KQUERY }}"
FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}&page=${page}"
FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}"
{%- else %}
log_message "INFO" "Using default query (all offline or degraded agents)"
FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}&page=${page}"
FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}"
{%- endif %}
while true; do
@@ -150,27 +154,48 @@ main() {
if ! response_body=$(curl -K "$CURL_CONFIG" \
-s --fail \
"$FLEET_QUERY" \
"${FLEET_QUERY}&page=${page}" \
-H 'kbn-xsrf: true' 2>/dev/null); then
log_message "ERROR" "Failed to query Fleet API (page $page)"
exit 1
fi
# pagination info
current_total=$(echo "$response_body" | jq -r '.total // 0')
current_page=$(echo "$response_body" | jq -r '.page // 1')
agents_in_page=$(echo "$response_body" | jq -r '.list | length')
# Validate the response before parsing it so a bad response can never be
# mistaken for an empty page.
if ! echo "$response_body" | jq -e 'type == "object"' >/dev/null 2>&1; then
log_message "ERROR" "Malformed Fleet API response on page $page: not a valid JSON object"
exit 1
fi
# Update total
if ! current_total=$(echo "$response_body" | jq -e '.total | select(type == "number" and . >= 0 and . == floor)' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid total"
exit 1
fi
# Fleet 9.x returns agents under "items"; older responses used "list".
if ! agents_json=$(echo "$response_body" | jq -c '(.items // .list) | if type == "array" then .[] else error("no agent array") end' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid agent collection (items/list)"
exit 1
fi
# Use the latest page's total: agents changing status between pages
# (e.g. coming back online) shrink the offline/degraded result set.
total_agents="$current_total"
if [ "$page" -eq 1 ]; then
total_agents="$current_total"
log_message "INFO" "Found $total_agents total agents across all pages"
fi
log_message "INFO" "Processing page $current_page with $agents_in_page agents"
# Process agents from current page
mapfile -t agents < <(echo "$response_body" | jq -c '.list[]')
agents=()
agents_in_page=0
if [ -n "$agents_json" ]; then
while IFS= read -r agent; do
agents+=("$agent")
agents_in_page=$((agents_in_page + 1))
done <<< "$agents_json"
fi
log_message "INFO" "Processing page $page with $agents_in_page agents"
for agent in "${agents[@]}"; do
# Grab agent details
@@ -234,20 +259,28 @@ main() {
processed_agents=$((processed_agents + agents_in_page))
if [ "$agents_in_page" -eq 0 ] || [ "$processed_agents" -ge "$total_agents" ]; then
log_message "INFO" "Completed processing all pages. Total processed: $processed_agents agents"
if [ "$processed_agents" -ge "$total_agents" ]; then
break
fi
if [ "$agents_in_page" -eq 0 ]; then
log_message "ERROR" "Incomplete agent scan: page $page was empty after $processed_agents of $total_agents agents"
exit 1
fi
page=$((page + 1))
# Limit pagination loops incase of any issues. If agent count is high enough increase page_size in SOC manager.agent_monitoring.config.page_size
if [ "$page" -gt 100 ]; then
log_message "ERROR" "Reached maximum page limit (100). Issue with script or extremely large fleet deployment. Consider increasing page_size in SOC -> manager.agent_monitoring.config.page_size"
break
if [ "$page" -gt "$MAX_PAGES" ]; then
log_message "ERROR" "Reached maximum page limit ($MAX_PAGES) after $processed_agents of $total_agents agents. Issue with script or extremely large fleet deployment. Consider increasing page_size under Administration -> Configuration -> manager -> agent_monitoring -> config -> page_size (enable 'Show advanced settings')."
exit 1
fi
done
if [ "$total_agents" -gt 0 ] && [ "$processed_agents" -eq 0 ]; then
log_message "ERROR" "Incomplete agent scan: Fleet reported $total_agents agents but none were examined"
exit 1
fi
log_message "INFO" "Fleet agent status check completed. Processed $processed_agents out of $total_agents agents"
}
+6 -18
View File
@@ -2,24 +2,10 @@
{% set actions = salt['pillar.get']('actions', []) %}
{% set BATCH = AUTOAPPLY.batch %}
{% set BATCH_WAIT = AUTOAPPLY.batch_wait %}
{# Must exceed gather_job_timeout (10s): at the 5s default, one saltutil.find_job reply slower than that abandons
a queued state run, and a master slow to accept the publish gets it a second time. #}
{% set STATE_TIMEOUT = 60 %}
{# queue must be a top-level salt.state arg (kwarg is ignored); an int is max_queue and still fails on conflict #}
{# refresh_pillar doubles as the reachability check: minions take up to ~22s to rejoin a restarted master's
publisher, and a job published before then reaches nobody. Each failed attempt takes ~15s to time out. #}
{% for action in actions %}
refresh_pillar_{{ loop.index }}:
salt.function:
- name: saltutil.refresh_pillar
- tgt: '{{ action.tgt }}'
- tgt_type: {{ action.get('tgt_type', 'compound') }}
- retry:
attempts: 3
interval: 10
{% if action.get('highstate') %}
apply_highstate_{{ loop.index }}:
salt.state:
@@ -29,10 +15,13 @@ apply_highstate_{{ loop.index }}:
- batch: {{ action.get('batch', BATCH) }}
- batch_wait: {{ action.get('batch_wait', BATCH_WAIT) }}
- queue: True
- timeout: {{ STATE_TIMEOUT }}
- require:
- salt: refresh_pillar_{{ loop.index }}
{% else %}
refresh_pillar_{{ loop.index }}:
salt.function:
- name: saltutil.refresh_pillar
- tgt: '{{ action.tgt }}'
- tgt_type: {{ action.get('tgt_type', 'compound') }}
apply_{{ action.state | replace('.', '_') }}_{{ loop.index }}:
salt.state:
- tgt: '{{ action.tgt }}'
@@ -42,7 +31,6 @@ apply_{{ action.state | replace('.', '_') }}_{{ loop.index }}:
- batch: {{ action.get('batch', BATCH) }}
- batch_wait: {{ action.get('batch_wait', BATCH_WAIT) }}
- queue: True
- timeout: {{ STATE_TIMEOUT }}
- require:
- salt: refresh_pillar_{{ loop.index }}
{% endif %}
-1
View File
@@ -3,7 +3,6 @@
#
# One pillar directory can map to multiple (state, tgt) actions.
# tgt is a raw salt compound expression. tgt_type is always "compound".
# so-push-drainer excludes nodes that have not completed their first highstate.
# Per-action `batch` / `batch_wait` override the orch defaults (10% / 15s).
# An action with `highstate: True` triggers state.highstate instead of
# state.apply -- see salt/orch/push_batch.sls.
-6
View File
@@ -2,9 +2,3 @@ lasthighstate:
file.touch:
- name: /opt/so/log/salt/lasthighstate
- order: 9001
# set by setup; so-push-drainer does not target a node that still has it
first_highstate_pending:
grains.absent:
- destructive: True
- order: 9001
-2
View File
@@ -519,8 +519,6 @@ configure_minion() {
info "Configuring minion type as $minion_type"
logCmd "mkdir -p /etc/salt/minion.d"
echo "role: so-$minion_type" > /etc/salt/grains
# so-push-drainer leaves the node alone until salt.lasthighstate removes this
echo "first_highstate_pending: True" >> /etc/salt/grains
local minion_config=/etc/salt/minion