Files
learn-devops/ansible/roles/patroni/templates/config.yml.j2
github-actions[bot] f8fe304cd9 patroni-postgresql-cluster (#13)
* Описана инфрастуктура кластера

* Добавлена роль etcd

* Добавлена роль haproxy

* Добавлена роль keepalived

* Добавлена роль ntp_install

* Добавлена роль patroni

* Добавлена групповые переменные

---------

Co-authored-by: Fedor Batonogov <f.batonogov@yandex.ru>
2024-06-18 10:37:21 +03:00

83 lines
2.3 KiB
Django/Jinja

scope: patroni
name: {{ inventory_hostname }}
restapi:
listen: 0.0.0.0:8008
connect_address: {{ inventory_hostname }}:8008
etcd:
host: {{ inventory_hostname }}:2379
bootstrap:
# this section will be written into Etcd:/<namespace>/<scope>/config after initializing new cluster
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
# master_start_timeout: 300
# synchronous_mode: false
postgresql:
use_pg_rewind: true
use_slots: true
parameters:
wal_level: replica
hot_standby: "on"
logging_collector: 'on'
max_wal_senders: 5
max_replication_slots: 5
wal_log_hints: "on"
#archive_mode: "on"
#archive_timeout: 600
#archive_command: "cp -f %p /home/postgres/archived/%f"
#recovery_conf:
#restore_command: cp /home/postgres/archived/%f %p
# some desired options for 'initdb'
initdb: # Note: It needs to be a list (some options need values, others are switches)
- encoding: UTF8
- data-checksums
pg_hba: # Add following lines to pg_hba.conf after running 'initdb'
- host replication replicator 10.0.75.0/24 md5
- host replication replicator 127.0.0.1/32 trust
- host all all 10.0.75.0/24 md5
- host all all 0.0.0.0/0 md5
# - hostssl all all 0.0.0.0/0 md5
# Additional script to be launched after initial cluster creation (will be passed the connection URL as parameter)
# post_init: /usr/local/bin/setup_cluster.sh
# Some additional users users which needs to be created after initializing new cluster
users:
admin:
password: admin
options:
- createrole
- createdb
postgresql:
listen: 0.0.0.0:5432
connect_address: {{ inventory_hostname }}:5432
data_dir: "/var/lib/postgresql/patroni/main"
bin_dir: "/usr/lib/postgresql/16/bin"
# config_dir:
pgpass: /tmp/pgpass0
authentication:
replication:
username: replicator
password: {{ lookup('password', 'secrets/patroni-postgresql/replicator-password length=64') }}
superuser:
username: postgres
password: {{ lookup('password', 'secrets/patroni-postgresql/postgres-password length=64') }}
parameters:
unix_socket_directories: '/var/run/postgresql'
watchdog:
mode: off
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false