support schemas

This commit is contained in:
Roman Inflianskas 2015-11-02 09:41:41 +03:00
parent 401912743e
commit 8edafaf7a4
2 changed files with 17 additions and 0 deletions

View file

@ -52,6 +52,9 @@ postgres:
lc_ctype: 'C.UTF-8' lc_ctype: 'C.UTF-8'
lc_collate: 'C.UTF-8' lc_collate: 'C.UTF-8'
# optional extensions to enable on database # optional extensions to enable on database
schemas:
uuid_ossp:
owner: localUser
extensions: extensions:
- uuid-ossp - uuid-ossp
db2: db2:

View file

@ -118,6 +118,20 @@ postgres-db-{{ name }}:
- postgres_user: postgres-user-{{ db.get('user') }} - postgres_user: postgres-user-{{ db.get('user') }}
{% endif %} {% 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 %} {% if db.extensions is defined %}
{% for ext in db.extensions %} {% for ext in db.extensions %}
postgres-ext-{{ ext }}-for-db-{{ name }}: postgres-ext-{{ ext }}-for-db-{{ name }}: