Manage the creation/removal of postgresql databases on one or multiple database servers https://www.postgresql.org
Go to file
Andrea Dell'Amico fc9fe846fb
Add a label.
2024-03-28 15:26:08 +01: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 Add a label. 2024-03-28 15:26:08 +01: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