From ddf6b5a54c67a7e01cf6243bdb2f0b1b254b4940 Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Thu, 19 Sep 2024 06:51:53 +0530 Subject: [PATCH] Postgres: Pinned a version so that watchdog does not upgrade versions. Made the host directory configurable --- postgres/playbook.yml | 10 ++++++++-- postgres/vars/default.yml | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) 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