Hans Schou
2011-Nov-24 10:17 UTC
[Puppet Users] All nodes inherits default except for one module
Hi I have been searching around but must give up on this one. I have bunch of servers which all uses the same modules except for one single module. In the worst case I have n modules and n nodes and each one of them should not include one different module. Example: all need resolv.conf but the nameserver should be a little different. node default { include resolv.conf resolv_conf { $domainname: domainname => $domainname, searchpath => $searchpath, nameservers => $nameservers } ... } node ''nameserver'' inherits default { uninclude resolv.conf ... } Example2: All should do rsyslog, except the syslog-server. What is the best practice for this? best regards Hans Schou -- 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.
Denmat
2011-Nov-24 11:07 UTC
Re: [Puppet Users] All nodes inherits default except for one module
Hi, You might want to try something like: node default { if $hostname != ''nameserver'' { include resolve.conf } if.... else.... elsif.... } See: http://docs.puppetlabs.com/guides/language_guide.html#conditionals Den On 24/11/2011, at 21:17, Hans Schou <hans@moc.net> wrote:> Hi > > I have been searching around but must give up on this one. > > I have bunch of servers which all uses the same modules except for one > single module. In the worst case I have n modules and n nodes and each > one of them should not include one different module. > > Example: all need resolv.conf but the nameserver should be a little > different. > > node default { > include resolv.conf > resolv_conf { $domainname: > domainname => $domainname, > searchpath => $searchpath, > nameservers => $nameservers > } > ... > } > > node ''nameserver'' inherits default { > uninclude resolv.conf > ... > } > > > Example2: All should do rsyslog, except the syslog-server. > > What is the best practice for this? > > best regards > Hans Schou > > -- > 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.
jcbollinger
2011-Nov-28 13:51 UTC
[Puppet Users] Re: All nodes inherits default except for one module
On Nov 24, 5:07 am, Denmat <tu2bg...@gmail.com> wrote:> Hi, > > You might want to try something like: > > node default { > if $hostname != ''nameserver'' { > include resolve.conf > } > if.... > else.... > elsif.... > > } > > See:http://docs.puppetlabs.com/guides/language_guide.html#conditionals > > DenOr make your classes smarter, either by 1) putting the needed conditional logic there, or 2) having them use external data via extlookup() or hiera. Or use class inheritance to create a class that overrides the needed properties. Such a class can be included on the node(s) that needs to be different, regardless of whether its parent class is also included (not compatible with parameterized parent classes). John -- 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.
Hans Schou
2011-Nov-29 09:35 UTC
Re: [Puppet Users] All nodes inherits default except for one module
Den 2011-11-24 12:07, Denmat skrev:> Hi, > > You might want to try something like: > > node default { > if $hostname != ''nameserver'' { > include resolve.conf > }Thanks. It is also quite easy to get an overview of which modules one server gets 1. Look at the particular node 2. Look at the default node -- Venlig hilsen Hans Schou tel:46923438 -- 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.