简体   繁体   English

puppet 文件资源,如何指向源

[英]puppet file resource, how to point to source

When referring to a file resource on the puppet master, does it have to reside under the modulepath?当引用 puppet master 上的文件资源时,它是否必须驻留在模块路径下? The docs here seem to indicate it. 这里的文档似乎表明了这一点。

The file I'm using was put under the profiles folder instead.我正在使用的文件放在profiles文件文件夹下。 I'm trying to refer to it like this:我试图这样引用它:

source  =>  puppet:///profiles/a_subfolder/myfile

(The physical path on the box is /profiles/files/a_subfolder/myfile ) (盒子上的物理路径是/profiles/files/a_subfolder/myfile

I'm not having any luck so far and wanted to confirm that I can point a file resource somewhere besides the modulepath, and that my URI is correct.到目前为止,我没有任何运气,并想确认我可以将文件资源指向除模块路径之外的某处,并且我的 URI 是正确的。

Also, if my subfolder doesn't exist yet on the puppet agent, do I need to set some extra flags to both create the folder path and put the file in place?另外,如果我的子文件夹在 puppet 代理上还不存在,我是否需要设置一些额外的标志来创建文件夹路径并将文件放置到位? Here's what I have now:这是我现在所拥有的:

    ensure  =>  'present',
    source  =>  'puppet:///profiles/a_subfolder/myfile',
    mode    =>  '0755',
    owner   =>  'specialuser'

I found the following solution worked..我发现以下解决方案有效..

source => 'puppet:///modules/profiles/',来源 => 'puppet:///modules/profiles/',

in your case -在你的情况下 -

source => 'puppet:///modules/profiles/a_subfolder/myfile',来源 => 'puppet:///modules/profiles/a_subfolder/myfile',

Hope this helps希望这可以帮助

I'm new to puppet but as far as I understood you need to set up a puppet file server if you want to use puppet:// URIs.我是 puppet 的新手,但据我所知,如果您想使用puppet:// URI,您需要设置一个 puppet 文件服务器。

https://docs.puppetlabs.com/guides/file_serving.html https://docs.puppetlabs.com/guides/file_serving.html

If you want the file to get from your puppet master, please do the following: 1) create the folder on you puppet master.如果您希望文件从您的木偶大师那里获得,请执行以下操作:1) 在您的木偶大师上创建文件夹。 Let's take it as /opt/puppet_dev 2) edit /etc/puppet/fileserver.conf and add: [puppet_dev] path /opt/puppet_dev allow * 3) In your manifest write: file { '/opt/on_my_node/slave_path': source => "puppet:///puppet_dev/my_folder_I_want_to_move", ensure => present, } 4) restart puppetmaster service ( you change fileserver, I recommend to restart) and run the agent.让我们把它当作 /opt/puppet_dev 2)编辑 /etc/puppet/fileserver.conf 并添加:[puppet_dev] path /opt/puppet_dev allow * 3)在你的清单中写:file {'/opt/on_my_node/slave_path': source => "puppet:///puppet_dev/my_folder_I_want_to_move", ensure => present, } 4) 重启 puppetmaster 服务(你换了文件服务器,我建议重启)并运行代理。

Hopes this is what your were looking for :)希望这是你要找的:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM