From ce703e5692f4185e47604688a1f29e5a674ae9aa Mon Sep 17 00:00:00 2001 From: camille Date: Fri, 3 Mar 2023 17:02:53 +0100 Subject: [PATCH] duplicty - add azure backend --- tasks/duplicity.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tasks/duplicity.yml b/tasks/duplicity.yml index 33455d4..565eeb4 100644 --- a/tasks/duplicity.yml +++ b/tasks/duplicity.yml @@ -7,6 +7,17 @@ - duplicity_s3_passphrase is defined - duplicity_s3_access_key is defined - duplicity_s3_secret_key is defined + when: + - duplicity_backend == s3 + tags: ['backup_duplicity'] + +- name: duplicity | check vars are defined + assert: + that: + - duplicity_archive_dir is defined + - duplicity_azure_path is defined + when: + - duplicity_backend == azure tags: ['backup_duplicity'] - name: duplicity | install packages @@ -217,6 +228,7 @@ job: ". /etc/duplicity/duplicity.cnf && duplicity --encrypt-key {{ duplicity_gpg_key }} --s3-use-new-style -v 4 --archive-dir={{ duplicity_archive_dir }} --full-if-older-than {{ duplicity_full_older_than }}D / \"{{ duplicity_s3_path }}\" --exclude-filelist {{ duplicity_exclude_filelist }}" when: - duplicity_gpg_key is defined + - duplicity_backend == s3 tags: ['backup_duplicity'] - name: duplicity | create cleanup cronjob @@ -231,4 +243,35 @@ job: ". /etc/duplicity/duplicity.cnf && duplicity --encrypt-key {{ duplicity_gpg_key }} --force --s3-use-new-style -v 4 remove-older-than {{ duplicity_remove_older_than }}D \"{{ duplicity_s3_path }}\"" when: - duplicity_gpg_key is defined + - duplicity_backend == s3 + tags: ['backup_duplicity'] + +- name: duplicity | create backup cronjob + cron: + name: duplicity backup + minute: "{{ duplicity_cron_backup_minute }}" + hour: "{{ duplicity_cron_backup_hour }}" + day: "{{ duplicity_cron_backup_day }}" + month: "{{ duplicity_cron_backup_month }}" + weekday: "{{ duplicity_cron_backup_weekday }}" + user: "{{ duplicity_cron_backup_user }}" + job: ". /etc/duplicity/duplicity.cnf && duplicity --encrypt-key {{ duplicity_gpg_key }} --archive-dir={{ duplicity_archive_dir }} --full-if-older-than {{ duplicity_full_older_than }}D / \"{{ duplicity_azure_path }}\" --exclude-filelist {{ duplicity_exclude_filelist }}" + when: + - duplicity_gpg_key is defined + - duplicity_backend == azure + tags: ['backup_duplicity'] + +- name: duplicity | create cleanup cronjob + cron: + name: duplicity cleanup + minute: "{{ duplicity_cron_backup_minute+30 }}" + hour: "{{ duplicity_cron_backup_hour+3 }}" + day: "{{ duplicity_cron_backup_day }}" + month: "{{ duplicity_cron_backup_month }}" + weekday: "{{ duplicity_cron_backup_weekday }}" + user: "{{ duplicity_cron_backup_user }}" + job: ". /etc/duplicity/duplicity.cnf && duplicity --encrypt-key {{ duplicity_gpg_key }} --force remove-older-than {{ duplicity_remove_older_than }}D \"{{ duplicity_azure_path }}\"" + when: + - duplicity_gpg_key is defined + - duplicity_backend == azure tags: ['backup_duplicity']