Skip to content

Commit 73d0214

Browse files
author
Morgan Haskel
committed
Merge pull request #243 from hunner/udlc
Fix PR #235 and make udlc configurable
2 parents 21a7191 + 429e7c5 commit 73d0214

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

README.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Tells Puppet what NTP service to manage. Valid options: string. Default value: v
255255

256256
####`udlc`
257257

258-
Specifies whether to enable specialized configuration options for an undisciplined local clock, regardless of its status as a virtual machine. Valid options: 'true' or 'false'. Default value: 'false'
258+
Specifies whether to configure ntp to use the undisciplined local clock as a time source, regardless of the node's status as a virtual machine. Valid options: 'true' or 'false'. Default value: 'false' for VMs and 'true' otherwise.
259259

260260
##Limitations
261261

manifests/params.pp

+9-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
$service_enable = true
1414
$service_ensure = 'running'
1515
$service_manage = true
16-
$udlc = false
1716
$interfaces = []
1817
$disable_auth = false
1918
$broadcastclient = false
@@ -26,6 +25,15 @@
2625
default => true,
2726
}
2827

28+
# On virtual systems, disable the use of the undisciplined local clock to
29+
# avoid ntp falling back to the local clock in preference over ntp servers.
30+
# TODO Change this to str2bool($::is_virtual) when stdlib dependency is >= 4
31+
# NOTE The "x${var}" is just to avoid lint quoted variable warning.
32+
$udlc = "x${::is_virtual}" ? {
33+
'xtrue' => false,
34+
default => true,
35+
}
36+
2937
$default_config = '/etc/ntp.conf'
3038
$default_keys_file = '/etc/ntp/keys'
3139
$default_driftfile = '/var/lib/ntp/drift'

templates/ntp.conf.erb

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ broadcastclient
3838
server <%= server %><% if @iburst_enable == true -%> iburst<% end %><% if @preferred_servers.include?(server) -%> prefer<% end %>
3939
<% end -%>
4040

41-
<% if @is_virtual == "true" or @udlc -%>
41+
<% if @udlc -%>
4242
# Undisciplined Local Clock. This is a fake driver intended for backup
43-
# and when no outside source of synchronized time is available.
44-
server 127.127.1.0
45-
fudge 127.127.1.0 stratum 10
43+
# and when no outside source of synchronized time is available.
44+
server 127.127.1.0
45+
fudge 127.127.1.0 stratum 10
4646
restrict 127.127.1.0
4747
<% end -%>
4848

0 commit comments

Comments
 (0)