Wake up all clients returned by '--list-hosts'.
This commit is contained in:
parent
a586ac5201
commit
dba478652a
1 changed files with 17 additions and 0 deletions
17
wol-generator.sh
Executable file
17
wol-generator.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/bash
|
||||
#
|
||||
# Pipe the '--list-hosts' output of ansible into this program to wake up all corresponding hosts:
|
||||
#
|
||||
# ansible-playbook [...] -i inventory/inventory.yml -l R317 --list-hosts | ./wol-generator.sh
|
||||
#
|
||||
set -eu
|
||||
|
||||
tmpf="$(mktemp)"
|
||||
devs='devices.csv'
|
||||
|
||||
while read -r line ; do
|
||||
sed -nE -e "s%.*(..:..:..:..:..:..);(${line//./\\.});.*%\1 \2%p" "$devs" >> "$tmpf"
|
||||
done < <(cat - | grep -E "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
|
||||
|
||||
wakeonlan -f "$tmpf"
|
||||
rm "$tmpf"
|
Loading…
Add table
Reference in a new issue