如何在 puppet 中包含来自不同目录的模块 [英] How to include modules from a different directory in puppet

查看:50
本文介绍了如何在 puppet 中包含来自不同目录的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的模块树是这样的

 - 模块- socle1- 标准库- socle2- ntp

如何在我的 site.pp 中包含 stdlib 模块?

我尝试过 include socle1::stdlib 但它不起作用.

是否应该修改目录环境的environment.conf?

解决方案

如果您想将模块安排在单独的树中,那么您可以这样做.然后,您应该在环境的模块路径中包含每个基本路径,并通过它们的常规名称来引用模块.请特别注意,更改模块的路径不会更改其名称或其定义的任何类或类型的名称——路径仅影响自动加载器是否可以找到它们.

然而,我强烈建议不要在标准模块目录下创建子目录.相反,如果您想在多个目录中对模块进行分组,则为此目的创建并行模块目录:

- 模块- socle1- 标准库- socle2- ntp

<块引用>

目录环境需要修改environment.conf吗?

为了支持超出或代替默认值的任何模块目录,是的,您应该这样做.Puppet 文档描述了如何配置环境的模块路径.但是请考虑遵循@MattSchuchard 的建议,而不是将自己限制在标准模块目录中.

My module tree is like this

   - modules
     - socle1
       - stdlib
     - socle2
       - ntp

How do I include the stdlib module in my site.pp?

I have tried include socle1::stdlib and it is not working .

Should I modify the environment.conf for the directory environment?

解决方案

If you want to arrange your modules in separate trees, then you may do so. You should then include each base path in your environment's modulepath, and refer to the modules by their regular names. Note in particular that altering the path to a module does not change its name or the names of any of the classes or types it defines -- the path influences only whether the autoloader can find them.

I strongly advise against making subdirectories of the standard module directory, however. Instead, if you want to group modules in multiple directories then create parallel module directories for that purpose:

- modules
- socle1
  - stdlib
- socle2
  - ntp

Should I modify the environment.conf for the directory environment?

In order to support any module directories beyond or instead of the default, yes, you should. The puppet documentation describes how to configure your environment's modulepath. But do consider following @MattSchuchard's advice and instead restricting yourself to the standard module directories.

这篇关于如何在 puppet 中包含来自不同目录的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆