从人偶主机到代理的文件复制失败

file copy from puppet master to agent fails

我正在尝试执行从傀儡大师到代理的简单文件复制。

  [root@****************** manifests]# cat site.pp

    file {'/home/ec2-user/my_bash_script.sh':
    source => "puppet:///modules/mymodule/my_bash_script.sh",
    mode => '755',
    }

请找出错误。

 [root@ip-***********/]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for ip-10-20-1-137.dev.uberops.net
Info: Applying configuration version '1472255014'
Error: /Stage[main]/Main/File[my_bash_script.sh]: Could not evaluate: 
Could not retrieve information from environment production source(s)   
puppet:///modules/mymodule/my_bash_script.sh
Notice: Finished catalog run in 0.06 seconds

任何人都可以告诉我我在这里缺少什么。

由于您使用的是 Puppet >= 3.7,因此您需要为自己的模块使用目录环境。 /etc/puppet/modules/ 目录或 $basemodulepath 用于基本模块,例如 stdlib、lvm 等,它们未声明,但具有引用的类型、函数等。

将您的模块从 /etc/puppet/modules/ 移动到您客户在 /etc/puppet/environments/'environment'/modules 的适当目录环境以解决您的问题。

附加信息:

对于 Puppet Enterprise 3.8,这将位于 /etc/puppetlabs/puppet/environments/'environment'/modules。对于 Puppet 4 企业版和非企业版,这将位于 /etc/puppetlabs/code/environments/'environment'/modules.

使用默认的生产目录环境,对于您的情况,这将是 /etc/puppet/environments/production/modules

Could not retrieve information from environment production source(s) 此错误表明,puppet 无法找到您安抚的文件。 请仔细检查您提供的路径以及文件是否存在。

一般文件结构如下:

-/etc/puppet -/etc/puppet/manifest/ -/etc/puppet/files -/etc/puppet/modules

如果您在其他地方设置了模块目录 (/modules/mymodule/files/your-file-here),那么您的文件路径将是; puppet:///modules-directory/modules-name/file-namepuppet:///modules/mymodule/your-file-here

URL puppet:///modules/mymodule/my_bash_script.sh 对应一个相对于适用模块路径的文件mymodule/files/my_bash_script.sh。该文件必须存在并且可以被 master / puppetserver 进程读取。可能会产生您所呈现的那种错误的最常见问题是

  • 你拼错了文件名
  • 你把文件放错目录了
  • 所有权/权限/ACL/SELinux 上下文和策略不允许主人读取文件