I've recently published an Ansible playbook for deploying a PostgreSQL high-availability cluster powered by Patroni, with all the essential components included. It's a ready-to-go setup for development and testing environments.
π§ Whatβs inside:
- PostgreSQL 16 with Patroni for automatic failover
- etcd for distributed state management
- PgBouncer for connection pooling
- HAProxy for routing between master and replicas
- Keepalived for floating Virtual IP
- Node Exporter + Postgres Exporter for monitoring
π§© Architecture:
Client β Keepalived VIP β HAProxy β PgBouncer β PostgreSQL
π The setup is simple: define your servers in inventory.ini, set a few variables, and run make up. In just a few minutes, youβll have a fully working Patroni cluster ready for testing or experimentation.
β οΈ Disclaimer: This is a dev/test configuration. Donβt use it in production without proper hardening (passwords, TLS, firewalls, limited SSH, etc).
π GitHub: https://github.com/rom8726/ansible-patroni
Top comments (0)