pvc-ansible/roles/pvc/templates/patroni/patroni.yml.j2

88 lines
2.5 KiB
Django/Jinja

scope: pvc
namespace: /patroni/
name: {{ ansible_hostname }}
restapi:
listen: {% for node in pvc_nodes if node.hostname == this_node %}'{{ node.cluster_ip }}:8008'{% endfor %}
connect_address: {% for node in pvc_nodes if node.hostname == this_node %}'{{ node.cluster_ip }}:8008'{% endfor %}
zookeeper:
hosts: [ {% for node in pvc_nodes if node.is_coordinator %}"{{ node.cluster_ip }}:2181"{% if not loop.last %},{% endif %}{% endfor %} ]
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
parameters:
{% if debian_version|int >= 12 %}
wal_keep_size: 64
{% else %}
wal_keep_segments: 64
{% endif %}
max_wal_senders: 8
max_replication_slots: 8
initdb:
- encoding: UTF8
- data-checksums
pg_hba:
- local all all peer
- host replication replicator 127.0.0.1/32 trust
{% for node in pvc_nodes if node.is_coordinator %}
- host replication replicator {{ node.cluster_ip }}/32 trust
{% endfor %}
- host all all 0.0.0.0/0 md5
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: '0.0.0.0:5432'
connect_address: {% for node in pvc_nodes if node.hostname == this_node %}'{{ node.cluster_ip }}:5432'
{% endfor %}
log_destination: 'stderr'
log_min_messages: INFO
custom_conf: /etc/postgresql/postgresql.pvc.conf
bin_dir: /usr/lib/postgresql/{{ postgresql_version }}/bin
data_dir: /var/lib/postgresql/patroni/pvc
pgpass: /tmp/pgpass
authentication:
replication:
username: '{{ pvc_replication_database_user }}'
password: '{{ pvc_replication_database_password }}'
superuser:
username: '{{ pvc_superuser_database_user }}'
password: '{{ pvc_superuser_database_password }}'
parameters:
unix_socket_directories: '/run/postgresql'
{% if debian_version|int >= 12 %}
wal_keep_size: 64
{% else %}
wal_keep_segments: 64
{% endif %}
max_wal_senders: 8
max_replication_slots: 8
pg_hba:
- local all all peer
- host replication replicator 127.0.0.1/32 trust
{% for node in pvc_nodes if node.is_coordinator %}
- host replication replicator {{ node.cluster_ip }}/32 trust
{% endfor %}
- host all all 0.0.0.0/0 md5
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false