Giter Club home page Giter Club logo

ansible-role-repmgr's Introduction

Ansible Role: Repmgr

CI Ansible Galaxy

This role installs and configures repmgr for Postgresql replication

Requirements

You need a PostgreSQL installation to use this role. But before you can deploy the whole role, you need to install repmgr first because you need the repmgr binaries when before starting the Postgresql database with repmgr shared preload libraries.

Role Variables

See defaults/main.yml

Dependencies

None.

Usage

In the playbook for the master:

- hosts: db
  roles:
    - FLiPp3r90/repmgr
  vars:
    repmgr_install_only: true

- hosts: db
  roles:
     - role: anxs/postgresql
     - role: FLiPp3r90/repmgr
  vars:
    repmgr_is_master: true
    repmgr_node_id: 1

In the playbook for the slave:

- hosts: db
  roles:
    - FLiPp3r90/repmgr
  vars:
    repmgr_install_only: true

- hosts: db
  roles:
     - role: anxs/postgresql
     - role: FLiPp3r90/repmgr
  vars:
    repmgr_node_id: 2
    repmgr_clone_standby: true
    repmgr_register_standby: true

Tricks and Tips

You will need to create a repmgr user on your master database with appropriate permissions. This two things.

  1. Create a database use repmgr with the permissions SUPERUSER,REPLICATION,LOGIN
  2. Add an entry to the pg_hba.conf file giving explicit access to the s replication database to both the repmgr and the postgres users
# pg_hba.conf
host  replication  repmgr    192.168.0.0/16  trust
host  replication  repmgr    10.0.0.0/8      trust
host  replication  postgres  192.168.0.0/16  trust
host  replication  postgres  10.0.0.0/8      trust

If you use Firewalld on your database hosts you have to ensure that the Postgresql port is open.

If you have stricted sshd access configured on your database hosts you have to ensure that the postgres os user is able to connect via ssh key to all cluster member.

You have to set sudo rules that grants postgresql user to start/stop/restart postgresql database.

License

Apache License 2.0

Author Information

FLiPp3r90

ansible-role-repmgr's People

Contributors

flipp3r90 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.