|
216 | 216 | # 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.
|
217 | 217 | # Gentoo also supports drop-in files.
|
218 | 218 | if $facts['os']['family'] in ['RedHat', 'Gentoo'] and $facts['service_provider'] == 'systemd' {
|
219 |
| - # Template uses: |
220 |
| - # - $facts['os']['name'] |
221 |
| - # - $facts['os']['release']['major'] |
222 |
| - # - $service_name |
223 |
| - # - $port |
224 |
| - # - $datadir |
225 |
| - # - @extra_systemd_config |
226 |
| - |
227 |
| - if (versioncmp($facts['puppetversion'], '6.1.0') < 0) { |
228 |
| - exec { 'restart-systemd': |
229 |
| - command => 'systemctl daemon-reload', |
230 |
| - refreshonly => true, |
231 |
| - path => '/bin:/usr/bin:/usr/local/bin', |
232 |
| - before => Class['postgresql::server::service'], |
233 |
| - } |
234 |
| - $systemd_notify = [Exec['restart-systemd'], Class['postgresql::server::service']] |
235 |
| - } |
236 |
| - else { |
237 |
| - $systemd_notify = Class['postgresql::server::service'] |
| 219 | + # While Puppet 6.1 and newer can do a daemon-reload if needed, systemd |
| 220 | + # doesn't appear to report that correctly in all cases. |
| 221 | + # One such case seems to be when an overriding unit file is removed from /etc |
| 222 | + # and the original one from /lib *should* be used again. |
| 223 | + # |
| 224 | + # This can be removed when Puppet < 6.1 support is dropped *and* the file |
| 225 | + # old-systemd-override is removed. |
| 226 | + exec { 'restart-systemd': |
| 227 | + command => 'systemctl daemon-reload', |
| 228 | + refreshonly => true, |
| 229 | + path => '/bin:/usr/bin:/usr/local/bin', |
| 230 | + before => Class['postgresql::server::service'], |
238 | 231 | }
|
239 | 232 |
|
240 | 233 | file {
|
241 | 234 | default:
|
242 | 235 | ensure => file,
|
243 | 236 | owner => root,
|
244 | 237 | group => root,
|
245 |
| - notify => $systemd_notify, |
| 238 | + notify => [Exec['restart-systemd'], Class['postgresql::server::service']], |
246 | 239 | before => Class['postgresql::server::reload'],
|
247 |
| - |
248 | 240 | ;
|
249 | 241 |
|
250 | 242 | 'systemd-conf-dir':
|
251 | 243 | ensure => directory,
|
252 | 244 | path => "/etc/systemd/system/${service_name}.service.d",
|
253 | 245 | ;
|
254 | 246 |
|
| 247 | + # Template uses: |
| 248 | + # - $facts['os']['name'] |
| 249 | + # - $facts['os']['release']['major'] |
| 250 | + # - $service_name |
| 251 | + # - $port |
| 252 | + # - $datadir |
| 253 | + # - $extra_systemd_config |
255 | 254 | 'systemd-override':
|
256 | 255 | path => "/etc/systemd/system/${service_name}.service.d/${service_name}.conf",
|
257 | 256 | content => template('postgresql/systemd-override.erb'),
|
|
0 commit comments