我几乎不知道木偶问这个问题。
我想我明白,特定节点的configuration将由一些模块组成,并附带一些特定于节点的粘合剂。 从教程和文档可以看出,特定于节点的资源将位于node /nodename/ { }资源中的manifest / site.pp文件中,其中包含相关类的“includes”,以及使节点特定的资源configuration更改。
现在input一个外部节点分类器(ENC),如theForeman。
从我阅读的ENC文档中,我可以使用site.pp中的node /nodename/ { }资源,但是我不能声明任何新的资源。 基本上不推荐。 生成的YAML只是包含和可变的设置。
那么对于给定节点或主机组的特定configuration,这个接口是怎么做的?
你最终创build一个特定于节点的类吗? 你在哪里把这个类,在一个特定于节点的模块? 或者,您是否为您的特定于站点的configuration创build了一个全面的模块,并使用可以分配给特定节点的类?
在devise木偶 – angular色和configuration文件中expression了这一点。 基本原则如下:
我假设你告诉工头从木偶大师import,如果是的话,我会build议你设置你的傀儡目录:
puppet puppet/manifests puppet/manifests/site.pp puppet/manifests/nodes/default.pp puppet/manifests/nodes/{server-type}.pp ... puppet/modules puppet/modules/{module1} puppet/modules/{module1}/files puppet/modules/{module1}/manefests puppet/modules/{module1}/templates ... etc
那么你会包含这一行在site.pp文件中:
import 'nodes/*'
然后,在default.pp中创build您的基本服务器:
node default { #this is where you put all of the puppet directives you want on every server. #for example if you wanted screen on all of your servers package{ "screen": ensure -> installed; } }
然后在节点下的另一个文件中,说web.pp你可以包含它,然后设置所有Web服务器的指令,如下所示:
node /^web0[1-9]\.example\.com$/ inherits default { #this will inherit all of the settings in the default node and then do anything else you add. #like installing nginx package { "nginx": ensure -> installed; } }
你甚至可以像这个db.pp文件一样链接inheritance:
node db inherits default { #install postgresql-9.3 package { "postgresql-9.3": ensure -> installed; } } node /^db0[1-9]\.example\.com$/ inherits db { #This block can even be empty unless you need something here. }