I'm in the process of rolling out a new homegrown ENC (we've decided on
using an ENC over hiera; I know it's not the way a lot of you are going,
but it's right for us) and am running into some issues with variable
interpolation in ENC data.

To give a concrete example, I'm using modules to configure puppetdb,
puppet master, and puppet clients. So, there's a bunch of shared data
within an environment (like the server name, port, etc.). What I'd like
to do is have my ENC set a top-level param hash like:
puppet_config:
    server: puppet.example.com
    port: 8140
    puppetdb_host: puppetdb.example.com

and then interpolate that into my ENC-specified classes like:
classes:
    puppet::client:
        server: "${puppet_config[server]}"

So as far as I can tell, I'm running into two isses:
1) There's no real hash interpolation, only inline templates. And I
assume that I can't put an inline template as the value of a class
param. So it looks like that's not going to be solved any time soon.
2) Even if I ditch the hash and just use straight params, i.e.

classes:
    interpolate_test:
        ival: "${::my_ival}"
parameters:
    my_ival: param_ival_value

and then in interpolate_test:
class interpolate_test($ival) {

  notice("interpolate_test - value of ival is ${ival}")
  notice("interpolate_test - value of ::my_ival is ${::my_ival}")
}

I end up seeing:

Notice: Scope(Class[Interpolate_test]): interpolate_test - value of ival
is ${::my_ival}
Notice: Scope(Class[Interpolate_test]): interpolate_test - value of
::my_ival is param_ival_value

Any ideas on how to get this to work? Is it even possible? Or do I just
need to throw up my hands, and decide that either:
a) I can't use ENC params that way, so I'm just going to have to define
these params over and over again and try to keep the same values in
every place,
or,
b) I need to (yuck) build pre-YAML-serialization variable interpolation
*into my ENC*...

Thanks for any advice,
Jason Antman

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to