This role is for setting up pgBackRest server. pgBackRest is a backup and recovery tool for Postgres.
Following are the requirements of this role.
- Ansible
edb_devops.edb_postgres
->setup_repo
role for setting the repository on the systems.
System user running pgBackRest commands. Default: pgbackrest
Example:
pgbackrest_user: 'pgbackrest'
System group the pgbackrest user is part of. Default: pgbackrest
Example:
pgbackrest_group: 'pgbackrest'
pgBackRest main configuration file path. Default: /etc/pgbackrest.conf
Example:
pgbackrest_configuration_file: '/etc/pgbackrest.conf'
Path of the pgBackRest lock directory. Default: /var/run/pgbackrest
Example:
pgbackrest_lock_path: '/var/run/pgbackrest'
Path of the pgbackrest home directory. Backup files and archived WAL files are stored in this root directory. Default: /var/lib/pgbackrest
Example:
pgbackrest_home: '/var/lib/pgbackrest'
pgBackRest logging file path. Default: /var/log/pgbackrest/pgbackrest.log
Example:
pgbackrest_log_file: '/var/log/pgbackrest/pgbackrest.log'
Logging level for console logging. Could be off
, error
, warn
, info
, detail
, debug
or trace
.
Default: info
Example:
pgbackrest_log_level_console: 'info'
Logging level for file logging. Could be off
, error
, warn
, info
, detail
, debug
or trace
.
Default: debug
Example:
pgbackrest_log_level_file: 'debug'
Path of the pgBackRest archive repository. Backup files and archived WAL files are stored in this directory.
Default: /var/lib/pgbackrest/backups
Example:
archive_repo_directory: '/var/lib/pgbackrest/backups'
Retention type for full backups. Determines if the value set in repo_retention_full
represents a time period (days)
or number of full backups to keep. Could be count
or time
. Default: count
Example:
repo_retention_full_type: "count"
Number of full backups to keep. Default: 2
Example:
repo_retention_full: 2
Cipher to encrypt the repository. Could be none
or aes-256-cbc
. Default: aes-256-cbc
Example:
repo_cipher_type: 'aes-256-cbc'
Perform backups on a standby instead of the primary. Both primary and standby databases are required to perform a backup,
although a majority of the files will be copied from the standby to reduce load on the primary. Default: n
Example:
backup_standby: "y"
Number of parallel processes used during backup and recovery. Setting too high may impact database performance. Default: 1
Example:
process_max: 1
Restore or backup using checksums instead of timestamps. During a restore, the cluster data are expected to be
present but empty. If they are not empty, the restore will fail. Setting delta:y
will have pgBackRest automatically
determine which files in database cluster directory need to be restored and which can be preserved. It will remove any
unrecognized files to avoid divergent changes.
Default: n
Example:
delta: "y"
File path of pgBackRest main configuration file on all other nodes running pgBackRest. Default: /etc/pgbackrest.conf
Example:
primary_pgbr_config_file: '/etc/pgbackrest.conf'
Name of the postgres instance running on primary node. Default: main
Example:
pg_instance_name: 'main'
This role does not have any dependencies, but packages repositories should have
been configured beforehand with the setup_repo
role.
Content of the inventory.yml
file:
---
all:
children:
pgbackrestserver:
hosts:
pgbackrest1:
ansible_host: xxx.xxx.xxx.xxx
private_ip: xxx.xxx.xxx.xxx
Below is an example of how to include the setup_pgbackrestserver
role:
---
- hosts: pgbackrestserver
name: Deploy pgbackrest servers
become: yes
gather_facts: yes
collections:
- edb_devops.edb_postgres
pre_tasks:
- name: Initialize the user defined variables
set_fact:
pg_version: 14
pg_type: "PG"
repo_cipher_password: "password"
roles:
- setup_repo
- setup_pgbackrestserver
Defining and adding variables is done in the set_fact
of the pre_tasks
.
All of the variables are available at:
BSD
Author:
- Hannah Stoik
- Julien Tachoires
- Vibhor Kumar (Reviewer)
- EDB Postgres
- [email protected] www.enterprisedb.com