Ansible Role postgresql_server
This role installs and configures a PostgreSQL server.
Mandatory Requirements
Install the
python3-psycopg2
library. This can be done using the linuxfabrik.lfops.python role.
If you use the postgresql_server Playbook, this is automatically done for you.
Optional Requirements
Enable the official PostgreSQL Yum Repository. This can be done using the linuxfabrik.lfops.repo_postgresql role.
If you use the postgresql_server Playbook, this is automatically done for you.
Optional Role Variables
Variable |
Description |
Default Value |
---|---|---|
|
List of IP address(es) to listen on. Use |
|
|
Determines the maximum number of concurrent connections to the database server. |
|
|
Determines the algorithm to use to encrypt passwords when creating new users / roles. Possible options:
|
|
|
The TCP port the server listens on. |
|
|
List of dictionaries of databases to create. Subkeys:
host_vars / group_vars (can only be used in one group at a time). |
|
|
Enables or disables the service, analogous to |
|
|
List of host based authentication entries. Subkeys:
|
Allow |
|
List of dictionaries containing PostgreSQL privileges to apply. Subkeys:
host_vars / group_vars (can only be used in one group at a time). |
|
|
Changes the state of the service, analogous to
|
|
|
List of dictionaries of users to create . Subkeys:
host_vars / group_vars (can only be used in one group at a time). |
|
|
Specifies the PostgreSQL verison to install (use only the major version number like |
|
Example:
# optional
postgresql_server__conf_listen_addresses:
- 'localhost'
postgresql_server__conf_max_connections: 100
postgresql_server__conf_password_encryption: 'scram-sha-256'
postgresql_server__conf_port: 5432
postgresql_server__databases__host_var:
- name: 'database1'
owner: 'user1'
state: 'present'
postgresql_server__enabled: true
postgresql_server__pg_hba_entries:
- type: 'local'
database: 'all'
user: 'all'
- type: 'host'
database: 'all'
user: 'all'
postgresql_server__state: 'started'
postgresql_server__users__host_var:
- username: 'user1'
password: 'linuxfabrik'
state: 'present'
postgresql_server__version: '14'