Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 20 additions & 21 deletions manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -216,42 +216,41 @@
# RHEL 7 and 8 both support drop-in files for systemd units. The old include directive is deprecated and may be removed in future systemd releases.
# Gentoo also supports drop-in files.
if $facts['os']['family'] in ['RedHat', 'Gentoo'] and $facts['service_provider'] == 'systemd' {
# Template uses:
# - $facts['os']['name']
# - $facts['os']['release']['major']
# - $service_name
# - $port
# - $datadir
# - @extra_systemd_config

if (versioncmp($facts['puppetversion'], '6.1.0') < 0) {
exec { 'restart-systemd':
command => 'systemctl daemon-reload',
refreshonly => true,
path => '/bin:/usr/bin:/usr/local/bin',
before => Class['postgresql::server::service'],
}
$systemd_notify = [Exec['restart-systemd'], Class['postgresql::server::service']]
}
else {
$systemd_notify = Class['postgresql::server::service']
# While Puppet 6.1 and newer can do a daemon-reload if needed, systemd
# doesn't appear to report that correctly in all cases.
# One such case seems to be when an overriding unit file is removed from /etc
# and the original one from /lib *should* be used again.
#
# This can be removed when Puppet < 6.1 support is dropped *and* the file
# old-systemd-override is removed.
exec { 'restart-systemd':
command => 'systemctl daemon-reload',
refreshonly => true,
path => '/bin:/usr/bin:/usr/local/bin',
before => Class['postgresql::server::service'],
}

file {
default:
ensure => file,
owner => root,
group => root,
notify => $systemd_notify,
notify => [Exec['restart-systemd'], Class['postgresql::server::service']],
before => Class['postgresql::server::reload'],

;

'systemd-conf-dir':
ensure => directory,
path => "/etc/systemd/system/${service_name}.service.d",
;

# Template uses:
# - $facts['os']['name']
# - $facts['os']['release']['major']
# - $service_name
# - $port
# - $datadir
# - $extra_systemd_config
'systemd-override':
path => "/etc/systemd/system/${service_name}.service.d/${service_name}.conf",
content => template('postgresql/systemd-override.erb'),
Expand Down