57 |
require => Package["postgresql-server"], |
require => Package["postgresql-server"], |
58 |
} |
} |
59 |
|
|
60 |
|
# TODO use augeas to manage this file once augeas 0.7.4 is installed |
61 |
|
# on our server, as this would allow use to autodeclare database in it without |
62 |
|
# much trouble |
63 |
file { 'pg_hba.conf': |
file { 'pg_hba.conf': |
64 |
path => "$pgsql_data/pg_hba.conf", |
path => "$pgsql_data/pg_hba.conf", |
65 |
ensure => present, |
ensure => present, |
80 |
require => Package["postgresql-server"], |
require => Package["postgresql-server"], |
81 |
} |
} |
82 |
|
|
83 |
|
# TODO add a system of tag so we can declare database on more than one |
84 |
|
# server |
85 |
Postgresql::User <<| |>> |
Postgresql::User <<| |>> |
86 |
Postgresql::Database <<| |>> |
Postgresql::Database <<| |>> |
87 |
} |
} |
94 |
unless => "psql -A -t -U postgres -l | grep '^$name|'", |
unless => "psql -A -t -U postgres -l | grep '^$name|'", |
95 |
} |
} |
96 |
} |
} |
97 |
|
|
98 |
|
# TODO convert to a regular type, so we can later change password without erasing the |
99 |
|
# current user |
100 |
define user($password) { |
define user($password) { |
101 |
$sql = "CREATE ROLE $name ENCRYPTED PASSWORD '\$pass' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;" |
$sql = "CREATE ROLE $name ENCRYPTED PASSWORD '\$pass' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;" |
102 |
|
|