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
|
2016-03-07 19:24:13 +01:00
|
|
|
postgresql_user: user={{ item.user }} password={{ item.pwd }} role_attr_flags={{ item.roles }} port={{ psql_db_port }}
|
2016-03-02 16:44:43 +01:00
|
|
|
with_items: '{{ psql_db_data }}'
|
2016-06-09 16:47:45 +02:00
|
|
|
when: 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
|
2016-03-07 19:24:13 +01:00
|
|
|
postgresql_db: db={{ item.name }} port={{ psql_db_port }} encoding={{ item.encoding }} owner={{ item.user }} template=template0 state=present
|
2016-03-02 16:44:43 +01:00
|
|
|
with_items: '{{ psql_db_data }}'
|
2016-06-09 16:47:45 +02:00
|
|
|
when: ( item.createdb is not defined or item.createdb )
|
|
|
|
tags: [ 'postgresql', 'postgres', 'pg_db' ]
|
|
|
|
|
|
|
|
- name: Only set a db user password. Mostly for the postgresql user
|
|
|
|
become: True
|
|
|
|
become_user: postgres
|
|
|
|
postgresql_user: user={{ item.user }} password={{ item.pwd }} port={{ psql_db_port }}
|
|
|
|
with_items: '{{ psql_db_data }}'
|
2015-05-28 11:32:57 +02:00
|
|
|
when:
|
2016-06-09 16:47:45 +02:00
|
|
|
- item.pwd is defined
|
|
|
|
- item.roles is not defined
|
2016-01-25 18:11:43 +01:00
|
|
|
tags: [ 'postgresql', 'postgres', 'pg_db' ]
|
2016-03-07 17:43:37 +01:00
|
|
|
|