Merge pull request #13 from amcnea/master

Updated init.sls to use pillar.get and updated pillar.example
This commit is contained in:
Forrest 2014-07-13 14:18:36 -07:00
commit 90397cf555
2 changed files with 7 additions and 6 deletions

View file

@ -6,6 +6,7 @@
postgres:
lookup:
pkg: postgresql-9.3
pg_hba: '/etc/postgresql/9.3/main/pg_hba.conf'
db:
name: mydb
user: mydb

View file

@ -15,7 +15,7 @@ postgresql:
pg_hba.conf:
file.managed:
- name: {{ postgres.pg_hba }}
- source: {{ pillar['postgres']['pg_hba.conf'] }}
- source: {{ salt['pillar.get']('postgres:pg_hba.conf', 'salt://postgres/pg_hba.conf') }}
- template: jinja
- user: postgres
- group: postgres
@ -29,21 +29,21 @@ pg_hba.conf:
{% if 'db' in pillar.get('postgres', {}) %}
postgres-app-user:
postgres_user.present:
- name: {{ pillar['postgres']['db']['user'] }}
- createdb: {{ pillar['postgres']['db']['createdb'] }}
- password: {{ pillar['postgres']['db']['password'] }}
- name: {{ salt['pillar.get']('postgres:db:user', 'myuser') }}
- createdb: {{ salt['pillar.get']('postgres:db:createdb', False) }}
- password: {{ salt['pillar.get']('postgres:db:password', 'mypass') }}
- runas: postgres
- require:
- service: {{ postgres.service }}
postgres-app-db:
postgres_database.present:
- name: {{ pillar['postgres']['db']['name'] }}
- name: {{ salt['pillar.get']('postgres:db:name', 'mydb') }}
- encoding: UTF8
- lc_ctype: en_US.UTF8
- lc_collate: en_US.UTF8
- template: template0
- owner: {{ pillar['postgres']['db']['user'] }}
- owner: {{ salt['pillar.get']('postgres:db:user', 'myuser') }}
- runas: postgres
- require:
- postgres_user: postgres-app-user