role_borgmatic/templates/config.yaml.j2

72 lines
1.6 KiB
Django/Jinja

---
# {{ ansible_managed }}
repositories:
{% for repository in borgmatic_repositories %}
- label: {{ repository.label }}
path: {{ repository.path }}
{% endfor %}
{% if borgmatic_exclude_patterns | length > 0 %}
exclude_patterns:
{% for pattern in borgmatic_exclude_patterns %}
- {{ pattern }}
{% endfor %}
{% endif %}
{% if borgmatic_source_directories | length > 0%}
source_directories:
{% for directory in borgmatic_source_directories %}
- {{ directory }}
{% endfor %}
{% endif %}
archive_name_format: {{ borgmatic_name }}
compression: {{ borgmatic_compression }}
encryption_passphrase: {{ borgmatic_passphrase }}
checks:
{% for check in borgmatic_checks %}
- name: {{ check.name }}
frequency: {{ check.frequency }}
{% endfor %}
healthchecks:
ping_url: {{ borgmatic_healthchecks }}
send_logs: false
# states:
# - finish
# - fail
{% if borgmatic_retention | length > 0 %}
{% for param, value in borgmatic_retention.items() %}
keep_{{ param }}: {{ value }}
{% endfor %}
{% endif %}
{% if borgmatic_actions | length > 0 %}
{% for param, values in borgmatic_actions.items() %}
{{ param }}:
{% for value in values %}
- {{ value }}
{% endfor %}
{% endfor %}
{% endif %}
{% if borgmatic_mariadb_enabled %}
mariadb_databases:
- name: all
format: sql
add_drop_database: true
{% endif %}
{% if borgmatic_postgresql_enabled %}
postgresql_databases:
- name: all
username: postgres
format: plain
pg_dump_command: sudo -u postgres pg_dump
pg_restore_command: sudo -u postgres pg_restore
psql_command: sudo -u postgres psql
{% endif %}