Skip to content

Instantly share code, notes, and snippets.

@kietdlam
Created January 6, 2014 09:05
Show Gist options
  • Save kietdlam/8280086 to your computer and use it in GitHub Desktop.
Save kietdlam/8280086 to your computer and use it in GitHub Desktop.
include_recipe "database::postgresql"
postgresql_connection_info = {
:host => '127.0.0.1',
:port => 5432,
:username => 'postgres',
:password => node['postgresql']['password']['postgres']
}
# Do the same but pass the provider to the database resource
database_user 'ktklam9' do
connection postgresql_connection_info
password 'ktklam9'
provider Chef::Provider::Database::PostgresqlUser
action :create
end
postgresql_database_user 'ktklam9' do
connection postgresql_connection_info
password 'ktklam9'
action :grant
end
# restart the cluster to pick up changes
service 'postgresql' do
supports :restart => true
action :restart
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment