---
{{ ansible_managed | comment }}

location:
  source_directories:
{% for source in borg_backup_directories %}
   - {{ source }}
{% endfor %}
  exclude_patterns:
{% for exclude in borg_backup_exclude %}
  - {{ exclude }}
{% endfor %}
  repositories:
   - {{ borg_server_user }}@{{ borg_server_host }}:{{ borg_host_dir }}
  borgmatic_source_directory: /var/backups

storage:
  encryption_passphrase: "{{ borg_encryption_passphrase }}"
  ssh_command: ssh -i /etc/borgmatic/id_remote
  # compression: 'lz4'
  # umask: 0077
  # lock_wait: 5
  # archive_name_format: '{hostname}-{now}'


retention:
{% if borg_keep_hourly > 0 %}
  keep_hourly: {{ borg_keep_hourly }}
{% endif %}
{% if borg_keep_daily > 0 %}
  keep_daily: {{ borg_keep_daily }}
{% endif %}
{% if borg_keep_weekly > 0 %}
  keep_weekly: {{ borg_keep_weekly }}
{% endif %}
{% if borg_keep_monthly > 0 %}
  keep_monthly: {{ borg_keep_monthly }}
{% endif %}

consistency:
  checks:
    - repository
    - archives

{% if borg_postgresql_databases is defined %}
hooks:
  postgresql_databases:
    - name: all
      username: postgres
{% endif %}
...