Manage the creation/removal of postgresql databases on one or multiple database servers https://www.postgresql.org
Go to file
Andrea Dell'Amico 1c9f8f36a1
Hashing method configurable.
2024-05-13 18:00:17 +02:00
defaults Optionally print the psql_db_data. 2024-03-25 13:23:08 +01:00
handlers Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00
meta Fix the metadata. 2023-10-25 16:22:21 +02:00
tasks Hashing method configurable. 2024-05-13 18:00:17 +02:00
tests Initial commit 2020-05-29 15:45:35 +02:00
vars Initial commit 2020-05-29 15:45:35 +02:00
.gitignore Initial commit 2020-05-29 15:45:35 +02:00
LICENSE Initial commit 2020-05-29 15:45:35 +02:00
README.md Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00

README.md

Role Name

A role that manages PostgreSQL databases and their ACLs. extensions can be installed too.

Role Variables

The list of databases and database host. The role is meant to be run using a delegation to the database remote host.

psql_db_data:
  # Example of line needed to create a db, create the user that owns the db, manage the db accesses (used by iptables too). All the fields are mandatory.
  - { db_host: '{{ ansible_fqdn }}', pgsql_version: '{{ psql_version }}', name: '{{ psql_db_name }}', encoding: 'UTF8', user: '{{ psql_db_user }}', pwd: '{{ psql_db_pwd }}', roles: 'NOCREATEDB,NOSUPERUSER', extensions: [ 'postgis', 'pgpool_regclass', 'pgpool_recovery' ], allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ], managedb: True }
  # Example of line needed to manage the db accesses (used by iptables too), without creating the db and the user. Useful, for example, to give someone access to the postgresql db
  - { db_host: '{{ ansible_fqdn }}', pgsql_version: '{{ psql_version }}', name: '{{ psql_db_name }}', user: '{{ psql_db_user }}', allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ], managedb: False }
  # Example of line needed to remove a db, create the user that owns the db, manage the db accesses (used by iptables too). All the fields are mandatory.
  - { db_host: '{{ ansible_fqdn }}', pgsql_version: '{{ psql_version }}', name: '{{ psql_db_name }}', encoding: 'UTF8', user: '{{ psql_db_user }}', pwd: '{{ psql_db_pwd }}', managedb: True, roles: 'NOCREATEDB,NOSUPERUSER', extensions: [ 'postgis', 'pgpool_regclass', 'pgpool_recovery' ], allowed_hosts: [ 'xxx.xxx.xxx.xxx/32', 'yyy.yyy.yyy.yyy/32' ], state=absent }

psql_db_extensions:
  - { db_host: '{{ ansible_fqdn }}',  name: '{{ psql_db_name }}', extensions: [ 'postgis', 'pgpool_regclass', 'pgpool_recovery' ] }

Dependencies

None

License

EUPL-1.2

Author Information

Andrea DellAmico, andrea.dellamico@isti.cnr.it