Hi,
the issue is related to how scoping works for nodes in Puppet.
The variable defined in your child nodes is not accessible from within the
basenode node and is thus not available in its included classes.
In order for the variable to be availble to the template, you would have to
move the include ntp call to the child classes.
This is one of the main reasons that people wind up using either an external
node classifier or extlookup for modeling data.
regards,
Dan
On Thu, May 12, 2011 at 7:43 AM, andreash <hilboll@gmail.com> wrote:
> I have the following nodes definitions:
>
> node basenode {
> include hosts
> include ntp
> include resolvconf
> }
>
> node ''dom1.mydomain.com'' inherits basenode {
> $ntp_role = "SERVER"
> }
>
> node ''stove1.mydomain.com'' inherits basenode {
> $ntp_role = "CLIENT"
> }
>
> in the ntp class, the ntpd.conf file template looks like this:
>
> <% if ntp_role == "SERVER" %>
> listen on <%= ntp_server %>
> server ptbtime1.ptb.de
> server ptbtime2.ptb.de
> server ptbtime3.ptb.de
> <% elsif ntp_role == "CLIENT" %>
> <% ntp_servers.each do |ntp_server| -%>
> server <%= ntp_server %>
> <% end %>
> <% end %>
>
> However, on both clients, I get the error "Failed to parse template
> ntp/ntpd.conf.erb: Could not find value for ''ntp_role'' at
/etc/puppet/
> modules/ntp/manifests/init.pp:17 on node stove1.mydomain.com". What am
> I doing wrong here?
>
> Cheers,
> Andreas
>
> --
> 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.
>
>
--
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.