--- {%- from "postgresql/map.jinja" import postgresql with context %} {%- for database in postgresql.databases %} postgresql-database-{{ database.name }}: postgres_database.present: - name: {{ database.name }} - owner: {{ database.user }} - db_user: postgres - template: template0 - encoding: {{ database.encoding|default("UTF8") }} - lc_collate: {{ database.collate|default("en_US.UTF-8") }} - lc_ctype: {{ database.ctype|default("en_US.UTF-8") }} - db_port: {{ postgresql.config.main.port|default(5432) }} - require: - postgres_user: postgresql-user-{{ database.user }} {% endfor %}