FAQ
I've done the following, it ended up being a bit simpler for me when I'm
not sure what random services a new CentOS install has installed and/or
enabled...

   define no_service ( ) {
     service { "${name}" :
       ensure => stopped ,
       enable => false ,
       status => "stat -t /etc/rc?.d/S??${name} > /dev/null 2>&1" ,
     }
   }

You can then declare individual service names, or lists of service names,
each of which will be disabled and shut down if the service is enabled. If
a particular service doesn't exist, the puppet agent does nothing.

   no_service { 'ip6tables' : }
   no_service { [ 'nfslock' , 'portmap' , 'xyzzy' ] : }

The only caveat is, if a service is disabled (i.e. "chkconfig service off")
but the service is still running, the puppet agent won't stop it. Of
course, if you have a service which is normally off and you've only enabled
it to test something, this could be a good thing...

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

Search Discussions

  • Stefan Schulte at May 9, 2013 at 9:50 pm

    On Thu, 9 May 2013 13:58:45 -0700 (PDT) John Simpson wrote:

    I've done the following, it ended up being a bit simpler for me when
    I'm not sure what random services a new CentOS install has installed
    and/or enabled...

    define no_service ( ) {
    service { "${name}" :
    ensure => stopped ,
    enable => false ,
    status => "stat -t /etc/rc?.d/S??${name} > /dev/null 2>&1" ,
    }
    }

    You can then declare individual service names, or lists of service
    names, each of which will be disabled and shut down if the service is
    enabled. If a particular service doesn't exist, the puppet agent does
    nothing.

    no_service { 'ip6tables' : }
    no_service { [ 'nfslock' , 'portmap' , 'xyzzy' ] : }

    The only caveat is, if a service is disabled (i.e. "chkconfig service
    off") but the service is still running, the puppet agent won't stop
    it. Of course, if you have a service which is normally off and you've
    only enabled it to test something, this could be a good thing...
    you should be able to just specify `hasstatus => false`. This way
    puppet will check the process list in order to get the current status
    and will not run the (absent) initscript to get the status.

    -Stefan

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 9, '13 at 9:28p
activeMay 9, '13 at 9:50p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Stefan Schulte: 1 post John Simpson: 1 post

People

Translate

site design / logo © 2022 Grokbase