使用Puppetfile在主节点上安装Puppet模块

3

我将使用R10K来管理我的配置文件。

我想要使用Puppet文件在我的主服务器上安装一个Puppet模块。

我去到分支并在Puppetfile中添加以下内容:

mod 'puppetlabs-certregen', '0.2.0'

我随后在服务器上运行了 puppet agent -t 命令,该命令似乎成功执行了我的清单文件中的命令,但当我运行puppet certregen healthcheck时,该模块似乎没有安装。使用Puppetfile安装模块的正确方法是什么?
1个回答

3

Puppetfile类似于Ruby Gemfile、Python requirements.txt:它列出依赖项,然后由单独的工具安装。

对于Puppetfiles,这个工具是r10k

文档在这里https://puppet.com/docs/pe/2018.1/puppetfile.html

您也可以使用命令行直接下载模块:

puppet module install puppetlabs-certregen
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/Users/petersouter/.puppetlabs/etc/code/modules
└─┬ puppetlabs-certregen (v0.2.0)
  └── puppetlabs-stdlib (v4.17.1)

请注意,r10k和puppet module install 不兼容

限制:如果您正在使用Code Manager或r10k,请勿使用puppet module命令安装、更新或卸载模块。使用代码管理,必须使用Puppetfile安装模块。代码管理会清除使用puppet module命令安装的模块。有关说明,请参阅Puppetfile文档


1
在旧版本的 Ruby (<2.3) 上,您可以安装 /opt/puppetlabs/puppet/bin/gem install librarian-puppet,将 /opt/puppetlabs/puppet/bin 添加到路径中,然后在 Puppetfile 所在的文件夹中执行 librarian-puppet update - desertkun

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接