On 12/30/2012 6:47 AM, Jason Edgecombe wrote:
I've thought about that. This is a basically a service, but I can have
multiple instances of the process running with different
configurations. As I understand, I would need to create a new service
script for each instance.
Jason
We manage many instances of Redis which is somewhat the same problem. I
found it simpler to template init scripts and config files in order to
use the native types within Puppet. The allows sudo service
redis-server-stage restart work without having to refer to documentation
or read what inputs the script needs. Also services start normally when
the box comes up without having to wait for a Puppet run and makes it
simpler to see what should be running on a box or is running.
Ramin
modules/redis/manifests/server.pp
# We use ${port} for the resource declarations and ${name} for
# path so that it should be impossible to create conflicting
# servers using the same port and/or the same name
define redis::server (
$port,
$master='localhost',
$master_port=$port
) {
include redis::params
File {
owner => root,
group => redis,
mode => '0640',
}
file { "redis_${port}.conf":
ensure => present,
path => "${redis::params::configdir}/redis_multi_${name}.conf",
content => template('redis/redis_multi.conf.erb'),
notify => Service["redis-server-${port}"],
}
file { "redis_slave_${port}.conf":
ensure => present,
path => "${redis::params::configdir}/slave_multi_${name}.conf",
content => template('redis/slave_multi.conf.erb'),
notify => Service["redis-server-${port}"],
}
file { "redis-server-${port}":
ensure => present,
path => "/etc/init.d/redis-server-${name}",
content => template('redis/init_multi.erb'),
notify => Service["redis-server-${port}"],
mode => '0755',
}
service { "redis-server-${port}":
ensure => running,
enable => true,
hasrestart => true,
hasstatus => $redis::params::hasstatus,
name => "redis-server-${name}",
}
nrpe::redis { $name: port => $port, }
Class['redis::service'] -> Redis::Server[$name]
}
--
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+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.