From 5dda19cdc5eff8574727a3663812500aceaf95b9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 2 Apr 2025 01:09:39 +0200 Subject: [PATCH] Added draft for lid-switch --- roles/pc-lid-switch/handlers/main.yml | 6 ++++++ roles/pc-lid-switch/tasks/main.yml | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 roles/pc-lid-switch/handlers/main.yml create mode 100644 roles/pc-lid-switch/tasks/main.yml diff --git a/roles/pc-lid-switch/handlers/main.yml b/roles/pc-lid-switch/handlers/main.yml new file mode 100644 index 00000000..bd9cae9a --- /dev/null +++ b/roles/pc-lid-switch/handlers/main.yml @@ -0,0 +1,6 @@ +--- +- name: Restart systemd-logind + become: yes + systemd: + name: systemd-logind + state: restarted \ No newline at end of file diff --git a/roles/pc-lid-switch/tasks/main.yml b/roles/pc-lid-switch/tasks/main.yml new file mode 100644 index 00000000..3f977c32 --- /dev/null +++ b/roles/pc-lid-switch/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Set HandleLidSwitch to hibernate in /etc/systemd/logind.conf + become: yes + lineinfile: + path: /etc/systemd/logind.conf + regexp: '^#?HandleLidSwitch=' + line: 'HandleLidSwitch=hibernate' + backup: yes + notify: Restart systemd-logind \ No newline at end of file