FAQ
Hello,

I am new to puppet programming. I have encountered a problem where the a
global setting, application to all servers, nodes across the board to
enable a particular service such as rsyslog. And I want to have a server
that should not run rsyslog rather it should run syslog-ng.

So basically I am having two classes in the same node, one is saying start
rsyslog and another (my class) is saying to stop rsyslog and start
syslog-ng. Whenever I run this it shows duplication definition error.

So one class is doing

service {'rsyslog': enable => true}

another class

service {'rsyslog': ensure => stopped}

err: Could not retrieve catalog from remote server: Error 400 on SERVER:
Duplicate definition: Service[rsyslog] is already defined in file
/etc/puppet/environments/syslog/manifests/classes/enabled-c6.pp at line 8;
cannot redefine at
/etc/puppet/environments/syslog/modules/syslog_ng/manifests/service.pp:5 on
node test-logserver

Thanks

Chandan




--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ZSoJuyKXAkUJ.
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.

Search Discussions

  • Aaron Stone at Oct 27, 2012 at 7:04 pm
    Rules are not run in order, so there's nothing to indicate to Puppet
    which of those contradictory rules should win. Puppet also enforces a
    uniqueness on the pair (type, name) -- ('service', 'rsyslog') is
    unique and you cannot have another one.

    What you'll need to do is make sure that only one of those rules
    applies to any one host.

    Good luck!
    Aaron

    On Fri, Oct 26, 2012 at 7:21 PM, chandan kumar wrote:
    Hello,

    I am new to puppet programming. I have encountered a problem where the a
    global setting, application to all servers, nodes across the board to enable
    a particular service such as rsyslog. And I want to have a server that
    should not run rsyslog rather it should run syslog-ng.

    So basically I am having two classes in the same node, one is saying start
    rsyslog and another (my class) is saying to stop rsyslog and start
    syslog-ng. Whenever I run this it shows duplication definition error.

    So one class is doing

    service {'rsyslog': enable => true}

    another class

    service {'rsyslog': ensure => stopped}

    err: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Duplicate definition: Service[rsyslog] is already defined in file
    /etc/puppet/environments/syslog/manifests/classes/enabled-c6.pp at line 8;
    cannot redefine at
    /etc/puppet/environments/syslog/modules/syslog_ng/manifests/service.pp:5 on
    node test-logserver

    Thanks

    Chandan




    --
    You received this message because you are subscribed to the Google Groups
    "Puppet Users" group.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/puppet-users/-/ZSoJuyKXAkUJ.
    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.
  • Ramin K at Oct 27, 2012 at 7:33 pm

    On 10/26/2012 7:21 PM, chandan kumar wrote:
    Hello,

    I am new to puppet programming. I have encountered a problem where the a
    global setting, application to all servers, nodes across the board to
    enable a particular service such as rsyslog. And I want to have a server
    that should not run rsyslog rather it should run syslog-ng.

    So basically I am having two classes in the same node, one is saying
    start rsyslog and another (my class) is saying to stop rsyslog and start
    syslog-ng. Whenever I run this it shows duplication definition error.

    So one class is doing

    service {'rsyslog': enable => true}

    another class

    service {'rsyslog': ensure => stopped}

    err: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Duplicate definition: Service[rsyslog] is already defined in file
    /etc/puppet/environments/syslog/manifests/classes/enabled-c6.pp at line
    8; cannot redefine at
    /etc/puppet/environments/syslog/modules/syslog_ng/manifests/service.pp:5
    on node test-logserver
    One solution is to create the following class.

    modules/rsyslog/manifests/service/disable.pp
    class rsyslog::service::disable inherits rsyslog::service {
    Service['rsyslog'] { ensure => stopped, enable => false, }
    }

    assuming you have something like this
    node basenode {
    include rsyslog
    }

    Then you'd add the addition class to override the original functionality.
    node 'someserver' inherits basenode {
    include syslog_ng
    include rsyslog::service::disable
    }

    Or if syslog_ng and rsyslog can never coexist, I'd include the disable
    class directly in the init.pp of your syslog_ng class.

    Ramin

    --
    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.
  • Chandan kumar at Oct 30, 2012 at 5:20 pm
    Thanks for the response. I am able to fix the problem

    class syslog_ng::service inherits standard-services {

    Service['rsyslog'] {
    enable => false,
    ensure => stopped,
    }

    service { 'syslog-ng':
    ensure => running,
    enable => true,
    require => Class['syslog_ng::install']
    }

    }
    On Saturday, 27 October 2012 12:33:14 UTC-7, Ramin K wrote:
    On 10/26/2012 7:21 PM, chandan kumar wrote:
    Hello,

    I am new to puppet programming. I have encountered a problem where the a
    global setting, application to all servers, nodes across the board to
    enable a particular service such as rsyslog. And I want to have a server
    that should not run rsyslog rather it should run syslog-ng.

    So basically I am having two classes in the same node, one is saying
    start rsyslog and another (my class) is saying to stop rsyslog and start
    syslog-ng. Whenever I run this it shows duplication definition error.

    So one class is doing

    service {'rsyslog': enable => true}

    another class

    service {'rsyslog': ensure => stopped}

    err: Could not retrieve catalog from remote server: Error 400 on SERVER:
    Duplicate definition: Service[rsyslog] is already defined in file
    /etc/puppet/environments/syslog/manifests/classes/enabled-c6.pp at line
    8; cannot redefine at
    /etc/puppet/environments/syslog/modules/syslog_ng/manifests/service.pp:5
    on node test-logserver
    One solution is to create the following class.

    modules/rsyslog/manifests/service/disable.pp
    class rsyslog::service::disable inherits rsyslog::service {
    Service['rsyslog'] { ensure => stopped, enable => false, }
    }

    assuming you have something like this
    node basenode {
    include rsyslog
    }

    Then you'd add the addition class to override the original functionality.
    node 'someserver' inherits basenode {
    include syslog_ng
    include rsyslog::service::disable
    }

    Or if syslog_ng and rsyslog can never coexist, I'd include the disable
    class directly in the init.pp of your syslog_ng class.

    Ramin
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/lenskww7jWYJ.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedOct 27, '12 at 3:22p
activeOct 30, '12 at 5:20p
posts4
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase