OpenSibleOpenSible Stack Hub
← All blueprints

PostgreSQL HA (Patroni + etcd)

OSS

3-node PostgreSQL HA cluster managed by Patroni with an embedded etcd v3 DCS. Installs PostgreSQL from PGDG, runs Patroni from a pinned Python venv, and manages everything via systemd. First node is the initial leader; use 3+ nodes for real HA.

by opensible· ⬇ 0 installs· Databases· v1.0.0· template postgres-patroni

Use in the OpenSible console

Open Infrastructure → Stack Hub Blueprints, switch the source to Cloud hub, then pick PostgreSQL HA (Patroni + etcd) and press Use.

Requirements

  • ansible >=2.14

Default variables

defaults.json
{
  "ttl": 30,
  "nodes": [
    {
      "ip": "",
      "name": "pg-1",
      "ssh_port": "",
      "ssh_user": ""
    },
    {
      "ip": "",
      "name": "pg-2",
      "ssh_port": "",
      "ssh_user": ""
    },
    {
      "ip": "",
      "name": "pg-3",
      "ssh_port": "",
      "ssh_user": ""
    }
  ],
  "become": true,
  "pg_port": 5432,
  "loop_wait": 10,
  "wal_level": "replica",
  "cluster_id": "opensible-pg",
  "pg_version": "16",
  "etcd_version": "3.5.16",
  "open_firewall": true,
  "retry_timeout": 10,
  "etcd_peer_port": 2380,
  "listen_address": "0.0.0.0",
  "shared_buffers": "256MB",
  "max_connections": 200,
  "patroni_version": "3.3.2",
  "etcd_client_port": 2379,
  "ssh_port_default": 22,
  "ssh_user_default": "root",
  "synchronous_mode": false,
  "patroni_rest_port": 8008,
  "maximum_lag_on_failover": 1048576
}

vars.example.yml

vars.example.yml
# Example variables for postgres-patroni.
# Fill superuser_password and replication_password before running.
cluster_id: opensible-pg
pg_version: "16"
ssh_user_default: root
ssh_port_default: 22
nodes:
  - { name: pg-1, ip: 10.0.0.11, ssh_user: root, ssh_port: 22 }
  - { name: pg-2, ip: 10.0.0.12, ssh_user: root, ssh_port: 22 }
  - { name: pg-3, ip: 10.0.0.13, ssh_user: root, ssh_port: 22 }
listen_address: 0.0.0.0
pg_port: 5432
patroni_rest_port: 8008
etcd_client_port: 2379
etcd_peer_port: 2380
superuser_password: change-me-strong
replication_password: change-me-strong
rewind_password: ""
synchronous_mode: false
maximum_lag_on_failover: 1048576
ttl: 30
loop_wait: 10
retry_timeout: 10
max_connections: 200
shared_buffers: 256MB
wal_level: replica
extra_hba: |
  # host    all    all    10.0.0.0/8    scram-sha-256
etcd_version: 3.5.16
patroni_version: 3.3.2
open_firewall: true
become: true

Versions (1)

  • v1.0.0playbook.yml