ansible-restic icon indicating copy to clipboard operation
ansible-restic copied to clipboard

replace custom wrapper scripts with runrestic

Open paulfantom opened this issue 6 years ago • 5 comments

This role shouldn't reinvent the wheel and implement custom scripts for various restic functionalities. There are already many projects providing a simple to use wrapper on restic and those could be used instead.

We could use runrestic which is written in python3 and available via pip3 install runrestic. Personally I like this one as it has clear configuration and includes instrumentation to push metrics to prometheus monitoring system.

This is only an idea, but implementing this should greatly simplify second day operations and reduce role maintenance.

paulfantom avatar May 19 '19 21:05 paulfantom

Going this path means that all bash/cron scripts should be removed from this repository and replaced with simple invocations of runrestic (or other software).

paulfantom avatar May 19 '19 21:05 paulfantom

I think is a clever idea. I'm using a simple wrapper in bash, but something more flexible as runrestic is really appreciated.

kalos avatar May 19 '19 21:05 kalos

Have you considered a separate role for installing restic itself, and (an)other role(s) for the wrapper(s)?

davdr avatar Sep 06 '19 16:09 davdr

@davdr that's a good idea, I didn't consider it.

paulfantom avatar Sep 07 '19 09:09 paulfantom

Have you considered a separate role for installing restic itself, and (an)other role(s) for the wrapper(s)?

Maybe just allow setting the command prefix. This would allow switching between different restic installations (e.g. package manager, docker, ...).

In my currently manual script, I am using something like:

# restic.sh
source "vars.sh"
RESTIC_LOCAL='eval restic --cache-dir "$WORKDIR/cache"'
RESTIC_DOCKER='eval docker run --rm -t
  -v $WORKDIR/cache:/restic_cache
  -v /home/$USER:/restic_data:ro -w /restic_data
  -e RESTIC_REPOSITORY
  -e RESTIC_PASSWORD
  -e AWS_ACCESS_KEY_ID
  -e AWS_SECRET_ACCESS_KEY
  restic/restic
  --cache-dir /restic_cache'
RESTIC="$RESTIC_LOCAL"  # change this to RESTIC_DOCKER if you like
$RESTIC "$@"

So one can just run ./restic.sh backup --one-file-system .. It is work in progress, so adapting the docker mount when changing paths needs to be done of course, but I think you get the idea

darkdragon-001 avatar May 25 '20 15:05 darkdragon-001