Sourcing Puppet files from outside the modules

I am installing a package from a module ( Nginx in this particular case) and would like to include a configuration file from outside the module, that is, from the top-level directory files , parallel to the top level manifests . I do not see the possibility of exporting the file without including it in the module or in the current Vagrant environment, referencing the absolute local path.

Does Puppet provide the ability to search for files from outside the modules, as described in the documentation?

+7
source share
3 answers

If I understand your question correctly, you can. Your module has such simple code

 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. / path / to / file will be used with the file located in the "Files" section of the doll. (in the above example, it searches in 4 different places).

update Perhaps you are talking about a directory for storing files that are not used by the Puppet file server (see http://docs.puppetlabs.com/guides/file_serving.html ), in which case you cannot think of a tramp or not, but You can add it to your Puppet file server to do this. I think this is the best (and possibly the only) way to do this.

+3
source

If you have several Vagrant VMs, you can just store the files in your Vagrant project project (containing your VagrantFile). This directory is usually accessible to all virtual machines as / vagrant inside the virtual machine at creation.

If you want other directories on your computer to be accessible by your virtual machines, simply add the following to your VagrantFile

 # see http://docs.vagrantup.com/v1/docs/config/vm/share_folder.html config.vm.share_folder "v-packages", "/vagrant_packages", "../../dpkg" 

Then, to use the files inside the doll, you can simply consider them as local files for the VM

 # bad example, bub basically use 'source => 'file:///vagrant/foo/bar' file { '/opt/cassandra': ensure => directory, replace => true, purge => true, recurse => true, source => 'file:///vagrant/conf/dist/apache-cassandra-1.2.0', } 

This is probably advisable if you only use local puppet manifests / modules.

+1
source

It may be too late to help bennylope , but for others who happen on this matter, as I did before figuring it out for myself ...

Include such things in your Vagrantfile ...

 GUEST_PROVISIONER_CONFDIR = "/example/destination/path" HOST_PROVISIONER_CONFDIR = "/example/source/path" config.vm.synced_folder HOST_PROVISIONER_CONFIDIR, GUEST_PROVISIONER_CONFDIR puppet.options = "--fileserverconfig='#{GUEST_PROVISIONER_CONFDIR}/fileserver.conf'" 

Then make sure that / example / source / path contains the specified fileserver.conf file. It should look something like this ...

 [foo] path /example/destination/path allow * 

Now, assuming example-file.txt exists in / example / source / path, the following will work in your manifests:

 source => "puppet:///foo/example-file.txt", 

Cm:

0
source

All Articles