lab-ansible/roles/postgresql/tasks/database.yml
2024-03-02 22:36:05 +01:00

25 lines
618 B
YAML

# vim: ft=yaml.ansible
# code: language=ansible
---
- name: Create database user '{{ app.user }}'
community.postgresql.postgresql_user:
name: "{{ app.user }}"
password: "{{ app.password }}"
state: present
- name: Create database '{{ app.db }}'
community.postgresql.postgresql_db:
name: "{{ app.db }}"
owner: postgres
template: template0
encoding: UTF-8
state: present
- name: Grant user all priviliges on database '{{ app.db }}'
community.postgresql.postgresql_privs:
database: "{{ app.db }}"
roles: "{{ app.user }}"
type: database
privs: ALL
state: present