.
This commit is contained in:
parent
04b6350fd3
commit
7019e46395
@ -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
|
||||
|
@ -13,3 +13,4 @@ base:
|
||||
- remote-desktop
|
||||
- hostapd
|
||||
- firewalld
|
||||
- wol
|
||||
|
18
salt/states/wol/files/wol.jinja
Normal file
18
salt/states/wol/files/wol.jinja
Normal 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
12
salt/states/wol/init.sls
Normal 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"
|
Loading…
Reference in New Issue
Block a user