borgbase / ansible-role-borgbackup

Ansible role to set up Borg and Borgmatic
MIT License
227 stars 99 forks source link

properly merge borgmatic_hooks and extra variables #81

Closed HarHarLinks closed 1 year ago

HarHarLinks commented 3 years ago

at least 3 extra variables failure_command, before_backup and after_backup are introduced while the rest of the hooks configuration has to be added manually in the hooks variable. https://github.com/borgbase/ansible-role-borgbackup/blob/b52efea18e02840a56046936f6b3a76e44d8c946/templates/config.yaml.j2#L179-L200

this can cause errors like the following if one configures the role using e.g. on_error instead of failure_command:

Message: Validation_error('/etc/borgmatic/config.yaml', ('while constructing a mapping\n  in "/etc/borgmatic/config.yaml", line 123, column 5\nfound duplicate key "on_error" with value "[]" (original value: "[]")\n  in "/etc/borgmatic/config.yaml", line 135, column 5\n\nTo suppress this check see:\n    http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys\n',))

I suggest this should be documented more clearly and further avoided altogether by merging these variables appropriately.

m3nu commented 3 years ago

Yeah, agreed.

m3nu commented 1 year ago

I think this is fixed via #93. If you think more changes are needed, please comment.