Puppet Class: postgresql::service

Inherits:
postgresql
Defined in:
manifests/service.pp

Overview



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'manifests/service.pp', line 1

class postgresql::service inherits postgresql {

  $is_docker_container_var=getvar('::eyp_docker_iscontainer')
  $is_docker_container=str2bool($is_docker_container_var)

  #raspbian postgresql.service
  if($postgresql::params::repoprovider=='raspbian10')
  {
    $postgres_service_name='postgresql@11-main.service'
  }
  else
  {
    $postgres_service_name=$postgresql::params::servicename[$postgresql::version]
  }

  if( $is_docker_container==false or
      $postgresql::manage_docker_service)
  {
    if($postgresql::manage_service)
    {
      exec { 'check pending restart':
        command => '/bin/bash -c \'echo RESTART NEEDED\'',
        unless  => '/usr/local/bin/check_postgres_pending_restart',
      }

      if($postgresql::restart_if_needed)
      {
        Exec['check pending restart'] {
          notify  => Service[$postgres_service_name],
        }
      }

      service { $postgres_service_name:
        ensure  => $postgresql::ensure,
        enable  => $postgresql::enable,
        require => Exec['check pending restart'],
      }
    }
  }
}