salt.modules.minion
Module to provide information about minions
-
Kill the salt minion.
- timeout
-
int seconds to wait for the minion to die.
If you have a monitor that restarts
salt-minion
when it dies then this is a great way to restart after a minion upgrade.CLI Example:
salt minion[12] minion.kill minion1: ---------- killed: 7874 retcode: 0 minion2: ---------- killed: 29071 retcode: 0
The result of the salt command shows the process ID of the minions and the results of a kill signal to the minion in as the
retcode
value:0
is success, anything else is a failure.
salt.modules.minion.kill(timeout=15)
-
Return a list of accepted, denied, unaccepted and rejected keys. This is the same output as salt-key -L
CLI Example:
salt 'master' minion.list
salt.modules.minion.list_()
-
Kill and restart the salt minion.
The configuration key
minion_restart_command
is an argv list for the command to restart the minion. Ifminion_restart_command
is not specified or empty then theargv
of the current process will be used.if the configuration value
minion_restart_command
is not set and the-d
(daemonize) argument is missing fromargv
then the minion will be killed but will not be restarted and will require the parent process to perform the restart. This behavior is intended for managed salt minion processes.CLI Example:
salt minion[12] minion.restart minion1: ---------- comment: - Restart using process argv: - /home/omniture/install/bin/salt-minion - -d - -c - /home/omniture/install/etc/salt killed: 10070 restart: ---------- stderr: stdout: retcode: 0 minion2: ---------- comment: - Using configuration minion_restart_command: - /home/omniture/install/bin/salt-minion - --not-an-option - -d - -c - /home/omniture/install/etc/salt - Restart failed killed: 10896 restart: ---------- stderr: Usage: salt-minion salt-minion: error: no such option: --not-an-option stdout: retcode: 64
The result of the command shows the process ID of
minion1
that is shutdown (killed) and the results of the restart. If there is a failure in the restart it will be reflected in a non-zeroretcode
and possibly output in thestderr
and/orstdout
values along with addition information in thecomment
field as is demonstrated withminion2
.
salt.modules.minion.restart()
© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.minion.html