Zam*_*ues 1 puppet rhel6 puppetmaster
我正在尝试使用文件资源复制文件。我的代码如下:
node 'Node-002' {
file { "/root/helloworld.txt":
ensure => file,
owner => "root",
group => "root",
mode => "0644",
source => "puppet://modules/templates/${fqdn}/hosts.erb",
}
}
Run Code Online (Sandbox Code Playgroud)
但它因以下错误而失败
Error: /Stage[main]/Main/Node[Node-002]/File[/root/helloworld.txt]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/templates/Node-002.example.com/hosts.erb
Run Code Online (Sandbox Code Playgroud)
模板位置如下:
ls -l /apps/wps/puppetlabs/code/environments/production/modules/templates/Node-002.example.com/hosts.erb
-rw-r--r-- 1 puppet puppet 462 Jul 20 02:13 /apps/wps/puppetlabs/code/environments/production/modules/templates/Node-002.wiley.com/hosts.erb
Run Code Online (Sandbox Code Playgroud)
即使我在source
参数中给出完整路径,它也会因相同的错误而失败。
我正在使用木偶 4.5.4
请建议
您的模块似乎不符合标准目录结构。如果源 URL 为puppet:///modules/foo/bar.txt
,Puppet 将查找${codedir}/environments/production/modules/foo/files/bar.txt
。静态文件应位于files
模块内的子目录中。模板应位于templates
模块内的子目录中,并在file
带有content => template('foo/bar.erb')
. 您使用 ERB 模板作为不会以任何方式处理的源似乎有些混乱。
请参阅https://docs.puppet.com/puppet/latest/reference/modules_fundamentals.html了解您的模块的结构。
归档时间: |
|
查看次数: |
488 次 |
最近记录: |