- From: Peter Donald <
>
- To: Chef Mailing List <
>
- Subject: [chef] Postgres user/database/permission LWRPs
- Date: Thu, 6 Dec 2012 16:38:19 +1100
Hi,
I had a look at the database cookbook for the first time today and found it was not an approach I felt comfortable with.
All I wanted to do was create a user, a database and grant some permissions for user on database. And I was only really concerned with postgres. However the cookbook had several mandatory dependencies and seemingly tried to add an abstraction across multiple databases and forced a whole bunch of activity during the compile phase rather than in the converge phase. So I basically rewrote them using the CLI tool rather than relying on a library.
The LWRPs usage looks something like the following (as extracted from [1]).
I am also looking to add an attribtue_driven recipe on top of this in the future. Is this something other people are interested in?
psql_user "myuser" do
host node['fqdn']
port node['postgresql']['config']['port']
admin_username 'postgres'
admin_password node['postgresql']['password']['postgres']
password 'secret'
end
psql_database "mydatabase" do
host node['fqdn']
port node['postgresql']['config']['port']
admin_username 'postgres'
admin_password node['postgresql']['password']['postgres']
owner 'myuser'
template 'template_postgis'
encoding 'DEFAULT'
tablespace 'MyTablespace'
collation 'fr_FR'
connection_limit -1
end
psql_permission "
=> all" do
host node['fqdn']
port node['postgresql']['config']['port']
admin_username 'postgres'
admin_password node['postgresql']['password']['postgres']
username 'myuser'
database 'mydatabase'
permissions ['ALL']
end
[1]
https://github.com/realityforge/chef-psql#usage
--
Cheers,
Peter Donald
- [chef] Postgres user/database/permission LWRPs, Peter Donald, 12/05/2012
Archive powered by MHonArc 2.6.16.