Skip to content

Latest commit

 

History

History
201 lines (150 loc) · 4.85 KB

README.md

File metadata and controls

201 lines (150 loc) · 4.85 KB

setup_pgpool2

This role is for installing and configuring PgpoolII. PgpoolII is a connection pooler for PostgreSQL.

Requirements

Following are the requirements of this role.

  1. Ansible
  2. edb_devops.edb_postgres -> setup_repo role for setting the repository on the systems.

Role Variables

When executing the role via ansible these are the required variables:

  • pg_version

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

  • pg_type

Database Engine supported are: PG and EPAS

These and other variables can be assigned in the pre_tasks definition of the section: How to include the setup_pgpool2 role in your Playbook

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

Below is the documentation of the rest of the main variables:

pgpool2_watchdog

Enable PgpoolII High Availability capability when deploying a PgpoolII multi nodes cluster (3, 5 etc..). Default: false

Example:

pgpool2_watchdog: true

pgpool2_vip

Thie is the virtual IP address to put on the Pgpool2 primary node when deploying a PgpoolII multi node cluster. Watchdog feature must be enabled. Default: empty.

Example:

pgpool2_vip: "10.0.0.123"

pgpool2_vip_dev

System's network device to attach the virtual IP address. Default: empty.

Example:

pgpool2_vip_dev: "eth0"

pgpool2_load_balancing

Enable read only queries load balancing across all the Postgres nodes. Default: true.

Example:

pgpool_load_balancing: true

pgpool2_ssl

Enable SSL support. Default: true.

Example:

pgpool2_ssl: true

pgpool2_port

Pgpool2 listening TCP port. Default: 9999.

Example:

pgpool2_port: 5433

Dependencies

This role does not have any dependencies, but packages repositories should have been configured beforehand with the setup_repo role.

Example Playbook

Inventory file content

Content of the inventory.yml file:

---
all:
  children:
    pgpool2:
      hosts:
        pool1:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
          # Private IP address of the PG primary node
          primary_private_ip: xxx.xxx.xxx.xxx
        pool2:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
          # Private IP address of the PG primary node
          primary_private_ip: xxx.xxx.xxx.xxx
        pool3:
          ansible_host: xxx.xxx.xxx.xxx
          private_ip: xxx.xxx.xxx.xxx
          # Private IP address of the PG primary node
          primary_private_ip: xxx.xxx.xxx.xxx
    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_pgpool2 role in your Playbook

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

---
- hosts: pgpool2
  name: Deploy PgpoolII instances
  become: yes
  gather_facts: yes
  any_errors_fatal: true

  collections:
    - edb_devops.edb_postgres

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

        pgpool2_load_balancing: true
        pgpool2_watchdog: true
        pgpool2_vip: "10.0.0.123"
        pgpool2_vip_dev: "eth0"
        pgpool2_port: 5433

  roles:
    - role: setup_repo
      when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
    - role: setup_pgpool2
      when: "'setup_pgpool2' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"

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

All the variables are available at:

License

BSD

Author information

Author: