2015-05-28 11:32:57 +02:00
|
|
|
---
|
|
|
|
- name: Add a user for the postgresql DBs
|
2016-01-25 18:11:43 +01:00
|
|
|
become: True
|
|
|
|
become_user: postgres
|
2015-05-28 11:32:57 +02:00
|
|
|
postgresql_user: user={{ item.user }} password={{ item.pwd }} role_attr_flags={{ item.roles }}
|
|
|
|
with_items: psql_db_data
|
|
|
|
when:
|
|
|
|
- psql_db_data is defined
|
|
|
|
- item.roles is defined
|
2016-01-25 18:11:43 +01:00
|
|
|
tags: [ 'postgresql', 'postgres', 'pg_db' ]
|
2015-05-28 11:32:57 +02:00
|
|
|
|
|
|
|
- name: Add the databases with the correct owner
|
2016-01-25 18:11:43 +01:00
|
|
|
become: True
|
|
|
|
become_user: postgres
|
2015-05-28 11:32:57 +02:00
|
|
|
postgresql_db: db={{ item.name }} encoding={{ item.encoding }} owner={{ item.user }} template=template0 state=present
|
|
|
|
with_items: psql_db_data
|
|
|
|
when:
|
|
|
|
- psql_db_data is defined
|
|
|
|
- item.roles is defined
|
2016-01-25 18:11:43 +01:00
|
|
|
tags: [ 'postgresql', 'postgres', 'pg_db' ]
|