diff --git a/manifests/init.pp b/manifests/init.pp index 97f54bb98fb22b03f1123e8eb535ab6d55c2a25f..2235b5aa13d52df9d9be5566a45210caa86bf7ad 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,10 +18,14 @@ class lysntp { ], }) file { '/etc/chrony.conf': - owner => root, - group => root, - mode => '0644', - source => 'puppet:///modules/lysntp/chrony.conf', + owner => root, + group => root, + mode => '0644', + content => epp('lysntp/chrony.conf.epp', { + driftfile => '/var/lib/chrony/drift', + keyfile => '/etc/chrony.keys', + logdir => '/var/log/chrony', + }), } ~> service { 'chronyd': ensure => running, @@ -38,16 +42,46 @@ class lysntp { ], }) file { '/etc/chrony.conf': - owner => root, - group => root, - mode => '0644', - source => 'puppet:///modules/lysntp/chrony.conf', + owner => root, + group => root, + mode => '0644', + content => epp('lysntp/chrony.conf.epp', { + driftfile => '/var/lib/chrony/drift', + keyfile => '/etc/chrony.keys', + logdir => '/var/log/chrony', + }), } ~> service { 'chrony': ensure => running, enable => true, } } + 'FreeBSD': { + service { 'ntpd': + ensure => stopped, + enable => false, + } + ensure_packages( ['chrony'], { + before => [ + File['/usr/local/etc/chrony.conf'], + Service['chronyd'], + ], + }) + file { '/usr/local/etc/chrony.conf': + owner => root, + group => wheel, + mode => '0644', + content => epp('lysntp/chrony.conf.epp', { + driftfile => '/var/db/chrony/drift', + keyfile => '/usr/local/etc/chrony.keys', + logdir => '/var/log/chrony', + }), + } + ~> service { 'chronyd': + ensure => running, + enable => true, + } + } default: { fail("Operating system ${facts['os']['family']} currently not supported") } diff --git a/files/chrony.conf b/templates/chrony.conf.epp similarity index 85% rename from files/chrony.conf rename to templates/chrony.conf.epp index 464b20e454bbc2f3efbc9fcf9ab05d0a188118fd..e8c8e436313452b10140b128fc0e31d56ba52492 100644 --- a/files/chrony.conf +++ b/templates/chrony.conf.epp @@ -1,3 +1,4 @@ +<%- | String $driftfile, String $keyfile, String $logdir | -%> server gbg1.ntp.se iburst server gbg2.ntp.se iburst server lul1.ntp.se iburst @@ -13,7 +14,7 @@ server svl2.ntp.se iburst server timehost.lysator.liu.se iburst # Record the rate at which the system clock gains/losses time. -driftfile /var/lib/chrony/drift +driftfile <%= $driftfile %> # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. @@ -23,10 +24,10 @@ makestep 1.0 3 rtcsync # Specify file containing keys for NTP authentication. -keyfile /etc/chrony.keys +keyfile <%= $keyfile %> # Get TAI-UTC offset and leap seconds from the system tz database. leapsectz right/UTC # Specify directory for log files. -logdir /var/log/chrony +logdir <%= $logdir %>