Kenneth Holter
2009-Jun-25 06:12 UTC
[Puppet Users] Override configuration defined in inherited node?
Hi all. I''m running puppet 0.24.4, and have the following issue: I have a base node which more or less every linux server inherits. In the base node I''ve defined a default NTP client configuration, but now I''ve come across a couple of nodes that need a different configuration. So what I need to do on these particular nodes are, as far as I know, one of these things: 1) Find a way to override the NTP configuration defined in the base node 2) Make sure they don''t inherit the base node, so that I can define a different NTP configuration here So is there a way to override a configration defined in the base node (i.e. the inherited node)? Regards, Kenneth Holter --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey
2009-Jun-25 12:55 UTC
[Puppet Users] Re: Override configuration defined in inherited node?
On Thu, Jun 25, 2009 at 1:12 AM, Kenneth Holter<kenneho.ndu@gmail.com> wrote:> Hi all. > > > I''m running puppet 0.24.4, and have the following issue: I have a base node > which more or less every linux server inherits. In the base node I''ve > defined a default NTP client configuration, but now I''ve come across a > couple of nodes that need a different configuration. So what I need to do on > these particular nodes are, as far as I know, one of these things: > 1) Find a way to override the NTP configuration defined in the base node > 2) Make sure they don''t inherit the base node, so that I can define a > different NTP configuration here > > So is there a way to override a configration defined in the base node (i.e. > the inherited node)? > >One thing might be to change the inherit to an include on the nodes that need special stuff. That way you can use variables to override default setting in the ntp module. There is an ongoing thread on this right now "Server Hierarchies and other configuration questions" Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Don
2009-Jun-25 13:39 UTC
[Puppet Users] Re: Override configuration defined in inherited node?
> couple of nodes that need a different configuration. So what I need to do on > these particular nodes are, as far as I know, one of these things: > 1) Find a way to override the NTP configuration defined in the base node > 2) Make sure they don''t inherit the base node, so that I can define a > different NTP configuration hereI literally just asked this same question and the solution is less than stellar. Node inheritance is useful for variables and overriding. Classes are useful for specifying system roles. In more concrete terms this is what I do: class roles::general { include ntp include ldap } class roles::ntpserver { include ntp::master } node zone-global { ntp_servers = [''''] } node zone-nyc inherits zone-global { $ntp_servers = [''10..1.1.10''] } node client inherits zone-nyc { include roles::general } node ntpmaster inherits zonenyc { $ntp_servers = [''pool.ntp.org''] include roles::general include roles::ntpmaster } This isn''t nearly as clean as it could be if some of the variable and scoping rules were different, but for now it has sufficed to clean up my puppet config dramatically. -Don --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Don
2009-Jun-25 13:55 UTC
[Puppet Users] Re: Override configuration defined in inherited node?
Sigh- typo''d again. That should have read:> class roles::ntpmaster { > include ntp::master > }-Don --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Evan Hisey
2009-Jun-26 15:58 UTC
[Puppet Users] Re: Override configuration defined in inherited node?
On Thu, Jun 25, 2009 at 8:39 AM, Don<don@blacksun.org> wrote:> >> couple of nodes that need a different configuration. So what I need to do on >> these particular nodes are, as far as I know, one of these things: >> 1) Find a way to override the NTP configuration defined in the base node >> 2) Make sure they don''t inherit the base node, so that I can define a >> different NTP configuration here > I literally just asked this same question and the solution is less > than stellar. > > Node inheritance is useful for variables and overriding. Classes are > useful for specifying system roles. > > In more concrete terms this is what I do: > class roles::general { > include ntp > include ldap > } > > class roles::ntpserver { > include ntp::master > } > > node zone-global { > ntp_servers = [''''] > } > > node zone-nyc inherits zone-global { > $ntp_servers = [''10..1.1.10''] > } > > node client inherits zone-nyc { > include roles::general > } > > node ntpmaster inherits zonenyc { > $ntp_servers = [''pool.ntp.org''] > > include roles::general > include roles::ntpmaster > } > > This isn''t nearly as clean as it could be if some of the variable and > scoping rules were different, but for now it has sufficed to clean up > my puppet config dramatically. >I just found this on the wiki and it may help out in this problem: class base_class { define testvar_file($myvar="bob") { file { $name: content => template("john.erb"), } } testvar_file { "/tmp/testvar": } } class child_class inherits base_class { Base_class::Testvar_file["/tmp/testvar"] { myvar => fred } } it is at http://reductivelabs.com/trac/puppet/wiki/CommonMisconceptions under Class Inheritance and Scope. Evan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---