Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Set File content via Hiera

Hi,

I am looking for the syntax to set the content for a File resource from hiera. Specifically I want to set the template being used:

# Puppet
class test (
  $file_content = undef,
){

  file{'/tmp/testfile':
    ensure  => file,
    content => $file_content,
  }

}

# Hiera
---
test::file_content: template('modules/test/test.erb')

Since Hiera is returning a string, the template function is not being evaluated.

I am pretty sure I saw this being done somewhere, but I cannot figure out the correct syntax anymore.