[英]Puppet: Multiple manifests in module
我正在嘗試創建Puppet
模塊來設置我的Web服務器。
我想要的是 - 將配置拆分為邏輯模塊(按服務顯示: webserver
, database
, ftp
等)但我無法弄清楚如何在init.pp
使用其他清單
我將僅使用puppet apply
而不是服務器 - 客戶端配置。
我的文本模塊清單(kp / manifests / init.pp):
class kp {
include kp::testfile
}
include kp
額外的清單(kp / manifests / testfile.pp)
define kp::testfile {
$value = template("kp/some.erb")
file { 'testfile':
path => '/tmp/my.txt',
ensure => file,
content => $value
}
}
文件說:
If a class is defined in a module, you can declare that class by name in any manifest. Puppet will automatically find and load the manifest that contains the class definition.
但是,當我運行puppet apply init.pp
我收到錯誤消息
Could not find class kp::testfile for myhost.com at /myDir/puppetModules/kp/manifests/init.pp:2 on node vagrant.example.com
事實
/myDir/puppetModules/
在modulepath
所以這里沒有問題 我做錯了什么? 提前致謝!
你的kp :: testfile是一個已定義的類型,而不是一個類。 要使用已定義的類型,您需要聲明它:
kp::testfile { 'name': }
嘗試重新定義kp :: testfile之類的
class kp::testfile {
$value = template("kp/some.erb")
file { 'testfile':
path => '/tmp/my.txt',
ensure => file,
content => $value
}
}
你可能會有更好的運氣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.