Created: 2012-03-22 00:16
Updated: 2018-10-19 16:17



A data backend for Hiera that can return the content of whole files.

Travis Test status: Build Status


A sample Hiera config file that activates this backend and stores data in /etc/puppet/data can be seen below:

  - file

  - %{calling_module}
  - common

  :datadir: /etc/puppet/data

Now, consider the following puppet module:

`-- manifests
    `-- init.pp

Suppose that init.pp has the following content:

class mymodule {
  notify { "example": message => hiera('giant_vampire_commandos'); }

For the key "giant_vampire_commandos" as specified specified in the notify resource declared in the mymodule module, Hiera will check the following two locations for data:


If either of those files exists, Hiera will read it and return the unedited contents. A typical use for this might be file resources via the content parameter. e.g.

file { '/tmp/very_important_file':
  ensure  => file,
  owner   => 'root',
  group   => 'root',
  mode    => '0600',
  content => hiera('giant_vampire_commandos'),


Since the file backend is built to deal with arbitrary chunks of data and interpolation might not be meaningful and can break things, it can be disabled. To disable it for the entire file backend, add the following to your hiera.yaml:

# Your normal hiera.yaml
  :interpolate: false # defaults to true


Via Rubygems (preferred)

gem install hiera-file

With Puppet/Pluginsync

Git clone this directory into your modulepath; Puppet will pluginsync lib/ onto all your nodes.


  • Hunter Haugen wrote it up ine 15 minutes and published it as a gist
  • Reid Vandewiele updated it for hiera 0.3.0 wrote the README and gemspec, and fixed the directory extension
  • Igal Koshevoy updated it for hiera 1.0 and added directory traversal prevention
  • Jonathan Kinred made it return the first value first
  • Adrien Thebo dreamed it up, got other people to write it, published it and claimed all the credit, and wrote specs
Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more