Enable automatic restart of memcached, apache and mongodb

Prior to Newton, HA deployments had automatic restart of non-Openstack
services on controller nodes. From Newton onward, after we switched to
systemd for the vast majority of services, Openstack services are
configured for automatic restart, but memcached apache and mongodb
lack it.

Generate a drop-in file for the mentioned services, so they can
restart automatically in both HA and non-HA deployments.

This change differs slighly from the review backported to Ocata [1]
because in Newton, there is no tripleo-specific profile to configure
Apache; So we generate the drop-in file in the keystone profile to
guarantee that Apache automatic restart will be enabled on nodes where
OpenStack API are deployed.

[1] I7658f539db55b7416a9931822cfe2102c3388123

Change-Id: Ic6b57ec30c53a077eb83afd5c99f5c59e6ff56d3
Closes-Bug: #1741263
Co-Authored-By: Michele Baldessari <michele@acksyn.org>
This commit is contained in:
Damien Ciabrini 2018-01-17 21:59:52 +01:00
parent 64a4d7c3a4
commit 9b68a3ad43
3 changed files with 65 additions and 0 deletions

View File

@ -43,6 +43,26 @@ class tripleo::profile::base::database::mongodb (
include ::tripleo::profile::base::database::mongodbcommon
# Automatic restart
file { '/etc/systemd/system/mongod.service.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
-> file { '/etc/systemd/system/mongod.service.d/mongod.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => "[Service]\nRestart=always\n",
}
~> exec { 'mongod-dropin-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $::path,
}
if $bootstrap_node == $::hostname {
# make sure we can connect to all servers before forming the replset
tripleo::profile::pacemaker::database::mongodbvalidator {

View File

@ -99,6 +99,31 @@ class tripleo::profile::base::keystone (
include ::keystone::endpoint
}
# Automatic restart for Apache service
# Note: there is no tripleo-specific file to configure Apache;
# However all OpenStack services that use Apache rely on keystone,
# so generating the drop-in file here is enough to guarantee that
# Apache automatic restart will be enabled on nodes where
# OpenStack API are deployed.
file { '/etc/systemd/system/httpd.service.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
-> file { '/etc/systemd/system/httpd.service.d/httpd.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => "[Service]\nRestart=always\n",
}
~> exec { 'httpd-dropin-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $::path,
}
}
if $step >= 5 and $manage_db_purge {

View File

@ -28,5 +28,25 @@ class tripleo::profile::base::memcached (
) {
if $step >= 1 {
include ::memcached
# Automatic restart
file { '/etc/systemd/system/memcached.service.d':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
}
-> file { '/etc/systemd/system/memcached.service.d/memcached.conf':
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
content => "[Service]\nRestart=always\n",
}
~> exec { 'memcached-dropin-reload':
command => 'systemctl daemon-reload',
refreshonly => true,
path => $::path,
}
}
}