Systemd syslog settings for astute, nailgun and ostf
Services astute, nailgun, ostf were converted to systemd units in a set of requests: * astute https://review.openstack.org/#/c/248128 * nailgun https://review.openstack.org/#/c/248206 * ostf https://review.openstack.org/#/c/248096 assassind, receiverd, statsenderd, oswl_* are a part of nailgun so there is no separate request for them (included in 248206) However, those commits add only service units. This commit adds conf files with customized settings for those services. Blueprint: master-on-centos7 Compatible with CentOS6 master node. Change-Id: I1808a0852d7c95079ae27540b77b1ae0035ab65b
This commit is contained in:
parent
032c707ec8
commit
8833d8b4b6
@ -58,9 +58,11 @@ if $::osfamily == 'RedHat' {
|
||||
'6': {
|
||||
$mco_packages = ['ruby21-rubygem-mcollective-client',
|
||||
'ruby21-nailgun-mcagents']
|
||||
$use_systemd = false
|
||||
}
|
||||
'7': {
|
||||
$mco_packages = ['rubygem-mcollective-client', 'nailgun-mcagents']
|
||||
$use_systemd = true
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported ${::osfamily} release: ${::operatingsystemmajrelease}")
|
||||
@ -71,8 +73,7 @@ if $::osfamily == 'RedHat' {
|
||||
ensure_packages($mco_packages)
|
||||
|
||||
Class['docker::container'] ->
|
||||
Class['nailgun::astute'] ->
|
||||
Class['nailgun::supervisor']
|
||||
Class['nailgun::astute']
|
||||
|
||||
class { 'docker::container': }
|
||||
|
||||
@ -84,11 +85,20 @@ class { 'nailgun::astute':
|
||||
bootstrap_flavor => $bootstrap_flavor,
|
||||
}
|
||||
|
||||
package { 'supervisor': } ->
|
||||
class { 'nailgun::supervisor':
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => 'nailgun/supervisord.conf.astute.erb',
|
||||
if $use_systemd {
|
||||
class { 'nailgun::systemd':
|
||||
services => ['astute'],
|
||||
production => $production,
|
||||
require => Class['nailgun::astute']
|
||||
}
|
||||
} else {
|
||||
package { 'supervisor': } ->
|
||||
class { 'nailgun::supervisor':
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => 'nailgun/supervisord.conf.astute.erb',
|
||||
require => Class['nailgun::astute']
|
||||
}
|
||||
}
|
||||
|
||||
class { '::mcollective':
|
||||
|
@ -17,11 +17,21 @@ else {
|
||||
$env_path = "/usr"
|
||||
$staticdir = "/usr/share/nailgun/static"
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
if $::operatingsystemmajrelease >= '7' {
|
||||
$use_systemd = true
|
||||
} else {
|
||||
$use_systemd = false
|
||||
}
|
||||
}
|
||||
default: { $use_systemd = false }
|
||||
}
|
||||
|
||||
Class["docker::container"] ->
|
||||
Class["nailgun::user"] ->
|
||||
Class["nailgun::packages"] ->
|
||||
Class["nailgun::venv"] ->
|
||||
Class["nailgun::supervisor"]
|
||||
Class["nailgun::venv"]
|
||||
|
||||
Exec {path => '/usr/bin:/bin:/usr/sbin:/sbin'}
|
||||
|
||||
@ -156,11 +166,31 @@ class { "nailgun::client":
|
||||
keystone_user => $::fuel_settings['FUEL_ACCESS']['user'],
|
||||
keystone_pass => $::fuel_settings['FUEL_ACCESS']['password'],
|
||||
}
|
||||
class { "nailgun::supervisor":
|
||||
service_enabled => false,
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => "nailgun/supervisord.conf.nailgun.erb",
|
||||
|
||||
if $use_systemd {
|
||||
$services = [ 'assassind',
|
||||
'nailgun',
|
||||
'oswl_flavor_collectord',
|
||||
'oswl_image_collectord',
|
||||
'oswl_keystone_user_collectord',
|
||||
'oswl_tenant_collectord',
|
||||
'oswl_vm_collectord',
|
||||
'oswl_volume_collectord',
|
||||
'receiverd',
|
||||
'statsenderd' ]
|
||||
class { 'nailgun::systemd':
|
||||
production => $production,
|
||||
services => $services,
|
||||
require => Class['nailgun::venv']
|
||||
}
|
||||
} else {
|
||||
class { 'nailgun::supervisor':
|
||||
service_enabled => false,
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => 'nailgun/supervisord.conf.nailgun.erb',
|
||||
require => Class['nailgun::venv']
|
||||
}
|
||||
}
|
||||
|
||||
package { 'crontabs':
|
||||
|
@ -18,6 +18,16 @@ if $production == 'prod'{
|
||||
# this replaces removed postgresql version fact
|
||||
$postgres_default_version = '9.3'
|
||||
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
if $::operatingsystemmajrelease >= '7' {
|
||||
$use_systemd = true
|
||||
} else {
|
||||
$use_systemd = false
|
||||
}
|
||||
}
|
||||
default: { $use_systemd = false }
|
||||
}
|
||||
|
||||
node default {
|
||||
|
||||
@ -25,14 +35,14 @@ node default {
|
||||
|
||||
Class['docker::container'] ->
|
||||
Class['nailgun::packages'] ->
|
||||
Class['nailgun::ostf'] ->
|
||||
Class['nailgun::supervisor']
|
||||
Class['nailgun::ostf']
|
||||
|
||||
class {'docker::container': }
|
||||
class { "nailgun::packages": }
|
||||
|
||||
class { "nailgun::ostf":
|
||||
production => $production,
|
||||
use_systemd => $use_systemd,
|
||||
pip_opts => "${pip_index} ${pip_find_links}",
|
||||
dbname => $::fuel_settings['postgres']['ostf_dbname'],
|
||||
dbuser => $::fuel_settings['postgres']['ostf_user'],
|
||||
@ -48,10 +58,20 @@ node default {
|
||||
keystone_ostf_user => $::fuel_settings['keystone']['ostf_user'],
|
||||
keystone_ostf_pass => $::fuel_settings['keystone']['ostf_password'],
|
||||
}
|
||||
class { "nailgun::supervisor":
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => "nailgun/supervisord.conf.base.erb",
|
||||
|
||||
if $use_systemd {
|
||||
class { 'nailgun::systemd':
|
||||
services => ['ostf'],
|
||||
production => $production,
|
||||
require => Class['nailgun::ostf']
|
||||
}
|
||||
} else {
|
||||
class { 'nailgun::supervisor':
|
||||
nailgun_env => $env_path,
|
||||
ostf_env => $env_path,
|
||||
conf_file => 'nailgun/supervisord.conf.base.erb',
|
||||
require => Class['nailgun::ostf']
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -26,6 +26,13 @@ class nailgun::astute(
|
||||
}
|
||||
}
|
||||
|
||||
file { '/etc/sysconfig/astute':
|
||||
content => template('nailgun/astute.sysconfig.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644'
|
||||
}
|
||||
|
||||
file { '/usr/bin/astuted':
|
||||
content => template('nailgun/astuted.erb'),
|
||||
owner => 'root',
|
||||
|
@ -1,6 +1,7 @@
|
||||
class nailgun::ostf(
|
||||
$pip_opts,
|
||||
$production,
|
||||
$use_systemd = false,
|
||||
$venv = '/opt/fuel_plugins/ostf',
|
||||
$dbuser = 'ostf',
|
||||
$dbpass = 'ostf',
|
||||
@ -40,19 +41,20 @@ class nailgun::ostf(
|
||||
try_sleep => 5,
|
||||
}
|
||||
Postgresql::Server::Db<| title == $dbname|> ->
|
||||
Exec['ostf-init'] -> Class['nailgun::supervisor']
|
||||
Package["fuel-ostf"] -> Exec['ostf-init']
|
||||
File["/etc/ostf/ostf.conf"] -> Exec['ostf-init']
|
||||
Package['fuel-ostf'] -> Exec['ostf-init']
|
||||
File['/etc/ostf/ostf.conf'] -> Exec['ostf-init']
|
||||
}
|
||||
'docker-build': {
|
||||
package{'fuel-ostf':}
|
||||
}
|
||||
}
|
||||
file { '/etc/supervisord.d/ostf.conf':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
content => template('nailgun/supervisor/ostf.conf.erb'),
|
||||
require => Package['supervisor'],
|
||||
if ! $use_systemd {
|
||||
file { '/etc/supervisord.d/ostf.conf':
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
content => template('nailgun/supervisor/ostf.conf.erb'),
|
||||
require => Package['supervisor'],
|
||||
}
|
||||
}
|
||||
file { '/etc/ostf/':
|
||||
ensure => directory,
|
||||
|
33
deployment/puppet/nailgun/manifests/systemd.pp
Normal file
33
deployment/puppet/nailgun/manifests/systemd.pp
Normal file
@ -0,0 +1,33 @@
|
||||
# == Class: nailgun::systemd
|
||||
#
|
||||
# Apply local settings for nailgun services.
|
||||
#
|
||||
# At this moment only start/stop timeouts
|
||||
# and syslog identificators.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*services*]
|
||||
# (required) Array or String. This is an array of service names (or just service name as tring)
|
||||
# for which local changes will be applied.
|
||||
#
|
||||
# [*production*]
|
||||
# (required) String. Determine environment.
|
||||
# Changes applies only for 'prod' and 'docker' environments.
|
||||
#
|
||||
|
||||
class nailgun::systemd (
|
||||
$services,
|
||||
$production
|
||||
) {
|
||||
|
||||
case $production {
|
||||
'prod', 'docker': {
|
||||
if !empty($services) {
|
||||
nailgun::systemd::config { $services: }
|
||||
}
|
||||
}
|
||||
default: { }
|
||||
}
|
||||
|
||||
}
|
27
deployment/puppet/nailgun/manifests/systemd/config.pp
Normal file
27
deployment/puppet/nailgun/manifests/systemd/config.pp
Normal file
@ -0,0 +1,27 @@
|
||||
define nailgun::systemd::config {
|
||||
file { "/etc/systemd/system/${title}.service.d/":
|
||||
ensure => directory
|
||||
}
|
||||
|
||||
file { "/etc/systemd/system/${title}.service.d/fuel.conf":
|
||||
content => template('nailgun/systemd/service_template.erb'),
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0644',
|
||||
notify => Exec['nailgun_systemd_reload']
|
||||
}
|
||||
|
||||
if !defined(Exec['nailgun_systemd_reload']) {
|
||||
exec { 'nailgun_systemd_reload':
|
||||
command => '/usr/bin/systemctl daemon-reload',
|
||||
refreshonly => true,
|
||||
}
|
||||
}
|
||||
|
||||
service { "${title}":
|
||||
ensure => running,
|
||||
enable => true,
|
||||
require => Exec['nailgun_systemd_reload'],
|
||||
subscribe => File["/etc/systemd/system/${title}.service.d/fuel.conf"]
|
||||
}
|
||||
}
|
1
deployment/puppet/nailgun/templates/astute.sysconfig.erb
Normal file
1
deployment/puppet/nailgun/templates/astute.sysconfig.erb
Normal file
@ -0,0 +1 @@
|
||||
ASTUTE_OPTIONS="--config /etc/astute/astuted.conf --logfile /var/log/astute.log --loglevel info --workers 7"
|
@ -0,0 +1,12 @@
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=10s
|
||||
StartLimitBurst=10
|
||||
TimeoutStartSec=10s
|
||||
TimeoutStopSec=5s
|
||||
|
||||
StandardInput=null
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog+console
|
||||
SyslogIdentifier=<%= @title %>
|
||||
|
@ -3,6 +3,81 @@ require 'shared-examples'
|
||||
manifest = 'master/astute-only.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
context 'running on CentOS 6' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '6'
|
||||
})
|
||||
end
|
||||
it 'configure nailgun supervisor' do
|
||||
fuel_settings = Noop.puppet_function 'parseyaml',facts[:astute_settings_yaml]
|
||||
production = Noop.puppet_function 'pick',fuel_settings['PRODUCTION'],'docker'
|
||||
if production== 'prod'
|
||||
env_path = '/usr'
|
||||
else
|
||||
env_path = '/opt/nailgun'
|
||||
end
|
||||
should contain_class('nailgun::supervisor').with(
|
||||
:nailgun_env => env_path,
|
||||
:ostf_env => env_path,
|
||||
:conf_file => 'nailgun/supervisord.conf.astute.erb',
|
||||
:require => 'Class[Nailgun::Astute]'
|
||||
)
|
||||
end
|
||||
|
||||
it 'should prepare supervisord configuration file' do
|
||||
should contain_file('/etc/supervisord.conf').with(
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
:mode => '0644',
|
||||
:require => 'Package[supervisor]',
|
||||
:notify => 'Service[supervisord]',
|
||||
)
|
||||
end
|
||||
|
||||
it 'should enable supervisord service' do
|
||||
should contain_service('supervisord').with(
|
||||
:ensure => true,
|
||||
:enable => true,
|
||||
:require => 'Package[supervisor]',
|
||||
:hasrestart => true,
|
||||
:restart => '/usr/bin/supervisorctl stop all; /etc/init.d/supervisord restart',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'running on CentOS 7' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '7'
|
||||
})
|
||||
end
|
||||
let(:params) { { :services => [ 'astute' ] } }
|
||||
|
||||
it 'configures service with valid params' do
|
||||
fuel_settings = Noop.puppet_function 'parseyaml',facts[:astute_settings_yaml]
|
||||
production = Noop.puppet_function 'pick',fuel_settings['PRODUCTION'],'docker'
|
||||
should contain_class('nailgun::systemd').with(
|
||||
:production => production,
|
||||
:services => params[:services],
|
||||
:require => 'Class[Nailgun::Astute]'
|
||||
)
|
||||
params[:services].each do |service|
|
||||
should contain_file("/etc/systemd/system/#{service}.service.d/fuel.conf").with({
|
||||
:mode => '0644',
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
})
|
||||
should contain_service(service).with({
|
||||
:ensure => 'running',
|
||||
:enable => 'true',
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
test_centos manifest
|
||||
end
|
||||
|
||||
|
@ -11,6 +11,90 @@ describe manifest do
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'catalog' do
|
||||
|
||||
context 'running on CentOS 6' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '6'
|
||||
})
|
||||
end
|
||||
it 'configure nailgun supervisor' do
|
||||
should contain_class('nailgun::supervisor').with(
|
||||
:service_enabled => false,
|
||||
:nailgun_env => '/usr',
|
||||
:ostf_env => '/usr',
|
||||
:conf_file => 'nailgun/supervisord.conf.nailgun.erb',
|
||||
:require => 'Class[Nailgun::Venv]'
|
||||
)
|
||||
end
|
||||
|
||||
it 'should prepare supervisord configuration file' do
|
||||
should contain_file('/etc/supervisord.conf').with(
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
:mode => '0644',
|
||||
:require => 'Package[supervisor]',
|
||||
:notify => 'Service[supervisord]',
|
||||
)
|
||||
end
|
||||
|
||||
it 'should disable supervisord service' do
|
||||
should contain_service('supervisord').with(
|
||||
:ensure => false,
|
||||
:enable => false,
|
||||
:require => 'Package[supervisor]',
|
||||
:hasrestart => true,
|
||||
:restart => '/usr/bin/supervisorctl stop all; /etc/init.d/supervisord restart',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'running on CentOS 7' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '7'
|
||||
})
|
||||
end
|
||||
let(:params) { {
|
||||
:services => [ 'assassind',
|
||||
'nailgun',
|
||||
'oswl_flavor_collectord',
|
||||
'oswl_image_collectord',
|
||||
'oswl_keystone_user_collectord',
|
||||
'oswl_tenant_collectord',
|
||||
'oswl_vm_collectord',
|
||||
'oswl_volume_collectord',
|
||||
'receiverd',
|
||||
'statsenderd' ]
|
||||
} }
|
||||
|
||||
|
||||
it 'configures service with valid params' do
|
||||
fuel_settings = Noop.puppet_function 'parseyaml',facts[:astute_settings_yaml]
|
||||
if fuel_settings['PRODUCTION']
|
||||
production = fuel_settings['PRODUCTION']
|
||||
else
|
||||
production = 'docker'
|
||||
end
|
||||
should contain_class('nailgun::systemd').with(
|
||||
:production => production,
|
||||
:services => params[:services],
|
||||
:require => 'Class[Nailgun::Venv]'
|
||||
)
|
||||
params[:services].each do |service|
|
||||
should contain_file("/etc/systemd/system/#{service}.service.d/fuel.conf").with({
|
||||
:mode => '0644',
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
})
|
||||
should contain_service(service).with({
|
||||
:ensure => 'running',
|
||||
:enable => 'true',
|
||||
})
|
||||
end
|
||||
end
|
||||
end # context
|
||||
end # catalog
|
||||
test_centos manifest
|
||||
end
|
||||
|
||||
|
@ -3,5 +3,98 @@ require 'shared-examples'
|
||||
manifest = 'master/ostf-only.pp'
|
||||
|
||||
describe manifest do
|
||||
shared_examples 'catalog' do
|
||||
context 'running on CentOS 6' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '6'
|
||||
})
|
||||
end
|
||||
it 'configure nailgun supervisor' do
|
||||
fuel_settings = Noop.puppet_function 'parseyaml',facts[:astute_settings_yaml]
|
||||
if fuel_settings['PRODUCTION']
|
||||
production = fuel_settings['PRODUCTION']
|
||||
else
|
||||
production = 'docker'
|
||||
end
|
||||
if production== 'prod'
|
||||
env_path = '/usr'
|
||||
else
|
||||
env_path = '/opt/nailgun'
|
||||
end
|
||||
should contain_class('nailgun::supervisor').with(
|
||||
:nailgun_env => env_path,
|
||||
:ostf_env => env_path,
|
||||
:conf_file => 'nailgun/supervisord.conf.base.erb',
|
||||
:require => 'Class[Nailgun::Ostf]'
|
||||
)
|
||||
end
|
||||
|
||||
it 'should prepare supervisor ostf configuraion file' do
|
||||
should contain_file('/etc/supervisord.d/ostf.conf').with(
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
:require => 'Package[supervisor]',
|
||||
)
|
||||
end
|
||||
|
||||
it 'should prepare supervisord configuration file' do
|
||||
should contain_file('/etc/supervisord.conf').with(
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
:mode => '0644',
|
||||
:require => 'Package[supervisor]',
|
||||
:notify => 'Service[supervisord]',
|
||||
)
|
||||
end
|
||||
|
||||
it 'should enable supervisord service' do
|
||||
should contain_service('supervisord').with(
|
||||
:ensure => true,
|
||||
:enable => true,
|
||||
:require => 'Package[supervisor]',
|
||||
:hasrestart => true,
|
||||
:restart => '/usr/bin/supervisorctl stop all; /etc/init.d/supervisord restart',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
context 'running on CentOS 7' do
|
||||
let(:facts) do
|
||||
Noop.centos_facts.merge({
|
||||
:operatingsystemmajrelease => '7'
|
||||
})
|
||||
end
|
||||
let(:params) { { :services => [ 'ostf' ] } }
|
||||
|
||||
it 'configures service with valid params' do
|
||||
fuel_settings = Noop.puppet_function 'parseyaml',facts[:astute_settings_yaml]
|
||||
if fuel_settings['PRODUCTION']
|
||||
production = fuel_settings['PRODUCTION']
|
||||
else
|
||||
production = 'docker'
|
||||
end
|
||||
should contain_class('nailgun::systemd').with(
|
||||
:production => production,
|
||||
:services => params[:services],
|
||||
:require => 'Class[Nailgun::Ostf]'
|
||||
)
|
||||
params[:services].each do |service|
|
||||
should contain_file("/etc/systemd/system/#{service}.service.d/fuel.conf").with({
|
||||
:mode => '0644',
|
||||
:owner => 'root',
|
||||
:group => 'root',
|
||||
})
|
||||
should contain_service(service).with({
|
||||
:ensure => 'running',
|
||||
:enable => 'true',
|
||||
})
|
||||
end
|
||||
should_not contain_file('/etc/supervisord.d/ostf.conf')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
test_centos manifest
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user