下面是我的示例清单,用于在计算机上设置ntp,以连接到源“10.0.2.15”
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变量时,该文件将按预期的方式创建。
发布于 2013-10-16 20:39:10
用双引号代替单引号:
服务器=> "${ntpSource} iburst",“localhost”,
来自木偶网站的报价:
木偶中有两种引号:单引号(')和双引号(")。主要区别是双引号允许您插入$variables。
https://stackoverflow.com/questions/19408778
复制相似问题