On Friday, August 23, 2013 11:33:14 AM UTC-5, JeremyCampbell wrote: > > Eric, thanks. I've spent most of today trying to get this to work but I > have to submit again. I've read the linked docs on variables multiple > times. As I understand it, with Puppet you cannot assign top-level > variables i.e. starting with $::, these are reserved for facts and other > built in Puppet values. >
It is correct that facts and certain Puppet-based data are available to to the catalog compiler top-scope variables. It is incorrect that these are the only sources of such variables. An ENC may set top-scope variables, or you can set them in site.pp, outside any node, class, or definition body. Also, you can set variables inside a node block. I think these are still visible elsewhere as unqualified variables (e.g. ${role}, not ${::role}), but at one point there was a plan to basically make them inaccessible outside the block in which they were declared. > So I assign $role = "nameserver" in the role::nameserver class - this > works and I get no errors. However no matter what I do hiera doesn't > recognise the variable as shown below. > > - "%{::environment}/%{::clientcert}" > - "%{::clientcert}" > - "%{::environment} > - "%{role}" > - common > > Any ideas what could be causing this? > You are setting ${role::nameserver::role}. Hiera is performing its lookup in a different context and therefore not resolving the unqualifed 'role' to the same thing. How best to proceed depends on several things, among them how big your role-specific data are, and how they fit into the overall picture of your data hierarchy. John -- 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.