Merge pull request #71 from tenso-m/master

Schemas support, better extensions support
This commit is contained in:
Forrest 2015-11-17 11:25:43 -08:00
commit 4f3e1cb8db
2 changed files with 27 additions and 3 deletions

View file

@ -51,9 +51,14 @@ postgres:
template: 'template0'
lc_ctype: 'C.UTF-8'
lc_collate: 'C.UTF-8'
# optional schemas to enable on database
schemas:
uuid_ossp:
owner: localUser
# optional extensions to enable on database
extensions:
- uuid-ossp
uuid-ossp:
schema: uuid_ossp
db2:
owner: 'localUser'
user: 'remoteUser'
@ -62,7 +67,7 @@ postgres:
lc_collate: 'C.UTF-8'
# optional extensions to enable on database
extensions:
- postgis
postgis:
# This section will append your configuration to postgresql.conf.
postgresconf: |
listen_addresses = 'localhost,*'

View file

@ -118,13 +118,32 @@ postgres-db-{{ name }}:
- postgres_user: postgres-user-{{ db.get('user') }}
{% endif %}
{% if db.schemas is defined %}
{% for schema, schema_args in db.schemas.items() %}
postgres-schema-{{ schema }}-for-db-{{ name }}:
postgres_schema.present:
- name: {{ schema }}
- dbname: {{ name }}
{% if schema_args is not none %}
{% for arg, value in schema_args.items() %}
- {{ arg }}: {{ value }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% if db.extensions is defined %}
{% for ext in db.extensions %}
{% for ext, ext_args in db.extensions.items() %}
postgres-ext-{{ ext }}-for-db-{{ name }}:
postgres_extension.present:
- name: {{ ext }}
- user: {{ db.get('runas', 'postgres') }}
- maintenance_db: {{ name }}
{% if ext_args is not none %}
{% for arg, value in ext_args.items() %}
- {{ arg }}: {{ value }}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor%}