puppet使用过程中的报错
puppet版本:
# puppet -V
3.8.7
系统版本:
centos 6.10
1、报错关键点Could not retrieve information from environment production source(s)
Error: /Stage[main]/Ssh::Config/File[/etc/ssh/sshd_config]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/ssh/files/sshd_config
这类错误出错点很多,都是因为文件找不到,这次错误的原因是对fileserver 不理解,puppet 的fileserver用puppet:/// 此开头,并且插入一个明显的files目录【但是你却不用在文件路径中体现】,如果一个puppet文件路径是:
puppet:///modules/ssh/sshd_config
其文件的具体路径应为:
/etc/puppet/modules/ssh/files/sshd_config
注意: puppet文件路径中没有files这个目录,而具体文件路径中却有,这个是puppet的一个规定
2、报错关键点getaddrinfo: Name or service not known
Error: /Stage[main]/Ssh::Config/File[/etc/ssh/sshd_config]: Could not evaluate: Could not retrieve file metadata for puppet://modules/ssh/files/sshd_config: getaddrinfo: Name or service not known
错误原因在于puppet文件路径的书写方式上,正确的写法是puppet:///三道斜杠 而上面写成puppet://两个斜线
错误的写法:
source => "puppet://modules/ssh/sshd_config",
正确的写法:
source => "puppet:///modules/ssh/sshd_config",
3、报错关键点Permission denied
Could not evaluate: Could not retrieve file metadata for puppet:///modules/ssh/sshd_config: Error 400 on SERVER: Permission denied – /etc/puppet/modules/ssh/files/sshd_config
错误的原因在于权限,puppet无权处理root用户的文件
# ls -lh modules/ssh/files/sshd_config
-rw——- 1 root root 3.8K 12月 18 17:17 modules/ssh/files/sshd_config
修改用户权限即可
#chown puppet modules/ssh/files/sshd_config
# ls -lh modules/ssh/files/sshd_config
-rw——- 1 puppet root 3.8K 12月 18 17:17 modules/ssh/files/sshd_config