在/etc/puppetlabs/code/modules/send/manifests/init.pp
class send {
file { '/tmp/hello.txt':
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet://modules/send/hello.txt',
}
}
在/etc/puppetlabs/code/modules/send/files/hello.txt
puppet agent -t
报告
[root@consul-test-02 tmp]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for consul-test-02
Info: Applying configuration version '1438919627'
Error: /Stage[main]/Send/File[/tmp/hello.txt]: Could not evaluate: Could not retrieve file metadata for puppet://modules/send/hello.txt: getaddrinfo: Name or service not known
Notice: Applied catalog in 0.03 seconds
答案 0 :(得分:2)
您的网址缺少斜杠。使用
source => 'puppet:///modules/send/hello.txt',
注意三重斜杠。您的网址为puppet://modules/...
,因此它有modules
的主机部分,(幸运的是)无法解析为您环境中的地址。