R10K puppetfile安装,无需清除自定义模块

R10K puppetfile安装,无需清除自定义模块,puppet,Puppet,我制作了一些定制模块 这些自定义模块存储在my中。因此,如果我运行R10K部署环境,模块将在/etc/puppetlabs/code/environments/MY_BRANCH/modules/中运行 我现在想使用Puppet Forge中的一些模块,所以我将它们添加到我的Puppetfile,但是当我运行r10k Puppetfile安装时,模块目录被完全清除,只剩下Puppet Forge模块 解决这个问题的最佳方案是什么 之前: -modules/ -custom_facts/

我制作了一些定制模块

这些自定义模块存储在my中。因此,如果我运行
R10K部署环境
,模块将在
/etc/puppetlabs/code/environments/MY_BRANCH/modules/
中运行

我现在想使用Puppet Forge中的一些模块,所以我将它们添加到我的
Puppetfile
,但是当我运行
r10k Puppetfile安装时,
模块目录被完全清除,只剩下Puppet Forge模块

解决这个问题的最佳方案是什么


之前:

-modules/
  -custom_facts/
  -custom_files/
之后:

-modules/
  -certregen/
  -inifile/
期望的:

 -modules/
  -custom_facts/
  -custom_files/
  -certregen/
  -inifile/

Puppetfile
中安装模块有一个不太为人所知的选项。它是
local
选项:

您可以在
Puppetfile
中将其设置为
true
,以避免清除存储在控件repo中的模块:

mod 'custom_facts', local: true
mod 'custom_files', local: true
修改上述
Puppetfile
后,使用
r10k部署显示
确认满意的结果

注意,另一个选项是将本地模块移动到另一个模块目录中。例如:

repo root dir
|── Puppetfile
|── local_modules
|   |── custom_facts
|   |── custom_files
R10k将在模块部署期间忽略该目录(但在control repo的环境部署期间除外),并且不会清除模块。但是,您需要设置
environment.conf
以在该附加路径中查找模块: