add forget_args var
This commit is contained in:
parent
b69c807b82
commit
4c9e3b1830
3 changed files with 12 additions and 14 deletions
22
README.md
22
README.md
|
@ -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`).
|
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`: run `restic forget` as `ExecStartPost` (`true`)
|
||||||
- `restic_forget_keep_within`: period of time to use with `--keep-within` (`30d`)
|
- `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`)
|
- `restic_prune`: run `restic prune` as `ExecStartPost` (`true`)
|
||||||
|
|
||||||
### SSH/SFTP backend configuration
|
### SSH/SFTP backend configuration
|
||||||
|
@ -70,18 +70,17 @@ You can see the logs of the backup with `journalctl`. (`journalctl -xefu restic-
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: myhost
|
- hosts: myhost
|
||||||
roles: restic
|
roles: restic
|
||||||
vars:
|
vars:
|
||||||
restic_ssh_user: backupuser
|
restic_ssh_user: backupuser
|
||||||
restic_ssh_hostname: storage-server.infra.tld
|
restic_ssh_hostname: storage-server.infra.tld
|
||||||
restic_folders:
|
restic_folders:
|
||||||
- {path: "/srv"}
|
- { path: "/srv" }
|
||||||
- {path: "/var/www"}
|
- { path: "/var/www" }
|
||||||
restic_databases:
|
restic_databases:
|
||||||
- {name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website}
|
- { name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website }
|
||||||
- {name: website2, dump_command: mysqldump website2}
|
- { name: website2, dump_command: mysqldump website2 }
|
||||||
restic_password: mysuperduperpassword
|
restic_password: mysuperduperpassword
|
||||||
restic_ssh_private_key: |-
|
restic_ssh_private_key: |-
|
||||||
-----BEGIN OPENSSH PRIVATE KEY-----
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
@ -97,7 +96,6 @@ S3 example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
|
|
||||||
- hosts: myhost
|
- hosts: myhost
|
||||||
roles: restic
|
roles: restic
|
||||||
vars:
|
vars:
|
||||||
|
@ -106,11 +104,11 @@ S3 example:
|
||||||
restic_aws_access_key_id: xxxxx
|
restic_aws_access_key_id: xxxxx
|
||||||
restic_aws_secret_access_key: xxxxx
|
restic_aws_secret_access_key: xxxxx
|
||||||
restic_folders:
|
restic_folders:
|
||||||
- {path: "/srv"}
|
- { path: "/srv" }
|
||||||
- {path: "/var/www"}
|
- { path: "/var/www" }
|
||||||
restic_databases:
|
restic_databases:
|
||||||
- {name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website}
|
- { name: website, dump_command: sudo -Hiu postgres pg_dump -Fc website }
|
||||||
- {name: website2, dump_command: mysqldump website2}
|
- { name: website2, dump_command: mysqldump website2 }
|
||||||
restic_password: mysuperduperpassword
|
restic_password: mysuperduperpassword
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ restic_folders: []
|
||||||
restic_databases: []
|
restic_databases: []
|
||||||
restic_dump_compression_enabled: false
|
restic_dump_compression_enabled: false
|
||||||
restic_forget: true
|
restic_forget: true
|
||||||
restic_forget_keep_within: 30d
|
restic_forget_args: "--keey-within 30d"
|
||||||
restic_prune: true
|
restic_prune: true
|
||||||
restic_check: true
|
restic_check: true
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ ExecStart=/bin/sh -c "{{ database.dump_command }} {{ '| pigz |' if restic_dump_c
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
||||||
{% if restic_forget %}
|
{% if restic_forget %}
|
||||||
ExecStartPost={{ restic_path }} forget --keep-within {{ restic_forget_keep_within }}
|
ExecStartPost={{ restic_path }} forget {{ restic_forget_args }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
||||||
{% if restic_prune %}
|
{% if restic_prune %}
|
||||||
|
|
Loading…
Reference in a new issue