Initial commit
Some checks failed
Ansible Playbook lint & deploy / ansible-lint (push) Successful in 12s
Ansible Playbook lint & deploy / run-ansible-mongo (push) Failing after 6s
Ansible Playbook lint & deploy / run-ansible-postgres (push) Failing after 7s

This commit is contained in:
2024-12-03 00:56:20 +00:00
commit 32d815621d
29 changed files with 465 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
---
- name: Set username and password
ansible.builtin.set_fact:
database: "{{ postgres_users_database }}"
username: "{{ postgres_users_username }}"
password: "{{ postgres_users_password }}"
- name: Create DB, role, and privs
become: true
become_user: postgres
block:
- name: Create database
community.postgresql.postgresql_db:
name: "{{ database }}"
- name: Create user
community.postgresql.postgresql_user:
db: "{{ database }}"
name: "{{ username }}"
password: "{{ password }}"
environment:
PGOPTIONS: "-c password_encryption=scram-sha-256"
- name: Configure privileges
community.postgresql.postgresql_privs:
db: "{{ database }}"
role: "{{ username }}"
privs: ALL
objs: ALL_IN_SCHEMA