Update roles/mailarchiver_db/tasks/main.yml

This commit is contained in:
2026-01-29 14:11:11 +01:00
parent ca1dcd5c61
commit c67a1ed2f9

View File

@@ -1,8 +1,7 @@
- name: Ensure PostgreSQL service is running
service:
name: postgresql
state: started
enabled: yes
- name: Wait for PostgreSQL socket
wait_for:
path: "/var/run/postgresql/{{ pg_version }}-{{ pg_cluster }}/.s.PGSQL.5432"
timeout: 60
- name: Create db user
become: true
@@ -10,6 +9,7 @@
postgresql_user:
name: mailuser
password: "{{ mailuser_password }}"
login_host: "/var/run/postgresql/{{ pg_version }}-{{ pg_cluster }}/.s.PGSQL.5432"
- name: Create database
become: true
@@ -17,12 +17,15 @@
postgresql_db:
name: mailarchiver
owner: mailuser
login_host: "/var/run/postgresql/{{ pg_version }}-{{ pg_cluster }}/.s.PGSQL.5432"
- name: Grant schema rights
become: true
become_user: postgres
postgresql_query:
db: mailarchiver
query: |
GRANT ALL ON SCHEMA public TO mailuser;
ALTER DEFAULT PRIVILEGES IN SCHEMA public
GRANT ALL ON TABLES TO mailuser;
GRANT ALL ON TABLES TO mailuser;
login_host: "/var/run/postgresql/{{ pg_version }}-{{ pg_cluster }}/.s.PGSQL.5432"