diff --git a/postgres/playbook.yml b/postgres/playbook.yml index 21c8725..a22633b 100755 --- a/postgres/playbook.yml +++ b/postgres/playbook.yml @@ -14,6 +14,12 @@ source: pull force_source: yes + - name: Ensure Nextcloud Directory exists + file: + path: "/var/lib/{{ host_directory }}" + state: directory + mode: 0755 + - name: Create postgres container docker_container: name: "{{ postgres_name }}" @@ -24,8 +30,8 @@ POSTGRES_USER: "{{ pg_user }}" POSTGRES_PASSWORD: "{{ pg_password }}" POSTGRES_DB: 'postgres' - PGDATA: '/var/lib/postgresql/data/pgdata' + PGDATA: "{{ data_location }}/pgdata" published_ports: - 5432:5432 volumes: - - /var/lib/postgresql/data:/var/lib/postgresql/data + - "/var/lib/{{ host_directory }}/data:{{ data_location }}" diff --git a/postgres/vars/default.yml b/postgres/vars/default.yml index d2acea3..3e08a3f 100644 --- a/postgres/vars/default.yml +++ b/postgres/vars/default.yml @@ -1,7 +1,8 @@ --- postgres_name: postgres -postgres_image: postgres:alpine +postgres_image: postgres:16-alpine pg_user: postgres pg_password: '123456' data_location: /var/lib/postgresql/data +host_directory: postgresql \ No newline at end of file