木偶:模块中的多个清单

SmxCde

我正在尝试创建Puppet模块来设置我的Web服务器。

我想-就是分裂的配置逻辑模块(通过服务体现:webserverdatabaseftp等),但我无法弄清楚如何使用更多的体现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这里没有问题
  • 人偶版本v2.7.11
  • Ubuntu 12.04 LTS

我做错了什么?提前致谢!

塞克

您的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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章