Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sourcing Puppet files from outside of modules

Tags:

vagrant

puppet

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.

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

like image 574
bennylope Avatar asked Mar 01 '12 15:03

bennylope


People also ask

Where are puppet files stored?

The default for the yaml backend with Puppet Enterprise is /etc/puppetlabs/code/environments/%{environment}/hieradata , which should be fine for most use cases.

What is .pp file in puppet?

In Puppet, all the programs which are written using Ruby programming language and saved with an extension of . pp are called manifests. In general terms, all Puppet programs which are built with an intension of creating or managing any target host machine is called a manifest.

Where are Puppet modules?

On Windows: C:/ProgramData/PuppetLabs/code/environments/production/modules;C:/ProgramData/PuppetLabs/code/modules.


1 Answers

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",
    ],
}

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).

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.

like image 56
daks Avatar answered Oct 01 '22 17:10

daks