Skip to content

Latest commit

 

History

History
197 lines (148 loc) · 7.42 KB

README.md

File metadata and controls

197 lines (148 loc) · 7.42 KB

install_dbserver

This Ansible role installs PostgreSQL or EnterpriseDB Postgresql Advanced Server versions: 10, 11, 12, 13, 14 or 15 on machines previously configured.

Not all Distribution or versions are supported on all the operating systems available.

For more details refer to the Database engines supported section.

Note: This role does not configure PostgreSQL nor EnterpriseDB Postgres Advanced Server for replication it only installs PostgreSQL or EnterpriseDB Postgres Advanced Server binaries across multiple nodes. Should there be a need to configure a PostgreSQL or EnterpriseDB Postgres Advanced Server Cluster for replication you can utilize the setup_replication role.

The ansible playbook must be executed under an account that has full privileges.

Requirements

The only dependencies required for this ansible galaxy role are:

  1. Ansible
  2. community.general Ansible Module - Utilized when creating aditional users during a Postgres Install
  3. edb_devops.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

  • install_edb_postgres_tuner

EDB Postgres Tuner will be installed and enabled when install_edb_postgres_tuner: true. EDB Postgres Tuner also requires enable_edb_repo be set to true. Default: false

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

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

Dependencies

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

Example Playbook

Example of inventory file

Content of the inventory.yml file:

---
all:
  children:
    pemserver:
      hosts:
        pemserver1:
          ansible_host: 110.0.0.4
          private_ip: 10.0.0.4
    primary:
      hosts:
        primary1:
          ansible_host: 110.0.0.1
          private_ip: 10.0.0.1
          pem_agent: true
          pem_server_private_ip: 10.0.0.4
    standby:
      hosts:
        standby1:
          ansible_host: 110.0.0.2
          private_ip: 10.0.0.2
          upstream_node_private_ip: 10.0.0.1
          replication_type: synchronous
          pem_agent: true
          pem_server_private_ip: 10.0.0.4
        standby2:
          ansible_host: 110.0.0.3
          private_ip: 10.0.0.3
          upstream_node_private_ip: 10.0.0.1
          replication_type: asynchronous
          pem_agent: true
          pem_server_private_ip: 10.0.0.4

Note: don't forget to replace IP addresses.

How to include the install_dbserver role in your Playbook

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

---
- hosts: all
  name: Install Postgres binaries
  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"

  roles:
    - role: setup_repo
      when: "'setup_repo' in lookup('edb_devops.edb_postgres.supported_roles', wantlist=True)"
    - role: install_dbserver
      when: "'install_dbserver' 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:

Database engines supported

PostgreSQL

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

EnterpriseDB Postgres Advanced Server

Distribution 10 11 12 13 14 15
CentOS 7
Red Hat Linux 7
RockyLinux 8
Red Hat Linux 8
AlmaLinux8
Ubuntu 20.04 LTS (Focal) - x86_64
Debian 9 (Stretch) - x86_64
Debian 10 (Buster) - x86_64
  • ✅ - Tested and supported

Playbook execution examples

# To deploy PostgreSQL version 14
$ ansible-playbook playbook.yml \
  -u <ssh-user> \
  --private-key <ssh-private-key> \
  --extra-vars="pg_type=PG pg_version=14"
# To deploy EPAS version14
$ ansible-playbook playbook.yml \
  -u <ssh-user> \
  --private-key <ssh-private-key> \
  --extra-vars="pg_type=EPAS pg_version=14"

License

BSD

Author information

Author:

  • Doug Ortiz
  • Vibhor Kumar (Co-Author)
  • Julien Tachoires (Co-Author)

Contact: [email protected]