system-config/modules/jenkins/manifests/cgroups.pp
Jeremy Stanley 4a19b54683 Restore cgroup-bin Upstart jobs on Ubuntu Quantal.
* modules/jenkins/files/cgroups/upstart_cgconfig: Very trivial
Upstart job to load /etc/cgconfig.conf once cgroup-lite has started.

* modules/jenkins/files/cgroups/upstart_cgred: Very trivial Upstart
job to start cgred once cgconfig has been loaded.

* modules/jenkins/manifests/cgroups.pp: Conditionally add Upstart
jobs cgconfig and cgred if Ubuntu >= 12.10. They used to exist, but
were dropped in the process of refactoring cgroup support after
Precise.

* modules/jenkins/manifests/params.pp: Add parameter lists for the
cgconfig and cgred dependencies since they differ between RHEL and
Ubuntu.

* modules/jenkins/templates/cgconfig.erb: Conditionally omit the
default cgroup mounts section on Ubuntu Quantal or later.

Change-Id: I16e2996387d534928a3cfa90de9159fbe02bbdd2
Reviewed-on: https://review.openstack.org/20638
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
2013-01-30 22:06:09 +00:00

91 lines
2.0 KiB
Puppet

# == Class: jenkins::cgroups
#
class jenkins::cgroups {
include jenkins::params
package { 'cgroups':
ensure => present,
name => $::jenkins::params::cgroups_package,
}
file { '/etc/cgconfig.conf':
ensure => present,
replace => true,
owner => 'root',
group => 'jenkins',
mode => '0644',
content => template('jenkins/cgconfig.erb'),
}
file { '/etc/cgrules.conf':
ensure => present,
replace => true,
owner => 'root',
group => 'jenkins',
mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/cgrules.conf',
}
# Starting with Ubuntu Quantal (12.10) cgroup-bin dropped its upstart jobs.
if $::operatingsystem == 'Ubuntu' {
if $::operatingsystemrelease >= '12.10' {
file { '/etc/init/cgconfig.conf':
ensure => present,
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/upstart_cgconfig',
}
file { '/etc/init.d/cgconfig':
ensure => link,
target => '/lib/init/upstart-job',
}
file { '/etc/init/cgred.conf':
ensure => present,
replace => true,
owner => 'root',
group => 'root',
mode => '0644',
source => 'puppet:///modules/jenkins/cgroups/upstart_cgred',
}
file { '/etc/init.d/cgred':
ensure => link,
target => '/lib/init/upstart-job',
}
} else {
file { '/etc/init/cgconfig.conf':
ensure => present,
}
file { '/etc/init/cgred.conf':
ensure => present,
}
}
}
service { 'cgconfig':
ensure => running,
enable => true,
require => $::jenkins::params::cgconfig_require,
subscribe => File['/etc/cgconfig.conf'],
}
service { 'cgred':
ensure => running,
enable => true,
require => $::jenkins::params::cgred_require,
subscribe => File['/etc/cgrules.conf'],
}
}