# {{ ansible_managed }} # Path to borg binary (LaunchAgent doesn't have homebrew in PATH) local_path: {{ borgmatic_local_path }} source_directories: {% for dir in borgmatic_source_directories %} - {{ dir }} {% endfor %} source_directories_must_exist: true repositories: {% for repo in borgmatic_repositories %} - path: {{ repo.path }} label: {{ repo.label }} {% if repo.encryption is defined %} encryption: {{ repo.encryption }} {% endif %} {% if repo.append_only is defined %} append_only: {{ repo.append_only | lower }} {% endif %} {% endfor %} {% if borgmatic_exclude_patterns %} exclude_patterns: {% for pattern in borgmatic_exclude_patterns %} - {{ pattern }} {% endfor %} {% endif %} encryption_passcommand: {{ borgmatic_encryption_passcommand }} {% if borgmatic_k8s_sqlite_dumps %} # Pre-backup: dump SQLite databases from k8s pods. # Uses sqlite3.backup() for a safe, consistent copy. # # Quoting/escaping is delegated to ~/bin/borgmatic-k8s-sqlite-dump # (deployed by the borgmatic ansible role). Each entry's `target` # is either: # - local: -> local kubectl with --context (mealie etc.) # - ssh: -> ssh + k3s kubectl on the cluster host, # used for ringtail since indri's kubeconfig # deliberately doesn't carry that context. before_backup: - mkdir -p {{ borgmatic_k8s_dump_dir }} {% for db in borgmatic_k8s_sqlite_dumps %} - {{ ansible_env.HOME }}/bin/borgmatic-k8s-sqlite-dump {{ db.target }} {{ db.namespace }} {{ db.label_selector }} {{ db.db_path }} {{ db.name }} {{ borgmatic_k8s_dump_dir }}/{{ db.name }}.db {% endfor %} {% endif %} ssh_command: ssh -o IdentitiesOnly=yes -i {{ borgmatic_borgbase_ssh_key_path }} # Retention policy keep_daily: {{ borgmatic_keep_daily }} keep_monthly: {{ borgmatic_keep_monthly }} keep_yearly: {{ borgmatic_keep_yearly }} {% if borgmatic_postgresql_databases %} # PostgreSQL database backups (streamed via pg_dump) postgresql_databases: {% for db in borgmatic_postgresql_databases %} - name: {{ db.name }} hostname: {{ db.hostname | default('localhost') }} port: {{ db.port | default(5432) }} username: {{ db.username }} {% if borgmatic_pg_dump_command is defined %} pg_dump_command: {{ borgmatic_pg_dump_command }} {% endif %} {% endfor %} {% endif %}