diff --git a/REFERENCE.md b/REFERENCE.md index b6cea39..a0e1c7a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -507,17 +507,16 @@ Default value: `undef` ##### `refclocks` -Data type: `Array` +Data type: `Hash` This should be a Hash of hardware reference clock drivers to use. They hash -can either list a single list of options for the driver, or any array of -multiple options if the same driver is used for multiple hardware clocks. +should be an array of hardware clocks and their options for that driver. Example: ```puppet refclocks => { 'PPS' => [ '/dev/pps0 lock NMEA refid GPS', '/dev/pps1:clear refid GPS2' ], - 'SHM' => '0 offset 0.5 delay 0.2 refid NMEA noselect' } + 'SHM' => [ '0 offset 0.5 delay 0.2 refid NMEA noselect' ] } ``` Default value: `[]` diff --git a/manifests/init.pp b/manifests/init.pp index d024d8d..31bd7dd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -146,14 +146,13 @@ # Specifies the minimum number of readings kept for tracking of the NIC clock. # @param refclocks # This should be a Hash of hardware reference clock drivers to use. They hash -# can either list a single list of options for the driver, or any array of -# multiple options if the same driver is used for multiple hardware clocks. +# should be an array of hardware clocks and their options for that driver. # # Example: # ```puppet # refclocks => { 'PPS' => [ '/dev/pps0 lock NMEA refid GPS', # '/dev/pps1:clear refid GPS2' ], -# 'SHM' => '0 offset 0.5 delay 0.2 refid NMEA noselect' } +# 'SHM' => [ '0 offset 0.5 delay 0.2 refid NMEA noselect' ] } # ``` # @param makestep_seconds # Configures the [`makestep`](https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#makestep) `threshold`. @@ -275,7 +274,7 @@ String[1] $package_name = 'chrony', Optional[String] $package_source = undef, Optional[String] $package_provider = undef, - Array $refclocks = [], + Hash $refclocks = {}, Chrony::Servers $peers = [], Chrony::Servers $servers = { '0.pool.ntp.org' => ['iburst'], diff --git a/templates/chrony.conf.epp b/templates/chrony.conf.epp index ed114c8..f562505 100644 --- a/templates/chrony.conf.epp +++ b/templates/chrony.conf.epp @@ -157,8 +157,10 @@ log <%= $chrony::log_options %> <% } -%> <% unless $chrony::refclocks.empty { -%> -<% $chrony::refclocks.each |$driver| { -%> -refclock <%= $driver.flatten.join(' ') %> +<% $chrony::refclocks.each |$driver, $clocks| { -%> +<% $clocks.each |$clock| { -%> +refclock <%= $driver %> <%= $clock %> +<% } -%> <% } -%> <% } -%> <% if $chrony::lock_all { -%>