30 lines
712 B
YAML
30 lines
712 B
YAML
---
|
|
- name: Add a user for the postgresql DBs
|
|
remote_user: root
|
|
sudo: yes
|
|
sudo_user: postgres
|
|
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
|
|
tags:
|
|
- postgresql
|
|
- postgres
|
|
- pg_db
|
|
|
|
- name: Add the databases with the correct owner
|
|
remote_user: root
|
|
sudo: yes
|
|
sudo_user: postgres
|
|
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
|
|
tags:
|
|
- postgresql
|
|
- postgres
|
|
- pg_db
|
|
|