Skip to content

Commit

Permalink
adjust systemd dropin condition
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonHoenscheid committed Aug 23, 2023
1 parent a1decc6 commit 9aac3c2
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions manifests/server/instance/systemd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@

) {
if $facts['service_provider'] == 'systemd' {
if $instance_name == 'main' {
if $facts['os']['family'] in ['RedHat', 'Gentoo'] {
# RHEL 7 and 8 both support drop-in files for systemd units.
# Gentoo also supports drop-in files.
# RHEL based Systems need Variables set for $PGPORT, $DATA_DIR or $PGDATA, thats what the drop-in file is for.
# For additional instances (!= 'main') we need a new systemd service anyhow and use one systemd-file. no dropin needed.
#
# Template uses:
# - $port
# - $datadir
# - $extra_systemd_config
systemd::dropin_file { "${service_name}.conf":
ensure => $drop_in_ensure,
unit => "${service_name}.service",
owner => 'root',
group => 'root',
content => epp('postgresql/systemd-override.conf.epp', {
port => $port,
datadir => $datadir,
extra_systemd_config => $extra_systemd_config,
}
),
notify => Class['postgresql::server::service'],
before => Class['postgresql::server::reload'],
}
if $facts['os']['family'] in ['RedHat', 'Gentoo'] {
# RHEL 7 and 8 both support drop-in files for systemd units.
# Gentoo also supports drop-in files.
# RHEL based Systems need Variables set for $PGPORT, $DATA_DIR or $PGDATA, thats what the drop-in file is for.
# For additional instances (!= 'main') we need a new systemd service anyhow and use one systemd-file. no dropin needed.
#
# Template uses:
# - $port
# - $datadir
# - $extra_systemd_config
systemd::dropin_file { "${service_name}.conf":
ensure => $drop_in_ensure,
unit => "${service_name}.service",
owner => 'root',
group => 'root',
content => epp('postgresql/systemd-override.conf.epp', {
port => $port,
datadir => $datadir,
extra_systemd_config => $extra_systemd_config,
}
),
notify => Class['postgresql::server::service'],
before => Class['postgresql::server::reload'],
}
} else {
# instance systemd file here
Expand Down

0 comments on commit 9aac3c2

Please sign in to comment.