从模块外部采购 Puppet 文件 [英] Sourcing Puppet files from outside of modules

查看:26
本文介绍了从模块外部采购 Puppet 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从一个模块(在这种特定情况下为 Nginx)安装一个包,并希望包含一个来自模块外部的配置文件,即来自顶级 files 目录与顶级 manifests 目录平行.尽管没有将文件包含在模块中或在我当前的 Vagrant 环境中引用绝对本地路径,但我看不到任何获取文件的方法.

I'm installing a package from a module (Nginx in this specific case) and would like to include a configuration file from outside of the module, i.e. from a top level files directory parallel to the top level manifests directory. I don't see any way to source the file though without including it in a module or in my current Vagrant environment referring to the absolute local path.

Puppet 是否允许从文档中描述的模块外部获取文件?

Does Puppet allow for sourcing files from outside of modules as described in the documentation?

推荐答案

如果我正确理解你的问题,你可以.在您的模块中,像这样的简单代码

if I understand your question correctly, you can. In your module a simple code like this

file { '/path/to/file':
    ensure => present,
    source => [
               "puppet:///files/${fqdn}/path/to/file",
               "puppet:///files/${hostgroup}/path/to/file",
               "puppet:///files/${domain}/path/to/file",
               "puppet:///files/global/path/to/file",
    ],
}

会完成这项工作./path/to/file 将使用位于文件"Puppet 共享中的文件获取.(在上面的例子中,它搜索了 4 个不同的位置).

will do the job. The /path/to/file will be sourced using a file located in the "files" Puppet share. (in the example above, it search in 4 different locations).

更新 也许您正在谈论一个用于存储 Puppet 文件服务器未共享的文件的目录(查看 http://docs.puppetlabs.com/guides/file_serving.html),在这种情况下,我认为,无论是否流浪,您都可以添加它到您的 Puppet 文件服务器来执行此操作.我认为这是最好的(也许是唯一的)方法.

update maybe you're talking about a directory to store files which is not shared by Puppet fileserver (look at http://docs.puppetlabs.com/guides/file_serving.html), and in this case you can't i think, Vagrant or not, but you can add it to your Puppet fileserver to do it. I thinks it's the best (and maybe only) way to do it.

这篇关于从模块外部采购 Puppet 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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