diff --git a/states/borg/templates/borg_job.sh.j2 b/states/borg/templates/borg_job.sh.j2 index 39b5323..ea3e0a9 100755 --- a/states/borg/templates/borg_job.sh.j2 +++ b/states/borg/templates/borg_job.sh.j2 @@ -28,11 +28,16 @@ borg create \ --stats \ --show-rc \ --compression {{ job.compression|default('lz4') }} \ +{%- if job.excluded_dirs is defined -%} +{%- for exclude in job.excluded_dirs %} + --exclude '{{ exclude }}' \ +{%- endfor %} +{%- endif %} --exclude-caches \ - ::$backup_name'-{hostname}-{now}' \ -{% for include in job.included_dirs -%} + ::$backup_name'-{hostname}-{now}' \ +{%- for include in job.included_dirs %} {{ include }} \ -{% endfor -%} +{%- endfor %} 2>> {{ working_dir }}/logs/${backup_name}-$(date +%Y-%m-%d).log backup_exit=$?