Reloading salt-minion configuration without service restart

43 views
Skip to first unread message

Greg Long

unread,
May 15, 2023, 8:11:10 PM5/15/23
to salt-...@googlegroups.com

We use a salt state to update the saltenv and pillarenv in /etc/salt/minion we call this initial state with the state.apply app.changesaltenv saltenv=newenv pillarenv=newenv

I have not figured out a way to get the salt-minion to start using this as it's new default without restarting the salt-minion. Alternatively, I haven't figured out a way to have the salt state restart the minion without it causing the salt state to fail because it loses connectivity with the salt minion.

Any insight into this would be greatly helpful.

state.apply app.changesaltenv saltenv=newenv pillarenv=newenv

then check the env with

config.get saltenv

if I try to add service.restart to the state, the state fails because the minion stops communicating with the master.

I noticed an article that mentions how to restart the minion in a state but the example does so by causing a state failure.

Seth Everson

unread,
May 22, 2023, 12:22:59 PM5/22/23
to Salt-users
Our trick is the have the minion run, as a salt state:
restart_salt_minion:
  cmd.run:
    -name: 'salt-call --local service.restart salt-minion'
    -bg: true

This syntax sends the restart to the minion in the background, and completes the return / job immediately. This makes the master happy, and the minion happily reboots after reliably thanks to using the --local flag.
Reply all
Reply to author
Forward
0 new messages