Ansible collection for database-related roles
https://galaxy.ansible.com/ui/repo/published/devxy/database/
| .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 |
| 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 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
- pgbackrest - Backup and restore management
License
AGPL-3.0-or-later