Fixed (SCHEDULE) (OLD) check tainting the play recap as well as the assumption that cron_delete.failed will be defined.
Signed-off-by: Jeremy Hettenhouser <jhettenh@gmail.com>
ignore_errors:true on the old version test. While the failure will not halt execution, it will color the summary output red for every host which executes the restic role even if most of them are set to use systemd
Signed-off-by: Jeremy Hettenhouser <jhettenh@gmail.com>
Before this commit, since restic backup exits with status 3 if it
cannot read one or more files, the LVM snapshot wasn't being cleaned
up.
Now, specially handle the 3 exit status; also, unequivocally perform
the LVM cleanup when finished.
This commit causes an LVM backup target of / to be treated as /rootfs
instead.
Note that this will conflict with a path called /rootfs if we *do* try
to back that up.
Also, while we're at it, drop the -m option from mount. Not all
systems have this option.
This commit implements the needs of #75[^1]: it allows for the
creation of atomic backups when the backup target is a file/dir whose
fs rests on LVM. This ensures the snapshot will be atomic.
By using a mount namespace, the LVM snapshot can be done in the same
directory -- so existing LVM-based applications of ansible_role_restic
can be migrated to this implementation without any discontinuity in
what appears to be backed up.
This combination of LVM's snapshotting layer and mount namespaces
comes with some caveats:
- you cannot backup / due to namespace issues
- subdirs with a separate fs won't be correctly detected
- not all filesystems are happy about LVM snapshots -- btrfs, e.g.
- LVM snapshots come with a performance penalty when active
- fstrim and LVM snapshots don't like each other whatsoever
[^1]: https://github.com/roles-ansible/ansible_role_restic/issues/75
--
Changes in v2:
- Use `findmnt -v` to find snapshot when cleaning up
- Check for _snap before `lvremove -y`
Signed-off-by: Martin Kennedy <hurricos@gmail.com>
The README (Role Variables) asserts that `restic_install_path`
defaults to `/usr/local/bin`, when in fact it defaults to
`/usr/bin`. Fix the defaults to match the documentation.
Signed-off-by: Martin Kennedy <hurricos@gmail.com>