[英]Error while running Puppet Agent using class in node default
执行 puppet脚本时出现错误
在 Puppet master site.pp
文件上,我编写了以下代码
node default {
class t {
package {'apache2':
ensure => installed,
}
}
}
在从机器上,当我使用puppet agent --test
执行它时,它会抛出错误:
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not parse for environment production: Classes, definitions, and nodes may only appear at toplevel or inside other classes (file: /etc/puppet/code/environments/production/manifests/site.pp, line: 3, column: 1) on node slave.ec2.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
你能在这方面帮助我吗
嗨,这是因为您不应该在site.pp
中定义类
有一个模块foo
(因为我更喜欢foo
作为示例而不是t
)定义如下:
#modules/foo/manifests/init.pp
class foo {
package {'apache2':
ensure => installed,
}
}
并且您的 site.pp 中有一个节点条目,如下所示
# site.pp
node default {
include 'foo'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.