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 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/e5mpgJLhaHIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Sep 24, 2012 at 2:39 AM, Josh <josh@chickenmonkey.co.uk> wrote:> 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?In heira variable lookup is %{varname}, so in this case %{hostname}. HTH, Nan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
So obvious now that I think about it! *slaps head* Cheers Josh On Tuesday, September 25, 2012 3:11:32 AM UTC+1, Nan Liu wrote:> > On Mon, Sep 24, 2012 at 2:39 AM, Josh <jo...@chickenmonkey.co.uk<javascript:>> > wrote: > > 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? > > In heira variable lookup is %{varname}, so in this case %{hostname}. > > HTH, > > Nan >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/YCtTucAZybUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.