💥 Battle-tested at Grofers
Ansible role which installs and configures barman by 2ndQuadrant on debian based distros only (Tested with Ubuntu 14.04 only, but should work with other distros as well).
This has been tested on Ansible 2.1.0 and higher. To install:
ansible-galaxy install grofers.barman
define of server list for backup:
barman_server_configuration:
Settings for server:
name of reserved server
- name: ssh
description: "Example of PostgreSQL Database (via SSH)"
conninfo: "host=pg user=barman dbname=postgres"
Define backup method (rsync|postgres)
backup_method: "rsync"
If method rsync
ssh_command: "ssh postgres@pg"
# defaults file for ansible-role-barman
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"
# Pin-Priority of PGDG repository
barman_postgresql_apt_pin_priority: 500
## Cron Configuration
barman_cron_disabled: false
# Run barman cron every minute
barman_cron_schedule:
minute: "*"
hour: "*"
day: "*"
weekday: "*"
month: "*"
## Barman Config
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"
barman_server_configuration:
- name: ssh
description: "Example of PostgreSQL Database (via SSH)"
ssh_command: "ssh postgres@pg"
conninfo: "host=pg user=barman dbname=postgres"
backup_method: "rsync"
reuse_backup: "None"
backup_options: "exclusive_backup"
archiver: "on"
archiver_batch_size: 50
path_prefix: ''
cron_disabled: false
cron_schedule:
minute: "0"
hour: "0"
day: "*"
month: "*"
weekday: "*"
There are a lot more optional variables, please see defaults/main.yml for all of them.
- name: Setup and configure barman
become: yes
roles:
- grofers.barman