http://soimasysadmin.com/2012/02/29/puppet-inheritance-revisited/ is one
I've got bookmarked...

HTH

Gav


On 9 April 2013 10:54, ForumUser <[email protected]> wrote:

> Hi Gavin,
>
> Can you suggest any URL where I could read about ::params classes (and
> examples of course ;-) ) ?
>
> On Tuesday, 9 April 2013 10:47:40 UTC+1, Gavin Williams wrote:
>>
>> Hi there,
>>
>> I think you're quickest win for making the code cleaner and easier would
>> be to create a ::params class, which sets the correct values for package,
>> file and service based on your distro.
>>
>> Can then inherit this class on your ::install, ::config and ::service
>> classes.
>>
>> I'm sure other people will chime in with some other ideas aswell :)
>>
>> HTH
>>
>> Gav
>>
>> On Tuesday, 9 April 2013 10:36:51 UTC+1, ForumUser wrote:
>>>
>>> Hello all,
>>>
>>> I am trying to write a syslog module for our small puppet installation.
>>> Since I'd like to learn how to write puppet classes/modules I would avoid
>>> modules from puppet labs forge (at least for now).
>>>
>>> This module is going to be deployed on RH 5 _and_ 6.
>>> In our infrastructure each RH line (5 or 6) is configured differently:
>>> RH 5 uses sysklogd, RH 6 uses rsyslog.
>>>
>>> I have written a class but as you can see it has a lot of redundant code.
>>> Can I use any puppet syntax to make it more elegant (and easier to
>>> maintain :-) ) ?
>>> Can you suggest anything ?
>>>
>>> class syslog::install {
>>>         case $lsbmajdistrelease {
>>>                 '5':    {
>>>                               **  package { "sysklogd":
>>>                               **          ensure => present,
>>>                               **  }
>>>                         }
>>>
>>>                 '6':    {
>>>                               **  package { "rsyslog":
>>>                               **          ensure => present,
>>>                               **  }
>>>                         }
>>>         }
>>> }
>>>
>>> class syslog::config {
>>>         case $lsbmajdistrelease {
>>>                 '5':    {
>>>                               **  file    { "/etc/syslog.conf":
>>>                               **          ensure => present,
>>>                               **          owner => 'root',
>>>                               **          group => 'root',
>>>                               **          mode => 0644,
>>>                               **          source =>
>>> "puppet:///modules/syslog/**syslog.conf",
>>>                               **          require =>
>>> Class["syslog::install"],
>>>                               **          notify =>
>>> Class["syslog::service"],
>>>                               **  }
>>>                         }
>>>
>>>                 '6':    {
>>>                               **  file    { "/etc/rsyslog.conf":
>>>                               **          ensure => present,
>>>                               **          owner => 'root',
>>>                               **          group => 'root',
>>>                               **          mode => 0644,
>>>                               **          source =>
>>> "puppet:///modules/syslog/**rsyslog.conf",
>>>                               **          require =>
>>> Class["syslog::install"],
>>>                               **          notify =>
>>> Class["syslog::service"],
>>>                               **  }
>>>                         }
>>>         }
>>> }
>>>
>>> class syslog::service {
>>>         case $lsbmajdistrelease {
>>>                 '5':    {
>>>                               **  service { "syslog":
>>>                               **          ensure => runing,
>>>                               **          enable => true,
>>>                               **          require =>
>>> Class["syslog::config"],
>>>                               **  }
>>>                         }
>>>
>>>                 '6':    {
>>>                               **  service { "rsyslog":
>>>                               **          ensure => runing,
>>>                               **          enable => true,
>>>                               **          require =>
>>> Class["syslog::config"],
>>>                               **  }
>>>                         }
>>>         }
>>> }
>>>
>>>
>>> class syslog {
>>>         include syslog::install, syslog::config, syslog::service
>>> }
>>>
>>>
>>> Thanks in advance :-)
>>> Przemek
>>>
>>>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "Puppet Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-users/vJeR5M2-TS0/unsubscribe?hl=en
> .
> To unsubscribe from this group and all its topics, 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.
>
>
>

-- 
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