Skip to content

Latest commit

 

History

History
165 lines (123 loc) · 5.93 KB

README.md

File metadata and controls

165 lines (123 loc) · 5.93 KB

setup_replication

This Ansible Galaxy Role configures Replication on PostgresSQL or EnterpriseDB Postgres Advanced Server versions: 10, 11, 12, 13 and 14 on instances previously configured.

Requirements

The requirements for this ansible galaxy role are:

  1. Ansible
  2. community.general - utilized when creating aditional users during a Postgres Install. Only on primary nodes.
  3. edb_devops.edb_postgres -> setup_repo - for repository installation
  4. edb_devops.edb_postgres -> install_dbserver - for installation of PostgreSQL/EPAS binaries.
  5. edb_devops.edb_postgres -> init_dbserver - for the initialization of primary server

Role variables

When executing the role via ansible there are three required variables:

  • os

Operating Systems supported are: CentOS7 and RHEL7

  • pg_version

Postgres Versions supported are: 10, 11, 12, 13 and 14

  • pg_type

Database Engine supported are: PG and EPAS

The rest of the variables can be configured and are available in the:

Dependencies

The setup_replication role does not have any dependencies on any other roles.

Example Playbook

Hosts file content

Content of the inventory.yml file:

---
all:
  children:
    primary:
      hosts:
        primary1:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
    standby:
      hosts:
        standby1:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
          upstream_node_private_ip: xxx.xxx.xxx.xxx
          replication_type: synchronous
        standby2:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
          upstream_node_private_ip: xxx.xxx.xxx.xxx
          replication_type: asynchronous

How to include the setup_replication role in your Playbook

Below is an example of how to include the setup_replication role:

---
- hosts: standby
  name: Setup Postgres replication on Instances
  become: true
  gather_facts: true

  collections:
    - edb_devops.edb_postgres

  pre_tasks:
    - name: Initialize the user defined variables
      set_fact:
        pg_version: 14
        pg_type: "PG"

  roles:
    - setup_replication

Defining and adding variables is done in the set_fact of the pre_tasks.

All the variables are available at:

Database engines supported

Community PostgreSQL

Distribution 10 11 12 13 14
CentOS 7
Red Hat Linux 7
RockyLinux 8
Red Hat Linux 8
Ubuntu 20.04 LTS (Focal) - x86_64
Debian 9 (Stretch) - x86_64
Debian 10 (Buster) - x86_64

EnterpriseDB Postgres Advanced Server and PEM

Distribution 10 11 12 13 14
CentOS 7
Red Hat Linux 7
RockyLinux 8
Red Hat Linux 8
Ubuntu 20.04 LTS (Focal) - x86_64
Debian 9 (Stretch) - x86_64
Debian 10 (Buster) - x86_64

Playbook execution examples

# To deploy community Postgres version 13 on CentOS7 hosts with the user centos
# EFM version 4.0
$ ansible-playbook playbook.yml \
  -u centos \
  -i inventory.yml \
  --private-key <key.pem> \
  --extra-vars="pg_version=13 pg_type=PG efm_version=4.0"
# To deploy EPAS version 12 on RHEL8 hosts with the user ec2-user EFM version
# 3.10
$ ansible-playbook playbook.yml \
  -u ec2-user \
  -i inventory.yml \
  --private-key <key.pem> \
  --extra-vars="os=RHEL8 pg_version=12 pg_type=EPAS efm_version=3.10"

License

BSD

Author information

Author: