[英]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.