- Overview
 - Module Description - What the module does and why it is useful
 - Setup - What you need to do before using this module
 - Hiera Variables - What you need to configure in hiera
 - Usage - Configuration options and additional functionality
 
Manage Puppet file-resources in hiera.
This is a wrapper module to manage puppet file-resources in hiera.
This module also abstracts templates and static files features. In order to use this you need to symlink files and templates in the module directory to a path or repository containing your files and templates.
cd /etc/puppet/modules/files
ln -s /path/to/yourdata/files
ln -s /path/to/yourdata/templates
files Hash of file resources, see Puppet File Reference for documentation of params.
files::templates Configure which template should be used for a file, see Usage for examples.
files::template_vars You can use these variables in your templates like <%= @template_vars['my_var'] %>. These variables are global for all templates, you might want to prefix their names somehow.
Write a simple file:
files:
  /tmp/test.txt:
    content: foo
Multiline example:
files:
  /tmp/multi.txt:
    content: |+
             This is a
             file with a
             lot of lines.
Hiera variables in content, see documentation for hiera lookup functions:
host_ip: 192.168.1.1
files:
  /tmp/test.txt:
    content: My ip is %{hiera('host_ip')}
Create a recursive directory structure:
files:
  ['/tmp/test/', '/tmp/test/sub/', '/tmp/test/sub/bar/']:
    ensure: directory
Copy a file from this or any other module's file path:
files:
  /tmp/foo.bar:
    source: puppet:///modules/files/foo.bar
  /tmp/my.file
    source: puppet:///modules/<other module name>/my.file
  /tmp/local.txt
    source: /my/path/local.txt
To create a file from this or any other module's template path, you need to declare at least an empty file resource and then assign a template to the title of the file resource. Optionally use template variables:
files:
  /tmp/moo.bar:
    owner: www-data
  /tmp/vhost.conf: {}
files::templates:
  /tmp/moo.bar: files/moo.bar.erb
  /tmp/vhost.conf: <other module name>/vhost.erb
files::template_vars:
  my_var: Hello World.