2023-11-26 16:37:17 +00:00
|
|
|
# vim: ft=yaml.ansible
|
|
|
|
# code: language=ansible
|
|
|
|
---
|
2024-01-09 20:36:49 +00:00
|
|
|
- name: Create database user '{{ db.vars.username }}'
|
2023-11-26 16:37:17 +00:00
|
|
|
community.postgresql.postgresql_user:
|
2024-01-09 20:36:49 +00:00
|
|
|
name: "{{ db.vars.username }}"
|
|
|
|
password: "{{ db.vars.password }}"
|
2023-11-26 16:37:17 +00:00
|
|
|
state: present
|
|
|
|
|
2024-01-09 20:36:49 +00:00
|
|
|
- name: Create database '{{ db.name }}'
|
2023-11-26 16:37:17 +00:00
|
|
|
community.postgresql.postgresql_db:
|
2024-01-09 20:36:49 +00:00
|
|
|
name: "{{ db.name }}"
|
|
|
|
owner: "{{ db.vars.username }}"
|
2023-11-26 16:37:17 +00:00
|
|
|
template: template0
|
|
|
|
encoding: UTF-8
|
|
|
|
state: present
|
|
|
|
|
2024-01-09 20:36:49 +00:00
|
|
|
- name: Grant all priviliges to owner on database '{{ db.name }}'
|
2023-11-26 16:37:17 +00:00
|
|
|
community.postgresql.postgresql_privs:
|
2024-01-09 20:36:49 +00:00
|
|
|
database: "{{ db.name }}"
|
|
|
|
roles: "{{ db.vars.username }}"
|
2023-12-24 23:58:55 +00:00
|
|
|
type: database
|
2023-11-26 16:37:17 +00:00
|
|
|
privs: ALL
|
|
|
|
state: present
|