在站点清单中引用来自Puppet仪表板的组/类

我正在使用Puppet仪表板作为我的ENC,我不确定如何引用或使用/etc/puppet/manifests/site.pp类和组分类。

我在仪表板中定义了两个组: CentOS6SLES11 。 如果我想要在CentOS6组中包含特定的模块列表,并在SLES11组中包含特定的模块列表,那么我的site.pp应该是什么样的?

我正在尝试做这样的事情:

 # /etc/puppet/manifests/site.pp node basenode { include hosts include ssh::server include ssh::client include authentication include sudo include syslog include mail } node 'CentOS6' inherits basenode { include profile } node 'SLES11' inherits basenode { include usrmounts } 

我在我的模块中有特定于操作系统的case语句,但是有一些模块只适用于某些发行版。 所以我想我有两个问题:

  1. 这是以特定于操作系统的方式应用模块/资源的最佳方法吗? 还是上面让你想吐?
  2. 无论#1,我仍然好奇如何在我的清单中从仪表板中引用类,组和节点。 我已阅读外部节点文档,但我没有看到它们如何对应于清单。

谢谢大家。

您正处于外部节点分类器的正确轨道上。 把头围绕一点是困难的,但是一个人能够正常工作,你永远不会回头,我不能推荐这么做。 当我遇到麻烦时,我去了傀儡IRC的房间,他们帮我开始工作。

  1. 应用基于OS的不同模块是好的。 我使用BSD和RHEL运行300多个节点的环境,我们这样做。 而不是让操作系统成为节点,因为我们把它当作自己的类。 所以不是“节点操作系统inheritancebasenode”,我们确实有ENC回传这样的东西:

     node web-prod-007 { $node_environment="production" include web_server_class # this then inherits basenode include centos6::server # include logging::rsyslog } 

    …等等

如何做到这一点取决于你希望inheritance的工作方式,如果你想根据操作系统修改basenode中的东西,那么让OSinheritancebasenode是正确的select。

TLDR,你在做什么是好的,看看ENC的,因为他们让生活更轻松。

编辑:2.我不使用仪表板,所以我不知道。

好的,我明白这是如何工作的。 如果将仪表板设置为外部节点分类器(ENC) ,则Puppet仪表板将replacesite.pp 那么,这不完全正确,因为你可以使用两个:

ENC可以与site.pp中的标准节点定义共存,并且在每个源中声明的类被有效地合并。

据我了解,仪表板Classes =您的傀儡模块的名称。 而且您可以创build“ 组”以将类组合到一起以应用于一组节点。 我已经用我所有的CentOS 6服务器build立了一个CentOS6组,并且在我原来的问题中,每个旧的site.pp都有我希望我的CentOS 6服务器应用到他们的目录中的所有 (模块)。 向组添加节点和类都可以通过仪表板完成。

另一个例子:

site.pp

 node default { include iptables include selinux include dns include test } 

转换site.pp到Puppet仪表板(截图):

木偶仪表板