On Fri, May 21, 2010 at 4:32 PM, andreash <hilb...@gmail.com> wrote: > hi there, > > i'm not sure as to how to call the subject of this post, as i'm > totally new to puppet -- so please forgive me if this is > misleading ... > > for my servers, i'm planning to do something like this (pseudo-code): > > class (?) base-config: > include ntp::client > include resolver > ... > > all servers should by default include the base-config class. > > however, for the node which has the role "ntpd-server", i don't want > ntp::client to be included, but rather ntp::server. > > how can i do this? >
you can include both a parent and child class in puppet and puppet is smart enough to apply all of the overridden attributes. I use this fact sometimes in combination with an external node classifier (like the dashboard) to override resources from parent groups. I also opened a feature on the Dashboard to better support this kind of behavior. http://projects.puppetlabs.com/issues/3675 > my ntp module looks like this: > > class ntp { > package { 'openntpd': > ensure => latest > } > > service { 'openntpd': > ensure => running, > } > $ntpserverip = '192.168.1.1' # this is somehow to be replaced with > the > # actual ip of the ntpd server > class client { > $role = 'CLIENT' > } > class server { > $role = 'SERVER' > } > file { "/etc/openntpd/ntpd.conf": > template("ntp/ntpd.conf.erb") > } > } > > and the template looks like this: > > <% if role == "SERVER" %> > listen on <%= ntpserverip %> > server ptbtime1.ptb.de > server ptbtime2.ptb.de > server ptbtime3.ptb.de > <% end %> > > <% if role == "CLIENT" %> > server <%= ntpserverip %> > <% end %> > > to summarize: > > question 1: how can i make sure that the server which shall be > openntpd server has $role = 'SERVER' and all others have role = > 'CLIENT' ? > > question 2: how can i include the ip of the ntp server as $ntpserverip > without having to manually set it? > > question 3: what else did i do wrong? > > i just found out about puppet, and am really excited about it. looks > like a great helper even for a rather small (~15 machines (virtual + > physical) in total) environment. > > thanks for your insight! > > 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-us...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@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-us...@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.