From 4a2a60f6bf525ce76e9ec3d2bba6e01f7773732d Mon Sep 17 00:00:00 2001 From: Audrey Roy Date: Thu, 15 May 2014 15:06:04 -0700 Subject: [PATCH] Add creation of user and db for the app. --- postgres/init.sls | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/postgres/init.sls b/postgres/init.sls index 931534f..e0d1c46 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -19,4 +19,25 @@ pg_hba.conf: - group: postgres - mode: 644 - require: - - pkg: {{ postgres.pkg }} \ No newline at end of file + - pkg: {{ postgres.pkg }} + +postgres-app-user: + postgres_user.present: + - name: {{ pillar['postgres']['db']['user'] }} + - createdb: {{ pillar['postgres']['db']['createdb'] }} + - password: {{ pillar['postgres']['db']['password'] }} + - runas: postgres + - require: + - service: {{ postgres.service }} + +postgres-app-db: + postgres_database.present: + - name: {{ pillar['postgres']['db']['name'] }} + - encoding: UTF8 + - lc_ctype: en_US.UTF8 + - lc_collate: en_US.UTF8 + - template: template0 + - owner: {{ pillar['postgres']['db']['user'] }} + - runas: postgres + - require: + - postgres_user: postgres-app-user