Ansible Playbook for PostgreSQL Patroni Cluster

Ansible Playbook for PostgreSQL Patroni Cluster

Publish Date: Jul 9
0 0

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

Comments 0 total

    Add comment