Variable interpolation inside hiera data

716 views
Skip to first unread message

Josh

unread,
Sep 24, 2012, 5:39:33 AM9/24/12
to puppet...@googlegroups.com
Hi,

I am using the latest version of hiera and puppet and wondering if there is any way to make variables in hiera interpolate when they are called, for example:

---
foo:
  bar: $::hostname
  baz: $some_variable

When I try to access this in puppet it invariably comes back with '$hostname' instead of the variable, as if it has been single quoted by default. The same applies if I set a variable in the module as in the second example. I tried double quoting the value to no effect.

I know I can fix this by looking at each variable and processing it but this seems clunky and becomes especially annoying when arrays are involved.

Any way to get puppet to take notice of the $ and look the actual value up?

Thanks
Josh



















Nan Liu

unread,
Sep 24, 2012, 10:11:06 PM9/24/12
to puppet...@googlegroups.com
In heira variable lookup is %{varname}, so in this case %{hostname}.

HTH,

Nan

Josh

unread,
Sep 25, 2012, 5:34:44 AM9/25/12
to puppet...@googlegroups.com
So obvious now that I think about it! *slaps head*

Cheers
Josh
Reply all
Reply to author
Forward
0 new messages