使用puppet'设置ntp;s ntp内置类

使用puppet'设置ntp;s ntp内置类,puppet,ntp,Puppet,Ntp,这是我的示例清单,用于在我的计算机上设置ntp以连接到我的源“10.0.2.15” class myNtpClass ($ntpSource='10.0.2.15') { file {'myFile': ensure => present, path => '/test2', content => "servers => ['${ntpSource} iburst']", } class { '::ntp': serv

这是我的示例清单,用于在我的计算机上设置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配置文件中被替换

这是应用puppet清单后的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变量时;文件按预期创建。

使用双引号而不是单引号:

服务器=>[“${ntpSource}iburst”,“localhost']

引自傀儡网站:

Puppet中有两种引号:single(')和double(“)。 主要区别在于,双引号允许插值 $variables