From 83b888dcf77de99847ef83c08c632e1617124507 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 1 May 2023 18:32:44 +0200 Subject: [PATCH] linroom: fix Wake-on-LAN setup Add missing ethtool. Rename file as it is necessary on non-Intel devices also. Ensure the udev rule is applied after 80-net-setup-link. --- roles/linroom/files/99-wakeonlan.rules | 1 + roles/linroom/tasks/fri_base.yml | 6 ++---- roles/linroom/tasks/wake-on-lan.yml | 8 ++++++++ roles/linroom/templates/intel-wol.rules | 1 - 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 roles/linroom/files/99-wakeonlan.rules create mode 100644 roles/linroom/tasks/wake-on-lan.yml delete mode 100644 roles/linroom/templates/intel-wol.rules diff --git a/roles/linroom/files/99-wakeonlan.rules b/roles/linroom/files/99-wakeonlan.rules new file mode 100644 index 0000000..d4729ac --- /dev/null +++ b/roles/linroom/files/99-wakeonlan.rules @@ -0,0 +1 @@ +ACTION=="add", SUBSYSTEM=="net", NAME=="e*", RUN+="/usr/sbin/ethtool -s $name wol g" diff --git a/roles/linroom/tasks/fri_base.yml b/roles/linroom/tasks/fri_base.yml index 7e22a42..47c0f11 100644 --- a/roles/linroom/tasks/fri_base.yml +++ b/roles/linroom/tasks/fri_base.yml @@ -100,10 +100,8 @@ - name: Set time to local RTC shell: "timedatectl set-local-rtc 1 --adjust-system-clock" -- name: Fix WoL on Intel - template: - src: intel-wol.rules - dest: /etc/udev/rules.d/79-wol.rules +- name: Enable Wake-on-LAN + import_tasks: wake-on-lan.yml - name: Join AD shell: "realm join --user=ad.join@FRI1.UNI-LJ.SI --computer-ou=OU=Ucilnice FRI1.UNI-LJ.SI" diff --git a/roles/linroom/tasks/wake-on-lan.yml b/roles/linroom/tasks/wake-on-lan.yml new file mode 100644 index 0000000..c648b58 --- /dev/null +++ b/roles/linroom/tasks/wake-on-lan.yml @@ -0,0 +1,8 @@ +- name: Install ethtool + apt: + name: ethtool + +- name: Add udev rule to enable wake-on-lan for ethernet interfaces + copy: + dest: /etc/udev/rules.d/ + src: 99-wakeonlan.rules diff --git a/roles/linroom/templates/intel-wol.rules b/roles/linroom/templates/intel-wol.rules deleted file mode 100644 index 8baa58e..0000000 --- a/roles/linroom/templates/intel-wol.rules +++ /dev/null @@ -1 +0,0 @@ -ACTION=="add", SUBSYSTEM=="net", NAME=="e*", RUN+="/sbin/ethtool -s $name wol g"