Ask Your Question

hiera lookups in hiera

asked 2016-07-22 06:25:27 -0600

gilbo gravatar image

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 :
    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


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-22 08:29:16 -0600

DarylW gravatar image

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.

edit flag offensive delete link more

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: 2016-07-22 06:25:27 -0600

Seen: 109 times

Last updated: Jul 22 '16