gpt4 book ai didi

postgresql - 找不到声明的类 postgresql::server Puppet

转载 作者:行者123 更新时间:2023-11-29 12:57:47 25 4
gpt4 key购买 nike

我正在尝试使用 Puppet 在 vagrant box 上安装一个 postgresql9.4 实例。到目前为止,我并不喜欢使用 puppet 及其网站上的文档。到目前为止,我正在尝试从不同的教程和 Postgresql Puppet Forge 进行修补官方文档。

我做了什么:

  1. puppet 模块安装 puppetlabs-postgresql

  2. 我创建了一个 /etc/puppet/modules/postgresql/manifests/init.pp 文件

  3. 我已将这段代码放在 init.pp 文件中:

     class { 'postgresql::server':
    ip_mask_deny_postgres_user => '0.0.0.0/32',
    ip_mask_allow_all_users => '0.0.0.0/0',
    listen_addresses => '*',
    ipv4acls => ['hostssl all johndoe 192.168.0.0/24 cert'],
    postgres_password => 'TPSrep0rt!',
    }

我收到的错误是这样的:

    Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class postgresql::server at /etc/puppet/modules/postgresql/manifests/init.pp:7 on node vagrant-ubuntu-trusty-64.bbf.local
Wrapped exception:
Could not find declared class postgresql::server
Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find declared class postgresql::server at /etc/puppet/modules/postgresql/manifests/init.pp:7 on node vagrant-ubuntu-trusty-64.bbf.local

我对 Puppet 感到非常沮丧,我试图跟随“部署 Rails”和官方锻造站点以使其正常工作,但无济于事。

我对 puppet 的不满是该站点没有指定放置任何东西的位置。从教程中,我将我的 puppet 代码放在 init.pp 中,但是 postgresql 有 repo.pp、server.pp 等等,它没有告诉你在哪里放置 puppet 代码。有人可以帮助我吗?

最佳答案

So far, I am not enjoying my time with puppet and the documentation on its site. So far I'm attempting to patch along from different tutorials and the Postgresql Puppet Forge official documentation.

我无法谈论您一直在关注的未指定教程,但 Puppet 自己的 Postgresql 模块的文档假定您已经熟悉 Puppet 语言和操作模式。我自己,我一直认为Puppet's documentation非常好,甚至在商业版本发布之前。

可以考虑考官方VM-based tutorial ,但最终我建议阅读(或至少略读)Language Reference .如果您打算编写自己的模块(大多数用户都这样做),那么您还应该了解 Type Reference .即使您不打算编写自己的模块,您也会使用模块,因此浏览一下 the section on module fundamentals 很有用。 .还有更多可能有用的内容,但这应该足以让您有一个良好的开端。

My frustration with puppet is that the site doesn't specify where to put anything.

语言引用的“Basics”一章解决了第一部分:

Puppet always begins compiling with a single manifest (which may be broken up into several pieces), called the “site manifest” or “main manifest.” See the reference page on the main manifest for details about this special file/directory.

链接页面介绍了一些细节,主要是因为在主/代理设置中有相当大的灵 active 和多个选项。如果您使用 puppet apply ,但是,主 list 就是您在 puppet 上指定的任何文件。命令行。一个类声明,如您所呈现的,应该进入您的主 list ,可能在节点 block 内,或者进入另一个类的定义,在某个模块中,这将直接或间接在您的主要 list 中声明。正如 Perl 爱好者常说的那样,“实现它的方法不止一种。”

我强调类声明和类定义之间的区别。前者粗略地说,“命名的类应该应用于目标节点”,而后者描述了将类应用于节点的含义。您可以将这些类比为一方面的函数调用,另一方面的函数体。由于您正在尝试使用第三方模块中的类,因此后者应该是模块的一部分。假设您的 Puppet 安装在 /etc/puppet 中, 整体/etc/puppet/modules/postgresql目录属于模块实现,你不应该在那里放任何东西。在那种情况下,模块工具应该已经安装了类 postgresql::server 的定义。在 /etc/puppet/modules/postgresql/manifests/server.pp .

我无法为您提供有关您应该做什么的具体信息,因为您没有提供一些基本细节,尤其是您是在运行代理还是使用 puppet apply . Puppet 3 和 Puppet 4 之间也存在一些可能相关的差异(例如,默认安装位置)。尽管如此,我希望这已经为您指明了正确的方向。

关于postgresql - 找不到声明的类 postgresql::server Puppet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38776315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com