Wrap text
Report abuse
# modules/mongrel_runit/init.pp
class mongrel-runit {
include runit
gem_package { "mongrel_runit":
version => "0.1.0"
}
gem_package { "mongrel":
version => "1.1.3"
}
file { "mongrel_runit_dir":
path => "/etc/mongrel_runit",
ensure => directory,
owner => root,
group => root,
mode => 0755,
require => Gem_package["mongrel_runit"]
}
file { "mongrel_runit.sh":
path => "/etc/init.d/mongrel_runit.sh",
content => template("mongrel-runit/mongrel_runit.sh.erb"),
owner => root,
group => root,
mode => 0755,
require => File["mongrel_runit_dir"]
}
}
# mongrel_runit.sh.erb
#!/bin/bash
#
# A system-v style init script, that switches on $0 to decide what
# to run.
#
# You will want to have configdir set to a place where your config
# files are found, named after the init script. Making a symlink to
# the script named "monkey" would use mongrel_runit and load the
# monkey.yml file.
#
configdir="/etc/mongrel_runit"
basename=`basename $0`
exec <%= gem_path %>/bin/mongrel_runit -a $basename -c $configdir/$basename.yml $@
# From out puppet::server class
file { "mongrel-puppetmaster.yml":
path => "/etc/mongrel_runit/mongrel-puppetmasterd.yml",
content => template("puppet/server/puppetmaster.yml.erb"),
owner => root,
group => root,
mode => 644,
require => [ Class["mongrel-runit"], File["init.d-mongrel-puppetmaster"] ],
notify => Exec["mongrel-puppetmaster-create"]
}
file { "init.d-mongrel-puppetmaster":
path => "/etc/init.d/mongrel-puppetmasterd",
ensure => "/etc/init.d/mongrel_runit.sh",
require => File["mongrel_runit.sh"],
}
service { "mongrel-puppetmasterd":
hasrestart => true,
require => File["init.d-mongrel-puppetmaster"]
}
exec { "mongrel-puppetmaster-create":
command => "/etc/init.d/mongrel-puppetmasterd create",
refreshonly => true,
}