diff --git a/roles/pvc/tasks/patroni/main.yml b/roles/pvc/tasks/patroni/main.yml index 6b2ca1c..2c5a7a4 100644 --- a/roles/pvc/tasks/patroni/main.yml +++ b/roles/pvc/tasks/patroni/main.yml @@ -7,6 +7,7 @@ - python-kazoo - patroni - postgresql-11 + postgresql_version: 11 when: debian_version|int <= 10 - set_fact: @@ -15,6 +16,7 @@ - python3-kazoo - patroni - postgresql + postgresql_version: 13 when: debian_version|int >= 11 - name: install patroni packages via apt @@ -29,8 +31,8 @@ state: stopped enabled: no with_items: - - postgresql - - postgresql@11-main + - "postgresql" + - "postgresql@{{ postgresql_version }}-main" when: newhost is defined and newhost - name: remove obsolete database directories @@ -38,8 +40,8 @@ dest: "{{ item }}" state: absent with_items: - - /etc/postgresql/11 - - /var/lib/postgresql/11 + - "/etc/postgresql/{{ postgresql_version }}" + - "/var/lib/postgresql/{{ postgresql_version }}" when: newhost is defined and newhost - name: create patroni database directory diff --git a/roles/pvc/templates/patroni/patroni.yml.j2 b/roles/pvc/templates/patroni/patroni.yml.j2 index a75cefa..7016cbc 100644 --- a/roles/pvc/templates/patroni/patroni.yml.j2 +++ b/roles/pvc/templates/patroni/patroni.yml.j2 @@ -49,7 +49,7 @@ postgresql: log_destination: 'stderr' log_min_messages: INFO 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 pgpass: /tmp/pgpass authentication: