Skip to content

Commit 03d8b2c

Browse files
committed
Merge pull request #254 from juniorsysadmin/udlc-stratum
(MODULES-1837) Make udlc stratum configurable
2 parents 789d47a + bbf6635 commit 03d8b2c

File tree

5 files changed

+19
-1
lines changed

5 files changed

+19
-1
lines changed

README.markdown

+4
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,10 @@ Tells Puppet what NTP service to manage. Valid options: string. Default value: v
265265

266266
Specifies whether to configure ntp to use the undisciplined local clock as a time source. Valid options: 'true' or 'false'. Default value: 'false'
267267

268+
####`udlc_stratum`
269+
270+
Specifies the stratum the server should operate at when using the undisciplined local clock as the time source. It is strongly suggested that this value be set to no less than 10 where ntpd may be accessible outside your immediate, controlled network. Default value: 10
271+
268272
##Limitations
269273

270274
This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified.

manifests/init.pp

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
$service_manage = $ntp::params::service_manage,
2929
$service_name = $ntp::params::service_name,
3030
$udlc = $ntp::params::udlc,
31+
$udlc_stratum = $ntp::params::udlc_stratum,
3132
) inherits ntp::params {
3233

3334
validate_bool($broadcastclient)

manifests/params.pp

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
$service_ensure = 'running'
1616
$service_manage = true
1717
$udlc = false
18+
$udlc_stratum = '10'
1819
$interfaces = []
1920
$disable_auth = false
2021
$broadcastclient = false

spec/acceptance/ntp_parameters_spec.rb

+12
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,16 @@ class { 'ntp':
181181
end
182182
end
183183

184+
describe 'udlc_stratum' do
185+
it 'sets the stratum value when using udlc' do
186+
pp = "class { 'ntp': udlc => true, udlc_stratum => 10 }"
187+
apply_manifest(pp, :catch_failures => true)
188+
end
189+
190+
describe file("#{config}") do
191+
it { should be_file }
192+
its(:content) { should match 'stratum 10' }
193+
end
194+
end
195+
184196
end

templates/ntp.conf.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ server <%= server %><% if @iburst_enable == true -%> iburst<% end %><% if @prefe
4242
# Undisciplined Local Clock. This is a fake driver intended for backup
4343
# and when no outside source of synchronized time is available.
4444
server 127.127.1.0
45-
fudge 127.127.1.0 stratum 10
45+
fudge 127.127.1.0 stratum <%= @udlc_stratum %>
4646
restrict 127.127.1.0
4747
<% end -%>
4848

0 commit comments

Comments
 (0)