rom8726

rom8726 

Passionate about developing developer tools

0subscribers

3posts

Ansible Playbook for PostgreSQL Patroni Cluster

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: rom8726/ansible-patroni
---
Недавно я собрал и выложил Ansible playbook для развёртывания кластера PostgreSQL с Patroni. Это полноценное решение для создания отказоустойчивого кластера из трёх узлов, включая всё необходимое:
🔧 Что входит:
- PostgreSQL 16 + Patroni — управление HA и failover'ом
etcd — хранение состояния кластера
PgBouncer — пул соединений
HAProxy — балансировка между мастером и репликами
Keepalived — виртуальный IP для failover'а
Node Exporter и Postgres Exporter — мониторинг
🧩 Архитектура:
Клиент → VIP (Keepalived) → HAProxy → PgBouncer → PostgreSQL
📦 Всё автоматизировано: достаточно указать IP-адреса серверов, выполнить make up — и через несколько минут у вас полноценный кластер. Подходит для разработки и тестов.
⚠️ Важно: конфигурация ориентирована на dev/test окружения. Для продакшена требуется донастройка безопасности (пароли, SSL, firewall и т.п.).
👉 GitHub: rom8726/ansible-patroni
Go up