grofers.barman
Grofers Ansible Role: Barman
Overview
This Ansible role installs and sets up Barman, a backup and recovery tool for PostgreSQL, specifically for Debian-based systems (it has been tested with Ubuntu 14.04 but may work with others too). It's been tried and proven effective at Grofers.
Installation
This role works with Ansible version 2.1.0 or higher. To install it, run the following command:
ansible-galaxy install grofers.barman
Role Variables
You need to define the list of servers for backup as follows:
barman_server_configuration:
Server Settings Example:
- Name of your server for SSH connection:
- name: ssh
- Description of the server:
description: "Example of PostgreSQL Database (via SSH)"
- Connection information:
conninfo: "host=pg user=barman dbname=postgres"
Backup Method
You need to specify the backup method (choose between rsync
or postgres
):
backup_method: "rsync"
If you choose rsync
, provide the SSH command:
ssh_command: "ssh postgres@pg"
Default Variables
Here are some standard settings for the role:
# basic settings
barman_client_only: no
# APT settings
barman_postgresql_apt_key_id: ACCC4CF8
barman_postgresql_apt_key_url: "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
barman_postgresql_apt_repository: "deb http://apt.postgresql.org/pub/repos/apt/{{ansible_distribution_release}}-pgdg main"
barman_postgresql_apt_pin_priority: 500
# Cron Configuration
barman_cron_disabled: false
barman_cron_schedule:
minute: "*"
hour: "*"
day: "*"
weekday: "*"
month: "*"
# Barman Configuration
barman_user: "barman"
barman_configuration_files_directory: "/etc/barman.d"
barman_home: "/var/lib/barman"
barman_log_directory: "/var/log/barman"
barman_log_file: "{{ barman_log_directory }}/barman.log"
barman_log_level: "INFO"
You can find many more optional variables in the defaults/main.yml
file.
Example Playbook
Here’s a sample playbook to set up and configure Barman:
- name: Setup and configure barman
become: yes
roles:
- grofers.barman
License
This project is licensed under the MIT License.
Author
Created by vishesh92.
Ansible role which installs and configures barman by 2ndQuadrant
ansible-galaxy install grofers.barman