PostgreSQL Playbooks¶
The postgres playbooks operate the PostgreSQL databases shared across the network. A database can back any component (Fabric CA, committer, Block Explorer), so every playbook here targets all and selects hosts by inventory variable rather than by group.
Playbooks flow¶
flowchart LR
CRYPTO[generate_crypto] --> CONFIGS[configs]
CONFIGS --> START[start]
START --> PING[ping]
PING --> STOP[stop]
STOP --> TEARDOWN[teardown]
TEARDOWN --> WIPE[wipe]
generate_crypto.yaml¶
generate_crypto.yaml generates TLS crypto material for every PostgreSQL database in the inventory: cryptogen transfer or Fabric CA enrollment depending on inventory configuration. The Fabric CA databases generate their own crypto directly (see fabric_ca_server.generate_crypto) so it can run before a Fabric CA server exists to enroll against; running this playbook too is harmless, since it is a no-op for hosts whose crypto already exists.
ansible-playbook hyperledger.fabricx.postgres.generate_crypto --extra-vars '{"target_hosts": "all"}'
Properties:
- Target hosts:
allby default. Usetarget_hoststo restrict to a subset. - Nuance: only hosts that define
postgres_portparticipate. Hosts enrolling through Fabric CA require a reachable, already-started Fabric CA server.
configs.yaml¶
configs.yaml transfers PostgreSQL configuration files (mTLS pg_hba.conf rules, Kubernetes ConfigMaps) for every database in the inventory.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
start.yaml¶
start.yaml starts every PostgreSQL database in the inventory in a single pass, ahead of the components that depend on them. Run it before starting the committer or the Block Explorer.
Properties:
- Target hosts:
allby default. Usetarget_hoststo restrict to a subset. - Nuance: only hosts that define
postgres_portparticipate; every other host is skipped. This lets one playbook serve Fabric CA, committer, and Block Explorer databases regardless of which groups they live in.
stop.yaml¶
stop.yaml stops every PostgreSQL database in the inventory. Run it after stopping the components that depend on them.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
teardown.yaml¶
teardown.yaml removes runtime state for every PostgreSQL database in the inventory. Run it after tearing down the components that depend on them and before removing container networks.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
wipe.yaml¶
wipe.yaml removes all PostgreSQL artifacts, including generated configuration and crypto, from every database host in the inventory.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
ping.yaml¶
ping.yaml checks that every PostgreSQL database port in the inventory is reachable. Run it before pinging the components that depend on them.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
fetch_crypto.yaml¶
fetch_crypto.yaml fetches every PostgreSQL database's crypto material into the configured artifacts directory for inspection, reuse, or debugging.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.
fetch_logs.yaml¶
fetch_logs.yaml fetches every PostgreSQL database's logs from targeted hosts into the configured output directory.
Properties:
- Target hosts:
allby default. - Nuance: only hosts that define
postgres_portparticipate.