diff --git a/manifests/disable_sleep.pp b/manifests/disable_sleep.pp new file mode 100644 index 0000000000000000000000000000000000000000..8f223451d0d08524d5833a479871a6912035d064 --- /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 d64a2e82d6f3cc843f186b4aa5bf6ad4ec08f675..36cb2f4c4dc48ad4fc93a05d5b624d77a220cd64 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