From d12b446f3451e6da86638f1c063fd94e2b817029 Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 12 Feb 2022 17:15:15 +0100 Subject: [PATCH] wol + --- bundles/wol-sleeper/items.py | 3 +++ bundles/wol-sleeper/metadata.py | 4 ++-- groups/machine/hardware.py | 1 - nodes/home.backups.py | 4 ++++ nodes/home.server.py | 7 ++++--- 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 bundles/wol-sleeper/items.py diff --git a/bundles/wol-sleeper/items.py b/bundles/wol-sleeper/items.py new file mode 100644 index 0000000..8ba09b7 --- /dev/null +++ b/bundles/wol-sleeper/items.py @@ -0,0 +1,3 @@ +waker_node = repo.get_node(node.metadata.get('wol-sleeper/waker')) +if not waker_node.has_bundle('wol-waker'): + raise Exception(f'waker node {waker_node.name} does not have bundle wol-waker') diff --git a/bundles/wol-sleeper/metadata.py b/bundles/wol-sleeper/metadata.py index bcd9954..a3f0852 100644 --- a/bundles/wol-sleeper/metadata.py +++ b/bundles/wol-sleeper/metadata.py @@ -29,8 +29,8 @@ def systemd(metadata): 'Type': 'oneshot', 'RemainAfterExit': 'yes', 'ExecStart': set( - f"ethtool -s {conf['interface']} wol g" - for itnerface in interfaces + f"ethtool -s {interface} wol g" + for interface in interfaces ), }, 'Install': { diff --git a/groups/machine/hardware.py b/groups/machine/hardware.py index 37b139e..fa8ac47 100644 --- a/groups/machine/hardware.py +++ b/groups/machine/hardware.py @@ -1,6 +1,5 @@ { 'bundles': { 'hardware', - 'wol-sleeper', }, } diff --git a/nodes/home.backups.py b/nodes/home.backups.py index d859922..b4695e1 100644 --- a/nodes/home.backups.py +++ b/nodes/home.backups.py @@ -8,6 +8,7 @@ ], 'bundles': [ 'smartctl', + 'wol-sleeper', 'zfs', 'zfs-mirror', ], @@ -35,6 +36,9 @@ 'apm': 1, }, }, + 'wol-sleeper': { + 'waker': 'home.server', + }, 'zfs-mirror': { 'server': 'wb.offsite-backups', }, diff --git a/nodes/home.server.py b/nodes/home.server.py index ef29b96..fd3bfed 100644 --- a/nodes/home.server.py +++ b/nodes/home.server.py @@ -13,6 +13,7 @@ 'bundles': [ 'apcupsd', 'build-agent', + 'crystal', 'gitea', 'gollum', 'grafana', @@ -22,11 +23,11 @@ 'postgresql', 'redis', 'smartctl', - 'wireguard', - 'zfs', - 'crystal', 'raspberrymatic-cert', 'tasmota-charge', + 'wireguard', + 'wol-waker', + 'zfs', ], 'metadata': { 'id': 'af96709e-b13f-4965-a588-ef2cd476437a',