25 lines
670 B
YAML
25 lines
670 B
YAML
# vim: ft=yaml.ansible
|
|
# code: language=ansible
|
|
---
|
|
- name: Create database user '{{ db.vars.username }}'
|
|
community.postgresql.postgresql_user:
|
|
name: "{{ db.vars.username }}"
|
|
password: "{{ db.vars.password }}"
|
|
state: present
|
|
|
|
- name: Create database '{{ db.name }}'
|
|
community.postgresql.postgresql_db:
|
|
name: "{{ db.name }}"
|
|
owner: "{{ db.vars.username }}"
|
|
template: template0
|
|
encoding: UTF-8
|
|
state: present
|
|
|
|
- name: Grant all priviliges to owner on database '{{ db.name }}'
|
|
community.postgresql.postgresql_privs:
|
|
database: "{{ db.name }}"
|
|
roles: "{{ db.vars.username }}"
|
|
type: database
|
|
privs: ALL
|
|
state: present
|