yurihs.borg_client
Ansible Role: Borg Client
- Installs BorgBackup.
- Installs a script to create and prune archives, and manages configurations for the script (prune frequency, connection parameters).
- Configures cron jobs for the executing the script regularly.
Made to work with my other role, yurihs.borg_server.
Role variables (default values)
borg_client_config_dir: /etc/borg_client
Where the configurations will be stored.
borg_client_log_path: /var/log/borg_client.log
Where the output of the script will be written to (from the cron jobs).
borg_client_backup_list: []
A list of backups to manage. Each item should have:
name: Just to identify it. Will be used in the configuration file name and the cron job.repo: Where to create the archive. Usually a remote server.paths: A list of locations to include in the backup.
Each item may also have a cron configuration, just like in the cron module.
cronminutehourdaymonthweekday
Each item may also define an alternative SSH configuration.
sshkey_path: Specify which key to use when connecting.port: If your remote server uses a nonstandard port. (optional. default: 22)
Each item may also have pruning enabled, by including the following parameters. If so, borg prune will be executed after every archive creation.
prunekeep_hourlykeep_dailykeep_weeklykeep_monthly
Example
First, create a repo on the client, like so:
borg init --encryption=none [email protected]:app_uploads
- hosts: web
vars:
borg_client_backup_list:
- name: app_uploads
repo: [email protected]:app_uploads
paths:
- /var/www/app/uploads
cron:
minute: '0'
hour: '*'
day: '*'
month: '*'
weekday: '*'
ssh:
key_path: /root/.ssh/id_app
prune:
keep_hourly: 5
keep_daily: 5
keep_weekly: 2
keep_monthly: 2
roles:
- role: yurihs.borg_client
become: true
Missing features (TODO)
- Handle encryption (keyfiles, passphrases)
Install
ansible-galaxy install yurihs.borg_clientLicense
mit
Downloads
90
Owner
