This commit is contained in:
Jonas Forsberg 2021-10-16 15:59:28 +02:00
parent 04b6350fd3
commit 7019e46395
4 changed files with 35 additions and 0 deletions

View File

@ -24,3 +24,7 @@ network:
id: 250
address: 192.168.250.1
netmask: 24
wol:
1: 7c:10:c9:50:17:9b
2: 7c:10:c9:50:17:0a
3: 7c:10:c9:50:17:58

View File

@ -13,3 +13,4 @@ base:
- remote-desktop
- hostapd
- firewalld
- wol

View File

@ -0,0 +1,18 @@
#/bin/bash
set -aeou pipefail
for arg in "$@"
do
case "$arg" in
{% for number, mac in pillar['network']['wol'].items() %}
{{ number }}|srv{{ number }}|server{{ number }})
sudo ether-wake -i {{ pillar['network']['interface']['bridge'] }} {{ mac }}
;;
{% endfor %}
*)
echo "unknown: $arg"
;;
esac
done

12
salt/states/wol/init.sls Normal file
View File

@ -0,0 +1,12 @@
install net-tools:
pkg.installed:
- name: net-tools
configure bin/wol:
file.managed:
- name: /home/{{ pillar['username'] }}/bin/wol
- source: salt://wol/files/wol.jinja
- template: jinja
- user: {{ pillar['username'] }}
- group: users
- mode: "0755"