support options in extensions

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

View file

@ -51,12 +51,14 @@ postgres:
template: 'template0'
lc_ctype: 'C.UTF-8'
lc_collate: 'C.UTF-8'
# optional extensions to enable on database
# 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'
@ -65,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

@ -133,12 +133,17 @@ postgres-schema-{{ schema }}-for-db-{{ name }}:
{% 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%}