mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #1037 from UtahDave/add_wollist_runner
Add capability to wake up multiple minions at once
This commit is contained in:
commit
d90dc6929b
@ -4,6 +4,25 @@ Network tools to run from the Master
|
||||
|
||||
import socket
|
||||
|
||||
def wollist(maclist, bcast='255.255.255.255', destport=9):
|
||||
'''
|
||||
Send a "Magic Packet" to wake up a list of Minions.
|
||||
This list must contain one MAC hardware address per line
|
||||
|
||||
CLI Example::
|
||||
|
||||
salt-run '/path/to/maclist'
|
||||
salt-run '/path/to/maclist' 255.255.255.255 7
|
||||
salt-run '/path/to/maclist' 255.255.255.255 7
|
||||
'''
|
||||
try:
|
||||
file = open(maclist, 'r')
|
||||
for mac in file:
|
||||
wol(mac.strip(), bcast, destport)
|
||||
print "Waking up %s" % mac.strip()
|
||||
except Exception as inst:
|
||||
print "Failed to open the MAC file. Error: %s" % inst
|
||||
|
||||
def wol(mac, bcast='255.255.255.255', destport=9):
|
||||
'''
|
||||
Send a "Magic Packet" to wake up a Minion
|
||||
|
Loading…
Reference in New Issue
Block a user