From 5dc9c3aa06840d9280d8a41ad57bedf7572d62e1 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 17 Mar 2012 16:53:41 +0000 Subject: split database from main postgresql file --- modules/postgresql/manifests/database.pp | 19 +++++++++++++++++++ modules/postgresql/manifests/init.pp | 19 +------------------ 2 files changed, 20 insertions(+), 18 deletions(-) create mode 100644 modules/postgresql/manifests/database.pp (limited to 'modules/postgresql') diff --git a/modules/postgresql/manifests/database.pp b/modules/postgresql/manifests/database.pp new file mode 100644 index 00000000..82670b5e --- /dev/null +++ b/modules/postgresql/manifests/database.pp @@ -0,0 +1,19 @@ +# TODO convert it to a regular type ( so we can later change user and so on ) +define postgresql::database($description = '', + $user = 'postgres', + $callback_notify = '') { + + exec { "createdb -O $user -U postgres $name '$description'": + user => 'root', + unless => "psql -A -t -U postgres -l | grep '^$name|'", + require => Service['postgresql'], + } + + # this is fetched by the manifest asking the database creation, + # once the db have been created + # FIXME proper ordering ? + @@postgresql::database_callback { $name: + tag => $name, + callback_notify => $callback_notify, + } +} diff --git a/modules/postgresql/manifests/init.pp b/modules/postgresql/manifests/init.pp index e943052d..dcce8946 100644 --- a/modules/postgresql/manifests/init.pp +++ b/modules/postgresql/manifests/init.pp @@ -139,22 +139,5 @@ class postgresql { } } - # TODO convert it to a regular type ( so we can later change user and so on ) - define database($description = "", - $user = "postgres", - $callback_notify = "") { - exec { "createdb -O $user -U postgres $name '$description'": - user => root, - unless => "psql -A -t -U postgres -l | grep '^$name|'", - require => Service['postgresql'], - } - - # this is fetched by the manifest asking the database creation, once the db have been created - # FIXME proper ordering ? - @@postgresql::database_callback { $name: - tag => $name, - callback_notify => $callback_notify, - } - } - + } -- cgit v1.2.1