Ask Your Question

Hiera how to retrieve values

asked 2014-12-09 02:53:45 -0600

I have a hiera datafile which looks like this:

        host: localhost
        password: password
        password: password

Using hiera I can get the environments

hiera enviroments
{"development"=>{"host"=>"localhost", "password"=>"password"},
 "production"=>{"host"=>"", "password"=>"password"}}

Say, if would like to retrieve the production password directly with hiera, how could I do that? This command does not return anything.....

hiera environments:production:password
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-09 08:44:17 -0600

anthonyclark gravatar image

I think you're looking to use the following syntax:

$database_properties = hiera_hash('example::software::database')

Take a look here:

And make sure you're using the correct double-colon syntax.

edit flag offensive delete link more


I think hiera can only retrieve top level keys. See this link: This is what I ended up doing: $env = hiera('environments') $password = $env[development][password] Thanks for the input

Gobin Sougrakpam gravatar imageGobin Sougrakpam ( 2014-12-10 03:09:36 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-12-09 02:53:45 -0600

Seen: 60 times

Last updated: Dec 09 '14