0
這裏是我用來設置NTP我的機器上連接到我的源'10我的示例清單.0.2.15'設置NTP使用木偶的NTP內置類
class myNtpClass ($ntpSource='10.0.2.15') {
file {'myFile':
ensure => present,
path => '/test2',
content => "servers => ['${ntpSource} iburst']",
}
class { '::ntp':
servers => ['${ntpSource} iburst', 'localhost'],
restrict => ['restrict 127.0.0.1', 'restrict 10.0.2.0/24'],
}
}
include myNtpClass
我使用的是內置的NTP類來將我的源服務器列表插入到我的ntp配置中。
當我執行這個清單時,$ ntpSource變量不會在我的ntp.conf配置文件中被替換。
這裏是運用木偶清單後,我的ntp.conf文件,
# ntp.conf: Managed by puppet.
#
# Keep ntpd from panicking in the event of a large clock skew
# when a VM guest is suspended and resumed.
tinker panic 0
# Permit time synchronization with our time source, but do not'
# permit the source to query or modify the service on this system.'
restrict 127.0.0.1
restrict 10.0.2.0/24
# Servers
server ${ntpSource} iburst
server localhost
# Driftfile.
driftfile /var/lib/ntp/drift
我不知道我要去的地方錯了。 當我嘗試在文件中打印$ ntpSource變量時;該文件按預期創建。
非常感謝 – user2887201