add nextcloud stack using NFS and remote postgres db
This commit is contained in:
parent
2e08a505bd
commit
00a74415cf
11 changed files with 128 additions and 13 deletions
4
ansible/roles/database/handlers/main.yml
Normal file
4
ansible/roles/database/handlers/main.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: restart postgres
|
||||
systemd:
|
||||
name: postgresql
|
||||
state: restarted
|
36
ansible/roles/database/tasks/main.yml
Normal file
36
ansible/roles/database/tasks/main.yml
Normal 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
|
Reference in a new issue