[Mageia-sysadm] [189] - add a alias not dependent on the pogsql version

root at mageia.org root at mageia.org
Sun Nov 7 14:04:26 CET 2010


Revision: 189
Author:   misc
Date:     2010-11-07 14:04:26 +0100 (Sun, 07 Nov 2010)
Log Message:
-----------
- add a alias not dependent on the pogsql version 
- do not reload on restart ( as this may have side effect )
- explicitly ask for reload on config file change ( with exec service reload )
- use shorter name for file, with a common variable 

Modified Paths:
--------------
    puppet/modules/postgresql/manifests/init.pp

Modified: puppet/modules/postgresql/manifests/init.pp
===================================================================
--- puppet/modules/postgresql/manifests/init.pp	2010-11-07 00:46:55 UTC (rev 188)
+++ puppet/modules/postgresql/manifests/init.pp	2010-11-07 13:04:26 UTC (rev 189)
@@ -1,15 +1,25 @@
 class postgresql {
+    
+    $pgsql_data = "/var/lib/pgsql/data/"
+
     package { 'postgresql9.0-server':
+        alias => "postgresql-server",
         ensure => installed
     }
 
     service { postgresql:
         ensure => running,
-        subscribe => Package["postgresql9.0-server"],
-        restart => "/etc/rc.d/init.d/postgresql reload",
+        subscribe => Package["postgresql-server"],
         hasstatus => true,
     }
 
+    exec { "service postgresql reload":
+        refreshonly => true,
+        subscribe => [ File["postgresql.conf"], 
+                       File["pg_ident.conf"],
+                       File["pg_hba.conf"] ]
+    }
+
     file { '/etc/pam.d/postgresql':
         ensure => present,
         owner  => root,
@@ -18,33 +28,33 @@
         content => template("postgresql/pam"),
     }
 
-    file { '/var/lib/pgsql/data/postgresql.conf':
+    file { "postgresql.conf":
+        path => "$pgsql_data/$name",
         ensure => present,
         owner => postgres,
         group => postgres,
         mode => 600,
         content => template("postgresql/postgresql.conf"),
-        require => Package["postgresql9.0-server"],
-        notify => [Service["postgresql"]]
+        require => Package["postgresql-server"],
     }
     
-    file { '/var/lib/pgsql/data/pg_hba.conf':
+    file { 'pg_hba.conf':
+        path => "$pgsql_data/$name",
         ensure => present,
         owner => postgres,
         group => postgres,
         mode => 600,
         content => template("postgresql/pg_hba.conf"),
-        require => Package["postgresql9.0-server"],
-        notify => [Service["postgresql"]]
+        require => Package["postgresql-server"],
     }
 
-    file { '/var/lib/pgsql/data/pg_ident.conf':
+    file { 'pg_ident.conf':
+        path => "$pgsql_data/$name",
         ensure => present,
         owner => postgres,
         group => postgres,
         mode => 600,
         content => template("postgresql/pg_ident.conf"),
-        require => Package["postgresql9.0-server"],
-        notify => [Service["postgresql"]]
+        require => Package["postgresql-server"],
     }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101107/fa973fab/attachment.html>


More information about the Mageia-sysadm mailing list