tohuwabohu / puppet-duplicity

Puppet module to manage backups based on duplicity.
Apache License 2.0
8 stars 33 forks source link

Feature request: Multiple targets for a single profile #58

Open wxcafe opened 4 years ago

wxcafe commented 4 years ago

Hi,

I was wondering if it would be possible to get multiple targets for a single profile? for example:

duplicity::profile {'conf_file':
  full_if_older_than => '2W',
  max_full_backups => 3,
  volsize => 500,
  cron_enabled => true,
  cron_hour => '03',
  cron_minute => '00',
  gpg_encryption => false,
  targets => ["sftp://user1:password1@backup1.example.net//srv/backups/$hostname", "sftp://user2:password2@backup2.example.net//srv/backups/$hostname"],
}

which would back objects declared with duplicity::file to the two different remote servers.

Seeing as this is unsupported I tried doing it with two profiles (that have the two different targets) and duplicating the duplicity::file objects, but that breaks (Duplicate declaration: Exec[restore /etc/] is already declared at [...]; cannot redeclare, the Exec gets declared with the path, not the name of the duplicity::file object). It would also be a lot easier not to have to duplicate every single duplicity::file object for all my servers...

Thanks

goetzk commented 3 years ago

I'm considering the same behaviour so had a quick browse around too.

As best I can tell duplicity itself doesn't support multiple upload targets and I didn't see a way to work around that via duply. http://duplicity.nongnu.org/vers8/duplicity.1.html http://duply.net/Documentation

I'm not sure the best way to add this but I suspect the module would have to check if targets is defined then re invoke duplicity::profile twice. file would have to change from using path to profile+path in its identifier. Is that roughly your understanding too?

tohuwabohu commented 3 years ago

I understand the desire for multiple targets as a way to improve resilience in case the primary backup server crashes.

The tricky bit is as @goetzk mentioned that neither duplicty nor duply support this as a first class use case which means any possible solution would have to work around other issues

Another option could be to set up replication on the primary and push the updates out to the secondary, perhaps triggered via a post-update script. Alternatively, may be there is a smart way to just grab the files from the local cache and upload them to the other server.