Replace debbackup with parameterized username in most places
[mirror/dsa-puppet.git] / modules / systemdtimesyncd / manifests / init.pp
1 class systemdtimesyncd {
2         $localtimeservers = hiera('local-timeservers', [])
3
4         if (! $systemd) {
5                 fail ( "systemdtimesyncd requires systemd." )
6         } elsif (size($localtimeservers) == 0) {
7                 fail ( "No local timeservers configured for systemdtimesyncd." )
8         } else {
9                 file { '/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service':
10                                 ensure => 'link',
11                                 target => '/lib/systemd/system/systemd-timesyncd.service',
12                                 notify => Exec['systemctl daemon-reload'],
13                 }
14
15                 service { 'systemd-timesyncd':
16                         ensure  => running,
17                 }
18
19                 file { '/etc/systemd/timesyncd.conf':
20                         content => template('systemdtimesyncd/timesyncd.conf.erb'),
21                         notify  => Service['systemd-timesyncd'],
22                 }
23
24                 # Up until 2019-09 we had timesyncd started by multi-user.target instead of the default
25                 # sysinit.target.wants.  We are moving back to sysinit.target.wants (for now).
26                 file { '/etc/systemd/system/multi-user.target.wants/systemd-timesyncd.service':
27                         ensure => 'absent',
28                         notify => Exec['systemctl daemon-reload'],
29                 }
30
31         }
32 }