From 63bbb9f955f13b4950bc36a6e18e90f1d748aec1 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 7 Dec 2010 02:40:22 +0000 Subject: add a type postgres user, to be able to declare postgresql user in puppet directly --- modules/postgresql/manifests/init.pp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules') diff --git a/modules/postgresql/manifests/init.pp b/modules/postgresql/manifests/init.pp index 5e758dbd..9b9e3b18 100644 --- a/modules/postgresql/manifests/init.pp +++ b/modules/postgresql/manifests/init.pp @@ -67,4 +67,13 @@ class postgresql { content => template("postgresql/pg_ident.conf"), require => Package["postgresql-server"], } + + define user($password) { + $sql = "CREATE ROLE $name ENCRYPTED PASSWORD '$password' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;" + + exec { "psql -U postgres -c \"$sql\" ": + user => root, + unless => "psql -A -t -U postgres -c '\du $name' | grep '$name'", + } + } } -- cgit v1.2.1