R10K puppetfile 安装而不清除自定义模块
R10K puppetfile install without clearing custom modules
我制作了一些自定义模块。
这些自定义模块存储在我的 R10K control-repo 中。所以如果我 运行 R10K deploy environment
模块在 /etc/puppetlabs/code/environments/MY_BRANCH/modules/
中并且正在工作。
我现在想使用 Puppet Forge 中的一些模块,所以我将它们添加到我的 Puppetfile
,但是当我 运行 r10k puppetfile install
模块目录完全清理完毕,只剩下人偶锻造模块
最好的解决方案是什么?
之前:
-modules/
-custom_facts/
-custom_files/
之后:
-modules/
-certregen/
-inifile/
期望:
-modules/
-custom_facts/
-custom_files/
-certregen/
-inifile/
Puppetfile
中有一个不太为人所知的模块安装选项。它是 local
选项:https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#local.
您可以在 Puppetfile
中将其设置为 true
以避免清除存储在控制库中的模块:
mod 'custom_facts', local: true
mod 'custom_files', local: true
如上修改Puppetfile
后,使用r10k deploy display
确认效果满意
请注意,另一种选择是将本地模块移动到另一个模块目录中。例如:
repo root dir
|── Puppetfile
|── local_modules
| |── custom_facts
| |── custom_files
R10k 将在模块部署期间忽略该目录(但在您的控制库的环境部署期间不会)并且不会清除模块。但是,您需要设置 enviroment.conf
以在该附加路径中查找模块:https://docs.puppet.com/puppet/5.0/config_file_environment.html#modulepath
我制作了一些自定义模块。
这些自定义模块存储在我的 R10K control-repo 中。所以如果我 运行 R10K deploy environment
模块在 /etc/puppetlabs/code/environments/MY_BRANCH/modules/
中并且正在工作。
我现在想使用 Puppet Forge 中的一些模块,所以我将它们添加到我的 Puppetfile
,但是当我 运行 r10k puppetfile install
模块目录完全清理完毕,只剩下人偶锻造模块
最好的解决方案是什么?
之前:
-modules/
-custom_facts/
-custom_files/
之后:
-modules/
-certregen/
-inifile/
期望:
-modules/
-custom_facts/
-custom_files/
-certregen/
-inifile/
Puppetfile
中有一个不太为人所知的模块安装选项。它是 local
选项:https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#local.
您可以在 Puppetfile
中将其设置为 true
以避免清除存储在控制库中的模块:
mod 'custom_facts', local: true
mod 'custom_files', local: true
如上修改Puppetfile
后,使用r10k deploy display
确认效果满意
请注意,另一种选择是将本地模块移动到另一个模块目录中。例如:
repo root dir
|── Puppetfile
|── local_modules
| |── custom_facts
| |── custom_files
R10k 将在模块部署期间忽略该目录(但在您的控制库的环境部署期间不会)并且不会清除模块。但是,您需要设置 enviroment.conf
以在该附加路径中查找模块:https://docs.puppet.com/puppet/5.0/config_file_environment.html#modulepath