3

When referring to a file resource on the puppet master, does it have to reside under the modulepath? The docs here seem to indicate it.

The file I'm using was put under the profiles folder instead. 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)

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.

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? Here's what I have now:

    ensure  =>  'present',
    source  =>  'puppet:///profiles/a_subfolder/myfile',
    mode    =>  '0755',
    owner   =>  'specialuser'
jkj2000
  • 1,563
  • 4
  • 19
  • 26
  • Does this answer your question? [Sourcing Puppet files from outside of modules](https://stackoverflow.com/questions/9518905/sourcing-puppet-files-from-outside-of-modules) – John Bollinger Mar 02 '20 at 14:11

3 Answers3

2

I found the following solution worked..

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

in your case -

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

Hope this helps

0

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.

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

mara
  • 234
  • 1
  • 9
0

If you want the file to get from your puppet master, please do the following: 1) create the folder on you puppet master. 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.

Hopes this is what your were looking for :)

ask_help
  • 116
  • 7