我想安装splunkforwarder,没有任何现有的模块正在工作。 所以,我只是决定从头开始写,除了有趣的故事,我只是在安装这个软件包。
所以,我在我的木偶主服务器上创build了一个存储库。 存储库工作。 如果我在客户端上进行yum安装,我可以安装splunkforwarder,并将其正确安装在/ opt下。 所以,我的存储库不是问题。
所以,我只想要没有configuration的最基本的基本安装。
class splunk2 { package { "splunkforwarder": ensure => "installed" } }
这没有奏效。 没有日志,客户端不会抛出错误 – 也没有提到安装它。
只有两个文件; init.pp和up.pp
init.pp只包含;
class splunk2 { }
仍是同样的问题。 我只是想不出有什么问题,因为如果我只是想要安装这个软件包,这应该是非常基本的。
有任何想法吗 :(?
编辑:我确实把lololdolaol放入up.pp和傀儡没有抱怨。 这几乎就像忽略了这个模块。
是的,Puppet忽略了模块,因为它不是以Puppetmaster的类自动加载器接受的方式构造的。
从一开始,你的模块在哪里生活? 可能在/etc/puppet/modules 。 所以在那里你有以下的目录和文件结构:
<modulename>/files/ <modulename>/templates/ <modulename>/manifests/ <modulename>/manifests/init.pp
在模块结构中还有其他几个目录,但是这三个目录是最常用和最重要的。 files和templates目录是可选的,而如果你的模块包含类或者更一般的清单,那么manifests目录是强制性的。 在那里你把你的课。 一个init.pp文件在大多数情况下也是必须的。
你的模块目录和文件现在看起来像这样:
splunkforwarder/files/ splunkforwarder/templates/ splunkforwarder/manifests/ splunkforwarder/manifests/init.pp
你的init.pp可以包含所有的魔法:
class splunkforwarder { package { 'splunkforwarder': ensure => 'installed', } }
您已经定义了一个类“splunkforwarder”来pipe理同一个名称的单个包。 你现在可以做了
include 'splunkforwarder'
在你的节点configuration中,splunkforwarder包应该安装在下一次Puppet运行。