我正在尝试创建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
}
}
可能会带来更好的运气。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句