On Friday, February 21, 2014 12:05:46 PM UTC-6, Guy Knights wrote:
>
> I'd like to use the same init script (via upstart) for multiple service 
> definitions, and I thought that if I gave them different titles but the 
> same name paramter (eg. script name) it should allow that. However, I get a 
> duplicated definition error.
>
> eg.
>
>  * service { "gamedeploy-backend":*
> *    name       => 'gamedeploy',*
> *    ensure     => running,*
> *    provider   => upstart,*
> *    start      => "/sbin/initctl start gamedeploy 
> GAME=${game_deploy['title']} COMPONENT=backend ENVIRONMENT=${::environment} 
> DELAY=${game_deploy['delay']}",*
> *    stop       => '/sbin/initctl stop gamedeploy COMPONENT=backend',*
> *    status     => '/sbin/initctl status gamedeploy COMPONENT=backend',*
> *    hasrestart => false,*
> *    subscribe  => 
> [File['gamedeploy_init_script'],File['gamedeploy_script']],*
> *    require    => [File['/var/log/deploy'],Account['deployment']],*
> *  }*
>
> *  service { "gamedeploy-frontend":*
> *    name       => 'gamedeploy',*
> *    ensure     => running,*
> *    provider   => upstart,*
> *    start      => "/sbin/initctl start gamedeploy 
> GAME=${game_deploy['title']} COMPONENT=frontend 
> ENVIRONMENT=${::environment} DELAY=${game_deploy['delay']}",*
> *    stop       => '/sbin/initctl stop gamedeploy COMPONENT=frontend',*
> *    status     => '/sbin/initctl status gamedeploy COMPONENT=frontend',*
> *    hasrestart => false,*
> *    subscribe  => 
> [File['gamedeploy_init_script'],File['gamedeploy_script']],*
> *    require    => [File['/var/log/deploy'],Account['deployment']],*
> *  }*
>
> Is there any way I can get this to work in Puppet, or will I have to 
> create multiple copies of the same script with different filenames?
>
>

No two resources of the same type can have the same title or name.  You 
have a several options, among them:

   1. Duplicate the initscript
   2. Create symlink to the initscript to use as an alias
   3. Create separate initscripts as wrappers for the one you are using 
   now; this could allow you to avoid passing a bunch of parameters to each 
   initscript action (they being handled instead by the wrappers), which would 
   have the side effects of making these services easier to manage manually 
   from the command line, and of not requiring you to express explicit start, 
   stop, and status commands in your manifest.
   4. Just allow the services to have different names.  Since you are 
   specifying explicit start, stop, and status commands and denying the 
   existence of a restart command, I don't think there's anything left that 
   Puppet would do with the resource name, other than emit it to the log.

Of those, I like (3) the best, followed by (4).


John

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6ac2cfa5-2e9d-43bf-8fff-307d99bdc8f5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to