hachyderm.general.postgresql role – Install and configure PostgreSQL

Note

This role is part of the hachyderm.general collection (version 1.0.0).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it use: ansible-galaxy collection install hachyderm.general.

To use it in a playbook, specify: hachyderm.general.postgresql.

Entry point main – Install and configure PostgreSQL

Synopsis

  • Install and configure PostgreSQL, an open source object-relational database system.

Parameters

Parameter

Comments

postgresql_archive_command

string

Command to archive WAL files.

See archive_command.

postgresql_archive_mode

string

Enable or disable WAL archiving.

Because this mode can only be at server start, it is a good idea to enable it then use an archive command that does nothing so you can change the archive command later without a restart.

See archive_mode.

Choices:

  • "on" ← (default)

  • "off"

postgresql_cluster_name

string

Name of the cluster.

Useful when multiple clusters are deployed on the same server.

Default: "main"

postgresql_data_directory

string

Specifies the directory to use for data storage.

See data_directory.

postgresql_hba_rules

list / elements=string

List of host-based authentication rules.

See The pg_hba.conf File.

Default: ["local all all scram-sha-256      # allow local connections with secure password", "host  all all all scram-sha-256  # allow host (with and without TLS) with secure password"]

postgresql_initdb_args

string

Arguments passed to initdb to create a new cluster.

See initdb.

Default: "-k"

postgresql_instance_role

string

Role of the instance.

Configure replication settings.

This variable does not promote a replica to primary.

Choices:

  • "primary" ← (default)

  • "replica"

postgresql_listen_addresses

list / elements=string

List of addresses PostgreSQL will listen to.

This list will be transformed to a coma separated list by the role.

See listen_addresses.

Default: ["localhost"]

postgresql_log_destination

string

Sets the destination of the logs.

See log_destination.

postgresql_log_directory

string

When postgresql_logging_collector is enabled, this parameter determines the directory in which log files will be created.

See log_directory.

postgresql_log_file_mode

string

On Unix systems this parameter sets the permissions for log files when postgresql_logging_collector is enabled.

See log_file_mode.

postgresql_log_filename

string

When postgresql_logging_collector is enabled, this parameter sets the file names of the created log files.

See log_filename.

postgresql_log_timezone

string

Sets the time zone used for timestamps written in the server log.

See log_timezone.

postgresql_logging_collector

string

Enable or disable the logging collector.

See logging_collector.

Choices:

  • "on" ← (default)

  • "off"

postgresql_manage_pgpass

boolean

Create the .pgpass files for root and postgres or not.

See The Password File.

Choices:

  • false ← (default)

  • true

postgresql_manage_replication

boolean

Configure replication on a replica.

This operation will REMOVE THE DATA DIRECTORY to synchronize with a primary.

Choices:

  • false ← (default)

  • true

postgresql_max_number_of_replicas

integer

Defines max_wal_senders and max_replication_slots.

Default: 10

postgresql_port

integer

The TCP port the server listens on.

Default: 5432

postgresql_primary_host

string

In a replication setup, define where to find the primary host.

postgresql_primary_port

string

In a replication setup, define where to find the primary port.

Default: 5432

postgresql_replication_network

string

IP range of the network used for the replication to allow in the pg_hba.conf to setup the replication.

Default: "127.0.0.1/32"

postgresql_replication_password

string

Password of the replication user.

postgresql_replication_slot_name

string

In a replication setup, define the name of the replication slot.

Default: "{{ inventory_hostname }}"

postgresql_replication_username

string

Name of the replication user.

Default: "repl"

postgresql_restore_command

string

Command to restore WAL files.

See restore_command.

postgresql_service_after

list / elements=string

List of systemd units to wait before starting the service.

postgresql_settings

dictionary

Dictionary of custom settings.

The key is the name of the setting.

The value is the value of the setting.

postgresql_upgrade_drop_cluster

boolean

Once upgraded, remove the old cluster.

Choices:

  • false

  • true ← (default)

postgresql_upgrade_from_version

string

Used to perform major upgrades.

Tell what version the cluster to upgrade is running.

Required for pg_upgrade.

postgresql_upgrade_remove_packages

boolean

Once upgraded, remove the old packages.

Choices:

  • false

  • true ← (default)

postgresql_users

list / elements=dictionary

List of users to create.

The key of the dict in the list must have a name and a password.

The key of the dict in the list can have a list of roles.

postgresql_version

string

Version of the PostgreSQL binaries.

Upgrading this version will deploy a new independent cluster without upgrading one.

See postgresql_upgrade_from_version for upgrades.

Default: 15

postgresql_wal_level

string

Determines how much information is written to the WAL.

See wal_level.

Choices:

  • "replica"

  • "minimal"

  • "logical"

Authors

  • Hachyderm contributors