Manage the creation/removal of postgresql databases on one or multiple database servers https://www.postgresql.org
Go to file
Andrea Dell'Amico c056c76090 Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00
defaults Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00
handlers Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00
meta Management of Postgresql databases and users. 2020-05-29 16:54:22 +02:00
tasks Management of Postgresql databases and users. 2020-05-29 16:54:22 +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