Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not start or manage the Postgresql daemon.

In some situations, for example, a clustered environment when and how to
start Postgresql might be taken by another service or system.

If you specify 'manage_service' to be false, a policy-rc.d(8) shell
script is installed that will prevent the Debian / Ubuntu service from
starting at install time.

Additionally the entire service definition is removed, so that other
things can not trigger the service to run (or stop) unexpectedly.
  • Loading branch information...
commit 5847a67060adc2592224f1f8d5e747cda2d25629 1 parent 848bfab
@akumria authored
Showing with 42 additions and 13 deletions.
  1. +6 −0 files/postgresql-policyrc.d
  2. +36 −13 manifests/server.pp
View
6 files/postgresql-policyrc.d
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+if [ "X$1" = "Xpostgresql" ]; then
+ exit 101
+fi
+exit 0
View
49 manifests/server.pp
@@ -10,22 +10,45 @@
$ssl_crl_file = $postgresql::params::ssl_crl_file,
$ssl_key_file = $postgresql::params::ssl_key_file,
$preacl = [],
- $acl = []
+ $acl = [],
+ $manage_service = true
) inherits postgresql::params {
+ file { 'postgresql-server-policyrc.d':
+ ensure => present,
+ name => '/usr/sbin/policy-rc.d',
+ owner => root,
+ group => root,
+ mode => '0755',
+ source => "puppet:///modules/${module_name}/postgresql-policyrc.d"
+ }
+
+ if ($manage_service) {
+
+ service { "postgresql-system-$version":
+ name => 'postgresql',
+ enable => true,
+ ensure => running,
+ hasstatus => false,
+ hasrestart => true,
+ provider => 'debian',
+ subscribe => Package["postgresql-server-$version"],
+ }
+
+ $notify_service = Service["postgresql-system-$version"]
+ $package_require = []
+
+ } else {
+
+ $notify_service = []
+ $package_require = File['postgresql-server-policyrc.d']
+
+ }
+
package { "postgresql-server-$version":
name => sprintf("%s-%s", $server_package, $version),
ensure => present,
- }
-
- service { "postgresql-system-$version":
- name => 'postgresql',
- enable => true,
- ensure => running,
- hasstatus => false,
- hasrestart => true,
- provider => 'debian',
- subscribe => Package["postgresql-server-$version"],
+ require => $package_require,
}
file { "postgresql-server-config-$version":
@@ -36,7 +59,7 @@
group => 'postgres',
mode => '0644',
require => Package["postgresql-server-$version"],
- notify => Service["postgresql-system-$version"],
+ notify => $notify_service,
}
file { "postgresql-server-hba-config-$version":
@@ -47,7 +70,7 @@
group => 'postgres',
mode => '0640',
require => Package["postgresql-server-$version"],
- notify => Service["postgresql-system-$version"],
+ notify => $notify_service,
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.