make a dsa_systemd::linger to enable or disable lingering consistently
[mirror/dsa-puppet.git] / modules / dsa_systemd / manifests / init.pp
1 class dsa_systemd {
2         file { '/etc/systemd/journald.conf':
3                 source => 'puppet:///modules/dsa_systemd/journald.conf',
4         }
5
6         dsa_systemd::mask { 'sys-kernel-debug-tracing.mount': }
7         dsa_systemd::mask { 'sys-kernel-debug.mount': }
8
9         include stretch::network_online
10
11         if $::hostname == 'godard' {
12                 exec {'mkdir -p /etc/systemd/journald.conf.d':
13                         unless => 'test -d /etc/systemd/journald.conf.d',
14                 }
15                 file { '/etc/systemd/journald.conf.d/persistency.conf':
16                         source => 'puppet:///modules/dsa_systemd/persistency.conf',
17                 }
18         }
19
20         file { '/usr/local/sbin/systemd-cleanup-failed':
21                 source => 'puppet:///modules/dsa_systemd/systemd-cleanup-failed',
22                 mode   => '0555',
23         }
24         concat::fragment { 'dsa-puppet-stuff--systemd-cleanup-failed':
25                 target => '/etc/cron.d/dsa-puppet-stuff',
26                 content  => @("EOF"),
27                                 */10 * * * * root /usr/local/sbin/systemd-cleanup-failed
28                                 | EOF
29         }
30
31         # systemd bug on buster, maybe related to https://github.com/systemd/systemd/issues/12401
32         # | root@onionoo-backend-01:~# loginctl enable-linger onionoo
33         # | Could not enable linger: No such file or directory
34         # Having the /var/lib/systemd/linger directory exist already enables
35         # us to just define file resources in dsa_systemd::linger.  That won't
36         # start the user session immediately, but it'll work after a reboot
37         file { '/var/lib/systemd/linger':
38                 mode   => '0755',
39                 ensure => 'directory',
40         }
41 }