b87b76f27c
Now that we are upgrading to Xenial, we need to take into account that we're running with systemd and reload it so that it picks up the new service. Change-Id: Id02ac2bc51132a8d8d4a77cb05d41fa902765b28
76 lines
2.4 KiB
Puppet
76 lines
2.4 KiB
Puppet
# Copyright 2012-2013 Hewlett-Packard Development Company, L.P.
|
|
# Copyright 2013 OpenStack Foundation
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
# == Class: log_processor::worker
|
|
#
|
|
define log_processor::worker (
|
|
$config_file,
|
|
) {
|
|
$suffix = "-${name}"
|
|
|
|
file { "/etc/logprocessor/jenkins-log-worker${suffix}.yaml":
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0555',
|
|
source => $config_file,
|
|
require => User['logprocessor'],
|
|
}
|
|
|
|
file { "/etc/init.d/jenkins-log-worker${suffix}":
|
|
ensure => present,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0555',
|
|
content => template('log_processor/jenkins-log-worker.init.erb'),
|
|
require => [
|
|
File['/usr/local/bin/log-gearman-worker.py'],
|
|
File["/etc/logprocessor/jenkins-log-worker${suffix}.yaml"],
|
|
],
|
|
}
|
|
|
|
if ($::operatingsystem == 'Ubuntu') and ($::operatingsystemrelease >= '16.04') {
|
|
# This is a hack to make sure that systemd is aware of the new service
|
|
# before we attempt to start it.
|
|
exec { "jenkins-log-worker${suffix}-systemd-daemon-reload":
|
|
command => '/bin/systemctl daemon-reload',
|
|
before => Service["jenkins-log-worker${suffix}"],
|
|
subscribe => File["/etc/init.d/jenkins-log-worker${suffix}"],
|
|
refreshonly => true,
|
|
}
|
|
}
|
|
|
|
service { "jenkins-log-worker${suffix}":
|
|
enable => true,
|
|
hasrestart => true,
|
|
subscribe => File["/etc/logprocessor/jenkins-log-worker${suffix}.yaml"],
|
|
require => File["/etc/init.d/jenkins-log-worker${suffix}"],
|
|
}
|
|
|
|
include ::logrotate
|
|
logrotate::file { "log-worker${suffix}-debug.log":
|
|
log => "/var/log/logprocessor/log-worker${suffix}-debug.log",
|
|
options => [
|
|
'compress',
|
|
'copytruncate',
|
|
'missingok',
|
|
'rotate 7',
|
|
'daily',
|
|
'notifempty',
|
|
],
|
|
require => Service["jenkins-log-worker${suffix}"],
|
|
}
|
|
}
|