ansible-roles/patroni/templates/patroni.conf.j2

74 lines
2.1 KiB
Django/Jinja

scope: {{ cluster_name }}
name: {{ cluster_name_host }}
restapi:
listen: {{ patroni_restapi_listen }}:{{ patroni_restapi_port }}
connect_address: {{ patroni_restapi_listen }}:{{ patroni_restapi_port }}
etcd:
hosts:
{% for server in groups['etcd'] %}
- {{ hostvars[server]['etcd_host'] }}:{{ etcd_client_port }}
{% endfor %}
bootstrap:
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
postgresql:
use_pg_rewind: true
use_slots: true
parameters:
wal_level: replica
hot_standby: "on"
wal_keep_segment: 8
max_wal_senders: 5
max_relication_slots: 5
checkpoint_timeout: 30
initdb:
- encoding: UTF8
- data-checksums
pg_hba:
- host replication repl 127.0.0.1/32 md5
{% for server in groups['patroni'] %}
- host replication repl {{ hostvars[server]['postgresql_hosts_cluster'] }}/0 md5
{% endfor %}
- host all all 0.0.0.0/0 md5
users:
{{ postgresql_superuser }}:
password: {{ postgresql_superuser_password.stdout }}
options:
- createrole
- createdb
{{ postgresql_replication_user }}:
password: {{ postgresql_replication_password.stdout }}
options:
- replication
postgresql:
listen: {{ postgresql_listen_ips }}:{{ postgresql_port }}
connect_address: {{ postgresql_connect_ip }}:{{ postgresql_port }}
bin_dir: /usr/lib/postgresql/{{ postgresql_version }}/bin/
data_dir: /home/{{ cluster_name_host }}
pgpass: /tmp/{{ cluster_name_host }}-pgpass
authentication:
replication:
username: {{ postgresql_replication_user }}
password: {{ postgresql_replication_password.stdout }}
superuser:
username: {{ postgresql_superuser }}
password: {{ postgresql_superuser_password.stdout }}
parameters:
unix_socket_directories: '/tmp'
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false