File { ensure => directory, mode => "0750", } file { '/etc/puppetlabs/code':; '/etc/puppetlabs/code/hieradata':; '/etc/puppetlabs/code/environments':; '/etc/puppetlabs/code/environments/production':; '/etc/puppetlabs/code/environments/production/manifests':; '/etc/puppetlabs/code/environments/production/modules':; '/etc/puppetlabs/code/environments/production/modules/hieratest':; '/etc/puppetlabs/code/environments/production/modules/hieratest/manifests':; } file { '/etc/puppetlabs/code/hiera.yaml': ensure => file, mode => "0640", content => ' --- :backends: - "yaml" :logger: "console" :hierarchy: - "roles/%{hiera(\'role\')}" - "global" :yaml: :datadir: "/etc/puppetlabs/code/hieradata" ', } file { '/etc/puppetlabs/code/hieradata/global.yaml': ensure => file, mode => "0640", content => '--- hello: "world" authenticated: "%{trusted.authenticated}" certname: "%{trusted.certname}" domain: "%{trusted.domain}" hostname: "%{trusted.hostname}" extensions: "%{trusted.extensions}" trusted: "%{trusted}" ', } file { '/etc/puppetlabs/code/environments/production/manifests/site.pp': ensure => file, mode => "0640", content => " node default { include hieratest } ", } file { '/etc/puppetlabs/code/environments/production/modules/hieratest/manifests/init.pp': ensure => file, mode => "0640", content => ' class hieratest { notice("entering class hieratest {") file { "/tmp/results" : ensure => directory, recurse => true, purge => true, } $key = "somename" $val = hiera($key) file { "/tmp/results/${var}" : ensure => file, mode => "0644", content => "hello from hieratest. ${var} = ${val} ", } notice("} leaving class hieratest") } ', }