otakup0pe.dupwrap
duplicity wrapper
This Ansible role installs a simple wrapper around the duplicity backup tool. It has two modes of operation - backing up to Amazon S3, or an encrypted Mac disk image on an external Volume. The dupwrap tool supports multiple backup profiles on a single host. It may be run as either the root user to backup servers, or as another user to backup workstations.
S3 Mode
This will upload the GPG encrypted backup to a specified S3 bucket. The IAM user associated with the provided API keys requires both read/write permissions.
Mac USB Mode
This will create/maintain a encrypted volume on external volumes. This does result in a double encryption but I don't really mind. This mode does not yet support scheduled backups.
Variables
These are variables which have defaults. These values are selected to make it easy to backup an entire server, just add source and destination.
dupwrap_userdefaults torootdupwrap_groupdefaults torootdupwrap_config_prefixdefaults to/etcdupwrap_bin_prefixdefaults to/usr/local/binwhich is sufficient fordupwrap_crondefaults tofalse- enable to setup a cronjobdupwrap_cron_verbosedefaults tofalsebut you can make this thing way more chatty than you could ever possibly really wantdupwrap_n_fulldefaults to3and controls how many full backups to keepdupwrap_remove_olderdefaults to12will remove backups older than the specified number of monthsdupwrap_full_olderdefaults to30Dand determines how frequently to force full backups
Multiple backup profiles may be defined. They are all stored in a a directory named dupwrap relative to the config prefix. The dupwrap_backups variable is used to define backup profiles. This variable contains a list of yaml objects, which may default to global settings.
passphrase(defaulting todupwrap_passphrase) specifies the password use for encryption routinesaws_access_key(defaulting todupwrap_aws_access_key) is the AWS Access Key ID, needed for S3 backupsaws_secret_key(dupwrap_aws_secret_key) is the AWS Secret Access Key, needed for S3 backupsbucket(dupwrap_bucket) is the S3 URI to use, needed for S3 backups
You must pass these instance variables if backing up to Mac/USB
dupwrap_unencrypted_volumeis the name of the mounted external volume to usedupwrap_encrypted_volumeis the name of the encrypted volume to makedupwrap_encrypted_volume_sizeis the size of the volume, and defaults to256m
dupwrap script
This script is the interface around duplicity. It is also what gets called by cron, if using that. All mac/usb interactions will ask for a password.
Options
These options change the default behaviour. Note that some actions will require a profile specified.
-dwhen specified on a mac backup will cause it to leave things mounted when done backing up.-vspits out a bunch of debugging information-fskips confirmation when removing things for ever-cspecifies the directory where configuration files are stored. This defaults to whateverdupwrap_config_prefixis set to-pspecifies a backup profile.-tSpecifieds the time to restore a file from. I have no idea why this is an option and not an action argument. Probably because I'm terrible at computers.
Actions
backupwill kick off a backup. If no profile specified then every found backup will be run.listlists everything in the most recent backuprestore_filewill restore a specific file to the given locationrestore_file <file> <dest>to restore most recent
statusbasic information on the backup setprunewill remove old backups. If no profile is specified then every found backup will be purged.
On macOS, there are some additional actions available.
initwill create the encrypted disk imagepurgewill remove the encrypted disk imagemountwill mount the encrypted disk imageunmountwill unmount the encrypted disk image
Swap Helper
The swap helper script (dupwrap-swap-helper) is meant to be used with the pre_script and post_script job variables. It is invoked with a single argument which is either pre or post.
License
Author
This Ansible role was created by Jonathan Freedman because he was tired of losing things to the inexorable decay of data.
ansible-galaxy install otakup0pe.dupwrap