lab-ansible/roles/postgresql/tasks/database.yml

25 lines
670 B
YAML
Raw Normal View History

2023-11-26 16:37:17 +00:00
# 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 }}"
2023-12-24 23:58:55 +00:00
type: database
2023-11-26 16:37:17 +00:00
privs: ALL
state: present