Bryan Beaudreault
2012-Jan-24 22:50 UTC
[Puppet Users] Multiple Service definitions of the same type
Hello, I am trying to make it so that more than 1 instance of memcached can run on a single service. I have a special init.d script that can handle this, but want to define the service multiple times in a puppet class. Here is the definition I am using: service { "$service_name": name => "memcached", ensure => running, enable => true, start => "$init_script start $service_name", stop => "$init_script stop $service_name", status => "$init_script status $service_name", restart => "$init_script restart $service_name", hasstatus => true, require => [Package[memcached],File["$file_name"]] } I used the $service_name so that the defintion would be unique, but now puppet is throwing this error: Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias Service[11411] to ["memcached"]; resource ["Service", ["memcached"]] already exists at How can I achieve what I am trying to achieve? Any ideas? Thanks, Bryan -- 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
2012-Jan-26 18:32 UTC
[Puppet Users] Re: Multiple Service definitions of the same type
I think if you remove this line, name => "memcached", you should be fine as long as $service_name is unique per instance. Ramin On Jan 24, 2:50 pm, Bryan Beaudreault <bbeaudrea...@hubspot.com> wrote:> Hello, > > I am trying to make it so that more than 1 instance of memcached can > run on a single service. I have a special init.d script that can > handle this, but want to define the service multiple times in a puppet > class. Here is the definition I am using: > > service { "$service_name": > name => "memcached", > ensure => running, > enable => true, > start => "$init_script start $service_name", > stop => "$init_script stop $service_name", > status => "$init_script status $service_name", > restart => "$init_script restart $service_name", > hasstatus => true, > require => [Package[memcached],File["$file_name"]] > } > > I used the $service_name so that the defintion would be unique, but > now puppet is throwing this error: > > Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot > alias Service[11411] to ["memcached"]; resource ["Service", > ["memcached"]] already exists at > > How can I achieve what I am trying to achieve? Any ideas? > > Thanks, > > Bryan-- 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.
Felix Frank
2012-Jan-27 13:24 UTC
Re: [Puppet Users] Multiple Service definitions of the same type
Hi, On 01/24/2012 11:50 PM, Bryan Beaudreault wrote:> I have a special init.d script that can > handle this, but want to define the service multiple times in a puppet > class.I assume your new initscript declares a different Provides: tag than the stock memcached initscript, yes? Whatever this tag is, that''s what your service resource should be named, and (as Ramin pointed out correctly), you should not try and alias this service to "memcached" (even though that''s what you''re ultimately starting). If your new script does indeed provide "memcached" as well, that is a problem in and of itself and needs fixing. HTH, Felix -- 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.