你如何创build一个“使用”傀儡伪造模块之一的傀儡清单?
class foo { include puppetlabs-git (<- this doesn't work) #https://forge.puppetlabs.com/puppetlabs/git package {'openssl-devel': ensure => latest, } #package {'git': (<- commented out because it seems like there is a better way using puppet forge) # ensure => installed, #} } class {'foo': }
http://docs.puppetlabs.com/learning/modules1.html 包含和要求在傀儡之间有什么区别
您仍然必须先从伪造下载该模块:
puppet module install puppetlabs/git
它将把它放在默认的模块path中,但是可以用–modulepath开关覆盖它。
你可以在你提到的URL处看到提到的命令…;)
然后你使用这个模块:
include git
您需要先安装模块 – 在您的主站上使用puppet module install puppetlabs-git命令。
完成之后,可以通过include git来使用模块 – 请注意, puppetlabs-前缀是特定于伪造的约定,一旦安装完成,它就不会包含在模块名称中。
顺便说一下,这个模块几乎就是你已经有的package {"git": ensure => installed } 一个资源可能没有太多需要单独的模块。
使用以下步骤在木偶模块中使用现有的木偶模块。
首先安装你想要在你的模块中包含的木偶模块。
例如,如果你想包含你的木偶模块的Apache模块:
puppet module install puppetlabs/apache
之后,在你的模块中添加任何类,例如:
class foo { include apache and rest of your code.... }
那么确保你的模块保存在/etc/puppetlabs/puppet/modules/目录下,因为默认模块安装在这个目录下。