using an ENC to inject top level parameters, hiera is not using

asked 2016-07-20 19:53:33 -0500

AlexS gravatar image

Hi

Using an ENC

/usr/local/bin/puppetnodeclassifier abc.abc.com

environment: production parameters: ppybenv: alex ppyblocation: ybo

from hiera.yaml

:hierarchy:

# node specific - "nodes/%{::trusted.certname}"

# Envornment - "ybenv/%{::pp_ybenv}"

# OS specific - "os/%{::osfamily}"

# common to all - common

I create a file /etc/ybenv which records $pp_ybenv and it gets set to alex

but my file

hieradata/ybenv/alex.yaml

doesn't get read ?

I set this in alex.yaml

hrmotdcontent: ">>>>>>> alex environment <<<<<<<<<<"

use it in a class like this

$ppmotdcontentarray =hieraarray( 'hrmotdcontent', [] ) $ppmotdcontent = join( $ppmotdcontent_array, " ")

[...]

class { 'motd' :

content =>

"Server build V1.6 $ppmotdcontent You are logging into ${trusted['certname']} Environment [$pp_ybenv] "

}

if I add the same info to a node specific file or the common.yaml it show up.. for some reason hiera is not looking at pp_ybenv

strangely if I add $pp_ybenv to my manifest/site.pp I get an error saying can't re assign variable ...

I'm lost on why hiera is not using it

edit retag flag offensive close merge delete