diff options
author | Michael Scherer <misc@mageia.org> | 2010-12-07 02:40:22 +0000 |
---|---|---|
committer | Michael Scherer <misc@mageia.org> | 2010-12-07 02:40:22 +0000 |
commit | 63bbb9f955f13b4950bc36a6e18e90f1d748aec1 (patch) | |
tree | fc4092e7d384f1eeb5391a6d57ec4754544453ba /modules/postgresql/manifests/init.pp | |
parent | a41be4137ccc451a9bf7cd3f0a0f8fc13f6f9d22 (diff) | |
download | puppet-63bbb9f955f13b4950bc36a6e18e90f1d748aec1.tar puppet-63bbb9f955f13b4950bc36a6e18e90f1d748aec1.tar.gz puppet-63bbb9f955f13b4950bc36a6e18e90f1d748aec1.tar.bz2 puppet-63bbb9f955f13b4950bc36a6e18e90f1d748aec1.tar.xz puppet-63bbb9f955f13b4950bc36a6e18e90f1d748aec1.zip |
add a type postgres user, to be able to declare postgresql user in puppet directly
Diffstat (limited to 'modules/postgresql/manifests/init.pp')
-rw-r--r-- | modules/postgresql/manifests/init.pp | 9 |
1 files changed, 9 insertions, 0 deletions
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'", + } + } } |