From be46ff2582e607a384a1194a371968e7b8dfa749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= <tobbez@ryara.net> Date: Fri, 29 Sep 2023 23:50:57 +0200 Subject: [PATCH] Disable automatic sleep/suspend --- manifests/disable_sleep.pp | 19 +++++++++++++++++++ manifests/init.pp | 2 ++ 2 files changed, 21 insertions(+) create mode 100644 manifests/disable_sleep.pp diff --git a/manifests/disable_sleep.pp b/manifests/disable_sleep.pp new file mode 100644 index 0000000..8f22345 --- /dev/null +++ b/manifests/disable_sleep.pp @@ -0,0 +1,19 @@ +# @summary Disble automatic sleep/hibernation +class workstation::disable_sleep { + $keys = [ + 'AllowSuspend', + 'AllowHibernation', + 'AllowSuspendThenHibernate', + 'AllowHybridSleep', + ] + $changes = $keys.map |$k| { "set Sleep/${k} no" } + augeas { 'disable sleep': + incl => '/etc/systemd/sleep.conf', + lens => 'Desktop.lns', + changes => $changes, + } + ~> exec { '/usr/bin/systemctl daemon-reload -- disable sleep': + command => '/usr/bin/systemctl daemon-reload', + refreshonly => true, + } +} diff --git a/manifests/init.pp b/manifests/init.pp index d64a2e8..36cb2f4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,6 +12,8 @@ class workstation ( include "::workstation::desktop_environment::${e}" } + include workstation::disable_sleep + include ::workstation::environment include ::workstation::sysctl -- GitLab