# This file was generated by Ansible for {{ ansible_fqdn }}
# Do NOT modify this file by hand!

# Setting only a passphrase and omitting the GPG key
# will enable symmetric passphrase-only encryption.
{% if item.gpg_key|default(backup_gpg_key) == 'disabled' and item.gpg_pw|default(backup_gpg_pw) %}
# GPG_KEY='{{ item.gpg_key|default(backup_gpg_key) }}'
{% else %}
GPG_KEY='{{ item.gpg_key|default(backup_gpg_key) }}'
{% endif %}
GPG_PW='{{ item.gpg_pw|default(backup_gpg_pw) }}'
{% if item.gpg_keys_enc|default(None) %}
GPG_KEYS_ENC='{{item.gpg_keys_enc}}'
{% endif %}
{% if item.gpg_key_sign|default(None) %}
GPG_KEY_SIGN='{{item.gpg_key_sign}}'
{% endif %}
{% if item.gpg_pw_sign|default(None) %}
GPG_PW_SIGN='{{item.gpg_pw_sign}}'
{% endif %}
GPG_OPTS='{{item.gpg_opts|default(backup_gpg_opts)}}'

TARGET='{{item.target|default(backup_target)}}'

{% if item.target_user|default(backup_target_user) %}
TARGET_USER='{{item.target_user|default(backup_target_user)}}'
{% endif %}
{% if item.target_pass|default(backup_target_pass) %}
TARGET_PASS='{{item.target_pass|default(backup_target_pass)}}'
{% endif %}

{% if item.source.startswith('postgresql://') or item.source.startswith('mysql://') or item.source.startswith('mongo://') %}
SOURCE='{{backup_work}}/{{item.name}}/dump'
{% else %}
SOURCE='{{item.source|default(backup_source)}}'
{% endif %}

# Time frame for old backups to keep, Used for the "purge" command.  
# see duplicity man page, chapter TIME_FORMATS)
MAX_AGE='{{item.max_age|default(backup_max_age)}}'

# Number of full backups to keep. Used for the "purge-full" command. 
# See duplicity man page, action "remove-all-but-n-full".
MAX_FULL_BACKUPS='{{item.max_full_backups|default(backup_max_full_backups)}}'

VERBOSITY={{item.verbosity|default(backup_verbosity)}}

# ARCH_DIR=/tmp/backup_{{item.name}}

# activates duplicity --full-if-older-than option (since duplicity v0.4.4.RC3)
# forces a full backup if last full backup reaches a specified age, for the
# format of MAX_FULLBKP_AGE see duplicity man page, chapter TIME_FORMATS
MAX_FULLBKP_AGE={{ item.full_max_age|default(backup_full_max_age) }}
DUPL_PARAMS="$DUPL_PARAMS --full-if-older-than $MAX_FULLBKP_AGE "

# sets duplicity --volsize option (available since v0.4.3.RC7)
# set the size of backup chunks to VOLSIZE MB instead of the default 25MB.
# VOLSIZE must be number of MB's to set the volume size to.
VOLSIZE={{ item.volsize|default(backup_volsize) }}
DUPL_PARAMS="$DUPL_PARAMS --volsize $VOLSIZE "

# exclude folders containing exclusion file (since duplicity 0.5.14)
# Uncomment the following two lines to enable this setting.
#FILENAME='.duplicity-ignore'
#DUPL_PARAMS="$DUPL_PARAMS --exclude-if-present '$FILENAME'"

# Add params needed for target or backup process.
{% for param in item.params|default([]) %}
{{ param }}
{% endfor %}

# temporary file space. at least the size of the biggest file in backup
# for a successful restoration process. (default is '/tmp', if not set)
#TEMP_DIR=/tmp

# more duplicity command line options can be added in the following way
# don't forget to leave a separating space char at the end
#DUPL_PARAMS="$DUPL_PARAMS --put_your_options_here "