https://github.com/aboutbits/ansible-postgresql
Ansible - PostgreSQL Role
https://github.com/aboutbits/ansible-postgresql
ansible ansible-role postgresql
Last synced: about 2 months ago
JSON representation
Ansible - PostgreSQL Role
- Host: GitHub
- URL: https://github.com/aboutbits/ansible-postgresql
- Owner: aboutbits
- Created: 2022-12-21T12:51:13.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-06T14:01:28.000Z (over 2 years ago)
- Last Synced: 2025-01-08T05:53:05.677Z (over 1 year ago)
- Topics: ansible, ansible-role, postgresql
- Language: Shell
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Ansible PostgreSQL Role
PostgreSQL installation role.
## Role Variables
- `postgresql_postgres_password`: The password that should be set for the default postgres user
- `postgresql_backup`: All information related to backups and if they should be enabled or not
- `postgresql_users`: A list of users that should be created.
- `postgresql_databases`: A list of databases including the schemas that should be created.
- `postgresql_privileges`: A list of privileges that should be granted for the different users to the different databases/schemas.
- `postgresql_default_privileges`: A list of privileges that should be set as defaults for the different users to tables/sequences inside the given databases/schemas.
## Example Playbook
```yaml
- hosts: all
tasks:
- ansible.builtin.include_role:
name: ansible-postgresql
vars:
postgresql_postgres_password: xxx
postgresql_users:
- name: acme-user
password: xxx
postgresql_databases:
- name: acme-product
schema: app
owner: acme-user
postgresql_privileges:
- database: acme-product
schema: app
user: acme-user
permissions: WRITE
postgresql_privileges:
- database: acme-product
schema: app
user: acme-reporting
permissions: READ
postgresql_default_privileges:
- database: acme-product
schema: app
user: acme-reporting
owner: acme-product
permissions: READ
postgresql_backup:
enabled: true
cron: 30 03 * * *
directory: /usr/local/share/postgres
```
## Build & Publish
To build and publish the role, visit the GitHub Actions page of the repository and trigger the workflow "Release Package" manually.