grofers.barman
grofers.ansible-role-barman 
💥 在 Grofers 的实战检验中
一个 Ansible 角色,用于在基于 Debian 的发行版上安装和配置 barman by 2ndQuadrant(仅在基于 Debian 的系统上测试)。 (仅在 Ubuntu 14.04 上测试,但应适用于其他发行版)。
安装
此角色已在 Ansible 2.1.0 及更高版本上进行测试。 要安装:
ansible-galaxy install grofers.barman
角色变量
定义备份服务器列表:
barman_server_configuration:
服务器设置:
保留服务器的名称
- name: ssh
description: "PostgreSQL 数据库示例(通过 SSH)"
conninfo: "host=pg user=barman dbname=postgres"
定义备份方法(rsync|postgres)
backup_method: "rsync"
如果方法是 rsync
ssh_command: "ssh postgres@pg"
# ansible-role-barman 的默认文件
barman_client_only: no
## APT 设置
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"
# PGDG 仓库的 Pin-Priority
barman_postgresql_apt_pin_priority: 500
## Cron 配置
barman_cron_disabled: false
# 每分钟运行 barman cron
barman_cron_schedule:
minute: "*"
hour: "*"
day: "*"
weekday: "*"
month: "*"
## Barman 配置
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: "PostgreSQL 数据库示例(通过 SSH)"
ssh_command: "ssh postgres@pg"
conninfo: "host=pg user=barman dbname=postgres"
backup_method: "rsync"
reuse_backup: "无"
backup_options: "exclusive_backup"
archiver: "开启"
archiver_batch_size: 50
path_prefix: ''
cron_disabled: false
cron_schedule:
minute: "0"
hour: "0"
day: "*"
month: "*"
weekday: "*"
还有很多可选变量,更多信息请查看 defaults/main.yml 文件。
示例剧本
- name: 设置和配置 barman
become: yes
roles:
- grofers.barman