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