Skip to content

Commit

Permalink
Merge pull request #2 from modcloth-labs/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
Rafe Colton committed Sep 24, 2014
2 parents 2f5f9b0 + 14f46fb commit f0c1a0d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Upstream server should be configured to send WAL archives to this server. This c
```ini
wal_level = 'archive'
archive_mode = on
archive_command = 'rsync -az %p {{barman_user}}@{{this host}}:{{barman_home}}/{{name}}/%f'
archive_command = 'rsync -ap --bwlimit=1000 %p {{barman_user}}@{{this host}}:{{barman_home}}/{{name}}/%f'
```

The barman server should have pip and postgres installed.
Expand Down
18 changes: 10 additions & 8 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
---
# Key for use by master to send archive segments
barman_archive_pub_key: # required
# Writes as ~{{barman_user}}/.ssh/id_rsa
# This key is used by Barman for SSH access onto the master
barman_ssh_key_file: #required

barman_home: /var/barman
barman_user: barman
barman_log_file: /var/log/barman.log
barman_groups: syslog # comma delimited list of groups
barman_log_file: /var/log/barman/barman.log
barman_log_level: INFO
barman_compression: bzip2
# Corresponding public key for the default:
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7aLw6EQNion1jk60RrhmKjW5swmEA0EVZUOzTLVmYfSnEMFKOZ3hPpuxSjvJ3HRPQM1XqzSJN0RuG4yaZT6EZ+sxGJ5vs+ckcKCP4UT38QJp1MMNl65Q2GScyOMA9SRnQhID4PPMgCrHkL8bcOEXiYlvtDTAweT58Xmi4ZJ5Et/4faRRb0o4gxOa4V1dcUCFgR36K+DbcDeR/+KiLuIziXlniAzx9nJIrHCp2Lb6JNquXTmk7SPqBsPJ2bs1O1nNQNtrJwvFQET5M2KOETt+U+nKRQLLOVx7fJs5GE/odABskcy441n+jiSvNYjWjGI+LD2Zo1cKQXlxxBEsgmOOR barman
# Writes as ~{{barman_user}}/.ssh/id_rsa
# This key is used by Barman for SSH access onto the master
barman_ssh_key_file: id_rsa
barman_maintenance_schedule: '*/30 * * * *' # How often to run `barman cron`
barman_maintenance_log_file: /var/log/barman-cron.log
barman_maintenance_log_file: /var/log/barman/cron.log
barman_backup_schedule: '0 1 * * *' # How often to run `barman backup all`
barman_backup_log_file: /var/log/barman-backup.log
barman_backup_log_file: /var/log/barman/backup.log

# List of servers to maintain backups for.
#
Expand Down
27 changes: 0 additions & 27 deletions files/id_rsa

This file was deleted.

16 changes: 14 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@
- name: "create barman user"
user:
name='{{barman_user}}'
groups='{{barman_groups}}'
state=present
register: barman_create_barman_user
- name: "create ssh directory"
file:
path='{{barman_create_barman_user.home}}/.ssh'
state=directory
owner='{{barman_user}}'
group='{{barman_user}}'
- name: "add ssh key"
copy:
src='{{barman_ssh_key_file}}'
dest='{{barman_create_barman_user.home}}/.ssh/id_rsa'
- name: "add authorized ssh key"
authorized_key:
key='{{barman_archive_pub_key}}'
user="{{barman_user}}"
state=present
- name: "write barman.conf"
template: src=barman.conf.j2 dest=/etc/barman.conf owner='{{barman_user}}'
- name: "create home directory"
Expand All @@ -26,7 +38,7 @@
day={{barman_maintenance_schedule.split()[2]}}
month={{barman_maintenance_schedule.split()[3]}}
weekday={{barman_maintenance_schedule.split()[4]}}
job="date >> {{barman_maintenance_log_file}}.log && barman cron >> {{barman_maintenance_log_file}}.log 2>&1"
job="date >> {{barman_maintenance_log_file}} && barman cron >> {{barman_maintenance_log_file}} 2>&1"
user="{{barman_user}}"
state=present
- name: "add backup job"
Expand All @@ -37,6 +49,6 @@
day={{barman_backup_schedule.split()[2]}}
month={{barman_backup_schedule.split()[3]}}
weekday={{barman_backup_schedule.split()[4]}}
job="date >> {{barman_backup_log_file}}.log && barman backup all >> {{barman_backup_log_file}}.log 2>&1"
job="date >> {{barman_backup_log_file}} && barman backup all >> {{barman_backup_log_file}} 2>&1"
user="{{barman_user}}"
state=present

0 comments on commit f0c1a0d

Please sign in to comment.