add forget_args var

This commit is contained in:
Jake Walker 2025-08-12 18:01:51 +01:00
parent b69c807b82
commit 4c9e3b1830
No known key found for this signature in database
3 changed files with 12 additions and 14 deletions

View file

@ -31,8 +31,8 @@ Each folder has a `path` and an `exclude` property (which defaults to nothing).
Each database has a `name` property which will be the name of the restic snapshot (`{{ database.name }}.sql`). They also have a `dump_command` property which is the command to dump the database to stdout (like `mysqldump dbname`).
- `restic_forget`: run `restic forget` as `ExecStartPost` with `--keep-within {{ restic_forget_keep_within }}` (`true`)
- `restic_forget_keep_within`: period of time to use with `--keep-within` (`30d`)
- `restic_forget`: run `restic forget` as `ExecStartPost` (`true`)
- `restic_forget_args`: period of time to keep backups for. args passed to `restic forget` if `restic_forget` is enabled (`--keep-within 30d`)
- `restic_prune`: run `restic prune` as `ExecStartPost` (`true`)
### SSH/SFTP backend configuration
@ -70,18 +70,17 @@ You can see the logs of the backup with `journalctl`. (`journalctl -xefu restic-
```yaml
---
- hosts: myhost
roles: restic
vars:
restic_ssh_user: backupuser
restic_ssh_hostname: storage-server.infra.tld
restic_folders:
- {path: "/srv"}
- {path: "/var/www"}
- { path: "/srv" }
- { path: "/var/www" }
restic_databases:
- {name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website}
- {name: website2, dump_command: mysqldump website2}
- { name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website }
- { name: website2, dump_command: mysqldump website2 }
restic_password: mysuperduperpassword
restic_ssh_private_key: |-
-----BEGIN OPENSSH PRIVATE KEY-----
@ -97,7 +96,6 @@ S3 example:
```yaml
---
- hosts: myhost
roles: restic
vars:
@ -106,11 +104,11 @@ S3 example:
restic_aws_access_key_id: xxxxx
restic_aws_secret_access_key: xxxxx
restic_folders:
- {path: "/srv"}
- {path: "/var/www"}
- { path: "/srv" }
- { path: "/var/www" }
restic_databases:
- {name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website}
- {name: website2, dump_command: mysqldump website2}
- { name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website }
- { name: website2, dump_command: mysqldump website2 }
restic_password: mysuperduperpassword
```

View file

@ -14,7 +14,7 @@ restic_folders: []
restic_databases: []
restic_dump_compression_enabled: false
restic_forget: true
restic_forget_keep_within: 30d
restic_forget_args: "--keey-within 30d"
restic_prune: true
restic_check: true

View file

@ -34,7 +34,7 @@ ExecStart=/bin/sh -c "{{ database.dump_command }} {{ '| pigz |' if restic_dump_c
{% endfor -%}
{% if restic_forget %}
ExecStartPost={{ restic_path }} forget --keep-within {{ restic_forget_keep_within }}
ExecStartPost={{ restic_path }} forget {{ restic_forget_args }}
{% endif -%}
{% if restic_prune %}