1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_role_restic.git synced 2024-12-11 23:41:32 +01:00

Merge pull request #131 from usmanatron/forget_extra_args

Add support for passing in extra args to the `restic forget` command
This commit is contained in:
L3D 2024-12-10 09:17:24 +01:00 committed by GitHub
commit 79c88270bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -174,6 +174,7 @@ Available variables:
| `keep_within` | no | If set, only keeps snapshots in this time period. |
| `keep_tag` | no | If set, keep snapshots with this tags. Make sure to specify a list. |
| `prune` | no (`false`) | If `true`, the `restic forget` command in the script has the [`--prune` option](https://restic.readthedocs.io/en/stable/060_forget.html#removing-backup-snapshots) appended. |
| `forget_extra_args` | no | Extra arguments to pass to the `restic forget` command. |
| `scheduled` | no (`false`) | If `restic_create_schedule` is set to `true`, this backup is scheduled and tries to create a systemd timer unit. If it fails, it is creating a cronjob. |
| `schedule_oncalendar` | ``'*-*-* 02:00:00'`` | The time for the systemd timer. Please notice the randomDelaySec option. By Default the backup is done every night at 2 am (+0-4h). But only if scheduled is true. |
| `schedule_minute` | no (`*`) | Minute when the job is run. ( 0-59, *, */2, etc ) |

View file

@ -302,7 +302,7 @@ esac
{#
Define stdin forget commands
#}
{{ restic_install_path }}/restic forget {{ paths(item) }} {{ retention_pattern(item) }} {% if item.prune is defined and item.prune == true %}--prune{% endif %} {{ forget_output_log }}
{{ restic_install_path }}/restic forget {{ paths(item) }} {{ retention_pattern(item) }} {% if item.prune is defined and item.prune == true %}--prune{% endif %} {% if item.forget_extra_args is defined %}{{ item.forget_extra_args }}{% endif %} {{ forget_output_log }}
if [[ $? -eq 0 ]]
then
echo "$(date -u '+%Y-%m-%d %H:%M:%S') OK" {{ forget_result_log }}