Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How can I ensure that a service is started/stopped based on if it is needed or not ?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sébastien Lavoie  
View profile  
 More options Sep 7 2012, 6:32 pm
From: Sébastien Lavoie <sebast...@lavoie.sl>
Date: Fri, 7 Sep 2012 15:32:55 -0700 (PDT)
Local: Fri, Sep 7 2012 6:32 pm
Subject: How can I ensure that a service is started/stopped based on if it is needed or not ?

I have a several services that I use only for some sites and I would like
to make sure it is started when a site that uses is activated and stopped
when it is not needed anymore.

Examples: memcache, elasticsearch, rabbitmq, etc.

I can easily make a service virtual and realize it before making a
reference to it like this:

class webserver {
  @service {"memcache":
    ensure => running,
  }

}

class sites {
  Realize['memcache']
  site {"example.com":
    require => Service['memcache']
  }

}

But this will not stop the service if it is never realized.

Any ideas ?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Glenn Poston  
View profile  
 More options Sep 8 2012, 11:57 pm
From: Glenn Poston <gposton1...@gmail.com>
Date: Sat, 8 Sep 2012 20:57:50 -0700 (PDT)
Local: Sat, Sep 8 2012 11:57 pm
Subject: How can I ensure that a service is started/stopped based on if it is needed or not ?

You could create a fact that returns true or false, then use that fact in your puppet code to determine whether to start the service.  I'd need more details to really say that's the best solution though.  Other options would be to use heira or to use a parameterized class and set those parameters in your ENC/mode definition.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sébastien Lavoie  
View profile  
 More options Sep 9 2012, 12:38 am
From: Sébastien Lavoie <sebast...@lavoie.sl>
Date: Sat, 8 Sep 2012 21:38:44 -0700 (PDT)
Local: Sun, Sep 9 2012 12:38 am
Subject: Re: How can I ensure that a service is started/stopped based on if it is needed or not ?

I am not experienced in creating facts, could you give me a better idea ? I
fail to see how a fact could detect if a service is required.
Thanks


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jakov Sosic  
View profile  
 More options Sep 9 2012, 7:02 am
From: Jakov Sosic <jso...@srce.hr>
Date: Sun, 09 Sep 2012 13:02:48 +0200
Local: Sun, Sep 9 2012 7:02 am
Subject: Re: [Puppet Users] Re: How can I ensure that a service is started/stopped based on if it is needed or not ?
On 09/09/2012 06:38 AM, S bastien Lavoie wrote:

> I am not experienced in creating facts, could you give me a better idea
> ? I fail to see how a fact could detect if a service is required.

And how do you determine if it's required? By hostname, or?

--
Jakov Sosic
www.srce.unizg.hr


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
R.I.Pienaar  
View profile  
 More options Sep 9 2012, 7:34 am
From: "R.I.Pienaar" <r...@devco.net>
Date: Sun, 9 Sep 2012 12:34:03 +0100 (BST)
Local: Sun, Sep 9 2012 7:34 am
Subject: Re: [Puppet Users] How can I ensure that a service is started/stopped based on if it is needed or not ?

dont know if this helps but lets say you have a common class
you install on all nodes:

class common {
   include memcache

}

class memcache {
   service{"memcache": ensure => stopped, enable => false}

}

at this point if you include common on all machines memcache will
be stopped and disabled everywhere

now you make a class specifically to include on nodes that needs
it running.

class memcache::enable inherits memcache {
   Service["memcache"] { ensure => running, enable => true }

}

if you include this class on a node it will be enabled, soon
as you remove the class it will be disabled again

Generally though this is a bad idea because you also have to
consider configs, packages and all this stuff it might make
sense in your case but I think the correct thing to do is just
not to install stuff on machines that you dont need.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sébastien Lavoie  
View profile  
 More options Sep 9 2012, 10:38 am
From: Sébastien Lavoie <sebast...@lavoie.sl>
Date: Sun, 9 Sep 2012 07:38:53 -0700 (PDT)
Local: Sun, Sep 9 2012 10:38 am
Subject: Re: [Puppet Users] How can I ensure that a service is started/stopped based on if it is needed or not ?

@Jakov I am currently running Puppet on a single host, it is only to manage
site configurations, so this is not a problem
@R.I. Thanks, worked like a charm. Bonus points for very simple solution.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »