Default variables

PostgreSQL installation, packages

postgresql_upstream

Enable PostgreSQL Global Developmet Group APT repository? More information: https://wiki.postgresql.org/wiki/Apt

postgresql_upstream: False
postgresql_base_packages

List of base PostgreSQL packages to install.

postgresql_base_packages: [ 'postgresql-client', 'python-psycopg2' ]
postgresql_packages

Install additional packages with PostgreSQL.

postgresql_packages: []
postgresql_user

PostgreSQL user account to which Ansible will switch to perform database-related operations. Should be the same on local and remote database servers.

postgresql_user: 'postgres'
postgresql_server

FQDN hostname of the remote PostgreSQL server to use. Role detects if a local server is available and uses it automatically.

postgresql_server: '{{ ansible_local.postgresql.server
                       if (ansible_local|d() and ansible_local.postgresql|d() and
                           ansible_local.postgresql.server|d() and
                           ansible_local.postgresql.server != "localhost")
                       else "" }}'
postgresql_port

Default port number of the PostgreSQL server to use (local or remote).

postgresql_port: '5432'
postgresql_delegate_to

FQDN hostname of the host that will execute Ansible tasks related to the PostgreSQL database and role management. If PostgreSQL server is available locally, host will delegate the tasks to itself automatically.

postgresql_delegate_to: '{{ postgresql_server
                            if (postgresql_server|d() and
                                (postgresql_server != "localhost" or not postgresql_server))
                            else ansible_fqdn }}'
postgresql_password_length

Length of the randomly generated passwords in PostgreSQL database.

postgresql_password_length: '48'

pg_wrapper integration

postgresql_default_database

Name of the database the users should connect to, set as default in /etc/postgresql-common/user_clusters. If the name is *, users will connect to the database with the same name as their login.

postgresql_default_database: '*'
postgresql_default_user_clusters

Default entry specified in /etc/postgresql-common/user_clusters, used by pg_wrapper script to direct users to correct PostgreSQL server. See postgresql_user_clusters for more details.

postgresql_default_user_clusters:

  - user: '*'
    group: '*'
    cluster: '{{ (postgresql_server + ":" + postgresql_port)
                 if (postgresql_server|d() and postgresql_server)
                 else "main" }}'
    database: '{{ postgresql_default_database }}'
postgresql_user_clusters

Custom user/cluster mappings stored in /etc/postgresql-common/user_clusters. See postgresql_user_clusters for more details.

postgresql_user_clusters: []

PostgreSQL roles and databases

postgresql_roles

List of PostgresSQL roles, specified as YAML dicts. See postgresql_roles for more details.

postgresql_roles: []
postgresql_groups

List of PostgreSQL role groups, specified as YAML dicts. See postgresql_groups for more details.

postgresql_groups: []
postgresql_databases

List of PostgreSQL databases, specified as YAML dicts. See postgresql_databases for more details.

postgresql_databases: []
postgresql_pgpass

List of role/password mappings stored in user directories in ~/.pgpass configuration file. See postgresql_pgpass for more details.

postgresql_pgpass: []

Role-dependent configuration

postgresql_apt_preferences_dependent_list

Configuration for debops.apt_preferences role. PostgreSQL from backports will be preferred on specified Debian releases.

postgresql_apt_preferences_dependent_list:

  - package: 'postgresql postgresql-* libpq5'
    backports: [ 'wheezy' ]
    reason: 'Version parity with Debian Jessie'
    role: 'debops.postgresql'