Puppet 傀儡文件URL指向';名称或服务未知';

Puppet 傀儡文件URL指向';名称或服务未知';,puppet,Puppet,在/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/module

在/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中

傀儡代理-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

你的URL缺少斜杠。使用

source => 'puppet:///modules/send/hello.txt',

注意三个斜杠。你的URL有
puppet://modules/...
因此它有一部分
模块
,幸运的是,这些模块无法解析为您环境中的地址。

谢谢。这是可行的。但我不明白为什么要用三个斜杠。URL的主机部分应该保持为空,这样Puppet就会自动连接到编译目录的主机。如果愿意,您也可以在此处插入有效的主机名,例如
puppet://my.puppet.server/modules/...
。我明白了。再次感谢你的帮助。