Ask Your Question

# hiera lookups in hiera

Hello all.

I have this defined in one hiera file:

application::user: someusername: uid: 3428 managehome: true comment: Application User shell: /bin/bash gid: 1203

and in another hiera file i have this:

apache::vhosts :
user-vhost:
docroot: <adocroot>
docroot_owner: <someusername>
log_level: debug
ip_based: true


The question is (and i don't know whether it's possible) can i get the "someusername" value and use it in the docroot_owner bit? i've tried:

docroot_owner: "%{hiera('application::user[$title]')}"  but that doesn't work. any other ideas? is this even possible? I'm on 2016.1 Thanks! edit retag close merge delete ## 1 Answer Sort by » oldest newest most voted In hiera lookups, I don't think you quote the parameter you pass in. I can't try it right now, but I believe it would be like docroot_owner: "%{hiera(application::user[$title])}"


One other thing, where are your getting \$title ? Is that supposed to be the title of your resource? I haven't tried using a local scope variable for hiera lookups like that before, let me know if it works. I have always only used hiera or topscope variables.

more

## Your Answer

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

Add Answer

## Stats

Asked: 2016-07-22 06:25:27 -0500

Seen: 101 times

Last updated: Jul 22 '16