Ansible collection for database-related roles
https://galaxy.ansible.com/ui/repo/published/devxy/database/
- Jinja 92.3%
- Just 7.4%
- JavaScript 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .crow | ||
| .gitsv | ||
| ansibledoctor/templates/readme | ||
| meta | ||
| roles | ||
| .ansible-lint | ||
| .ansibledoctor.yaml | ||
| .editorconfig | ||
| .editorconfig-checker.json | ||
| .gitignore | ||
| .markdownlint-cli2.yaml | ||
| .markdownlint.yaml | ||
| .pre-commit-config.yaml | ||
| .yamllint.yaml | ||
| commitlint.config.mjs | ||
| galaxy.yml | ||
| Justfile | ||
| README.md | ||
| renovate.json | ||
Ansible Collection "database"
Ansible collection for deploying and managing PostgreSQL database infrastructure.
Roles
| Role | Description |
|---|---|
| postgres | Deploy PostgreSQL with Docker using pgautoupgrade for automatic version upgrades |
| pgbouncer | Deploy PgBouncer connection pooler with optimized defaults |
| pgdog | Deploy PgDog connection pooler and query router (drop-in sibling of pgbouncer) |
| pgbackrest | Install and configure pgBackRest for PostgreSQL backup management |
Installation
ansible-galaxy collection install devxy.database
Usage
requirements.yml:
collections:
- name: devxy.database
version: ">=0.1.0"
Deploy PostgreSQL with Connection Pooling
- name: Deploy database infrastructure
hosts: database_servers
roles:
# Deploy PostgreSQL
- role: devxy.database.postgres
postgres_password: "{{ vault_postgres_password }}"
postgres_databases:
- name: myapp
owner: myapp_user
postgres_users:
- name: myapp_user
password: "{{ vault_myapp_password }}"
database: myapp
privileges: ALL
postgres_networks:
- name: database_net
# Deploy PgBouncer for connection pooling
- role: devxy.database.pgbouncer
pgbouncer_databases:
- name: myapp
host: postgres
port: 5432
pgbouncer_users:
- name: myapp_user
password: "{{ vault_myapp_password }}"
pgbouncer_networks:
- name: database_net
Deploy PostgreSQL with PgDog (read/write split)
PgDog is a drop-in alternative to PgBouncer. Swap the role name and the
pgbouncer_* variable prefix for pgdog_*; PgDog listens on the same port
(6432) and additionally load-balances reads across replicas.
- name: Deploy database infrastructure with PgDog
hosts: database_servers
roles:
- role: devxy.database.postgres
postgres_password: "{{ vault_postgres_password }}"
postgres_networks:
- name: database_net
- role: devxy.database.pgdog
pgdog_databases:
- name: myapp
host: postgres
port: 5432
role: primary
pgdog_users:
- name: myapp_user
database: myapp
password: "{{ vault_myapp_password }}"
pgdog_networks:
- name: database_net
Deploy PostgreSQL with Backup
- name: Deploy PostgreSQL with backup
hosts: database_servers
roles:
- role: devxy.database.postgres
postgres_password: "{{ vault_postgres_password }}"
- role: devxy.database.pgbackrest
pgbackrest_is_pg_host: true
pgbackrest_stanza: main
pgbackrest_repo_path: /var/lib/pgbackrest
Documentation
Refer to the README.md files within each individual role:
- postgres - PostgreSQL deployment with auto-tuned settings
- pgbouncer - Connection pooling with transaction mode
- pgdog - Connection pooling and query routing with read/write split
- pgbackrest - Backup and restore management
License
AGPL-3.0-or-later
No matching headings