A high end ansible role to setup standalone or a cluster Percona Postgres with version support 11 and above with best practices in terms of security and performance tunning.
Date | Version | Description | Changed By |
---|---|---|---|
Aug '31 | v0.0.1 | Initial Draft | Abhishek Vishwakarma |
- Ubuntu: bionic
- Ubuntu: focal
There is no such requirements for the role.
The role variables are defined in the vars. Here is the list of variables that is used in this role
Variable | Description |
---|---|
version | Define version of postgresql |
postgres_listen_addresses | Define Address when want to setup standalone |
postgres_port | Define Address when want to setup standalone |
users_creation | Set true when want to create user |
database_creation | Set true when want to create database |
psql_databases | List of db creation details |
psql_users | List of user creation details |
replication | Set true for cluster configuration |
replica_user | User of the postgreSQL |
replica_pass | Group of the postgreSQL |
An inventory should look like this:-
[master]
192.168.1.198
[slave]
192.168.3.201
[postgres_cluster:children]
master
slave
[postgres_cluster:vars]
ansible_user=ubuntu
Here is an example of playbook to execute this role:-
---
- hosts: postgres_cluster
roles:
- role: percona_postgres
become: yes
There are multiple ways of executing the playbook according to your environment
- To run complete role
ansible-playbook -i hosts site.yml
- To create users
ansible-playbook -i hosts site.yml --tags "create_user"
- To create databases
ansible-playbook -i hosts site.yml --tags "create_database"
- Enable Failover in cluster configuration