使用 Puppetfile 在 master 上安装 puppet 模块

Installing a puppet module on master with Puppetfile

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

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

我去分行,将以下内容添加到Puppetfile

mod 'puppetlabs-certregen', '0.2.0'

然后我在服务器上运行puppet agent -t。命令似乎成功了,因为我的清单中的命令是 运行,但是当我 运行 puppet certregen healthcheck 时,模块似乎没有安装。

使用 Puppetfile 安装模块的正确方法是什么?

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

对于 Puppetfile,这是 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 don't play well together:

Restriction: If you are using Code Manager or r10k, do not install, update, or uninstall modules with the puppet module command. With code management, you must install modules with a Puppetfile. Code management purges modules that were installed with the puppet module command. See the Puppetfile documentation for instructions.