On Monday, March 4, 2013 2:57:23 PM UTC-6, phundisk wrote:
>
> I have been doing something with puppet that is working for me 100% but I 
> am not sure this is the best way to be doing things and wanted to see what 
> the community feels about it and if anyone has any suggestions.  This 
> problems relates to me having a common 'base' class which I put common 
> server configuration in to be distributed to all my servers.  The example I 
> am using is with NTP clients and NTP server.
>
> In my base class I have something like this:
>   "include ntp"
>
> The issue with this is that the NTP clients and servers need to have 
> different ntp.conf files.  For example, I want the NTP clients to be 
> configured to use the local NTP server as their NTP server, and my local 
> NTP server to use CentOS's NTP servers.  I have been using some basic if 
> else logic to deal with this to give it the appropriate server or client 
> file.  Is this the best way to do this?  Are there better ways to do this 
> besides doing an 'include ntp::client' for every node in my nodes.pp.  I 
> like my nodes.pp to be clean and organizes.
>
>
The classical solution to this sort of issue was to use class inheritance 
to override the contents of the ntp.conf files of your ntp servers.  Hiera 
is a better solution in many cases, but the inheritance approach might 
still be useful on occasion.  The needed subclass would look something like 
this:

class ntp::server inherits ntp {
  File['/etc/ntp.conf'] {
    content => template('ntp_conf_server.erb')
  }
}

Your ntp servers would include that class in addition to the common 
baseline class, but other machines would get the intended (client) 
configuration from the baseline class without any specific mention of ntp.


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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to