Add proper PostgreSQL versioning

This commit is contained in:
Joshua Boniface 2023-09-01 15:42:28 -04:00
parent 773fd5a9d4
commit 1838f8ff56
2 changed files with 7 additions and 5 deletions

View File

@ -7,6 +7,7 @@
- python-kazoo - python-kazoo
- patroni - patroni
- postgresql-11 - postgresql-11
postgresql_version: 11
when: debian_version|int <= 10 when: debian_version|int <= 10
- set_fact: - set_fact:
@ -15,6 +16,7 @@
- python3-kazoo - python3-kazoo
- patroni - patroni
- postgresql - postgresql
postgresql_version: 13
when: debian_version|int >= 11 when: debian_version|int >= 11
- name: install patroni packages via apt - name: install patroni packages via apt
@ -29,8 +31,8 @@
state: stopped state: stopped
enabled: no enabled: no
with_items: with_items:
- postgresql - "postgresql"
- postgresql@11-main - "postgresql@{{ postgresql_version }}-main"
when: newhost is defined and newhost when: newhost is defined and newhost
- name: remove obsolete database directories - name: remove obsolete database directories
@ -38,8 +40,8 @@
dest: "{{ item }}" dest: "{{ item }}"
state: absent state: absent
with_items: with_items:
- /etc/postgresql/11 - "/etc/postgresql/{{ postgresql_version }}"
- /var/lib/postgresql/11 - "/var/lib/postgresql/{{ postgresql_version }}"
when: newhost is defined and newhost when: newhost is defined and newhost
- name: create patroni database directory - name: create patroni database directory

View File

@ -49,7 +49,7 @@ postgresql:
log_destination: 'stderr' log_destination: 'stderr'
log_min_messages: INFO log_min_messages: INFO
custom_conf: /etc/postgresql/postgresql.pvc.conf custom_conf: /etc/postgresql/postgresql.pvc.conf
bin_dir: /usr/lib/postgresql/11/bin bin_dir: /usr/lib/postgresql/{{ postgresql_version }}/bin
data_dir: /var/lib/postgresql/patroni/pvc data_dir: /var/lib/postgresql/patroni/pvc
pgpass: /tmp/pgpass pgpass: /tmp/pgpass
authentication: authentication: