add nextcloud stack using NFS and remote postgres db

This commit is contained in:
Pim Kunis 2023-06-10 13:09:31 +02:00
parent 2e08a505bd
commit 00a74415cf
11 changed files with 128 additions and 13 deletions

View file

@ -0,0 +1,4 @@
- name: restart postgres
systemd:
name: postgresql
state: restarted

View file

@ -0,0 +1,36 @@
- name: Create database user
postgresql_user:
name: swarm
password: "{{ database_password }}"
become: true
become_user: postgres
- name: Create database
postgresql_db:
name: "{{ database_name }}"
owner: swarm
become: true
become_user: postgres
- name: Grant access to database
postgresql_privs:
type: database
database: "{{ database_name }}"
role: swarm
grant_option: no
privs: all
become: true
become_user: postgres
notify: restart postgres
- name: Allow remote access to database
postgresql_pg_hba:
dest: /etc/postgresql/15/main/pg_hba.conf
contype: host
databases: "{{ database_name }}"
users: swarm
address: all
create: true
become: true
become_user: postgres
notify: restart postgres