mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-21 20:31:02 +01:00
Implemented cleanup procedure for failed backups
This commit is contained in:
parent
ebcd93f837
commit
dfc0dbbffa
@ -1,12 +1,11 @@
|
||||
- name: "reload pull-remote-backups service"
|
||||
systemd:
|
||||
name: pull-remote-backups.service
|
||||
state: reloaded
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
- name: "restart pull-remote-backups timer"
|
||||
systemd:
|
||||
name: pull-remote-backups.timer
|
||||
state: restarted
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@ -2,3 +2,4 @@ dependencies:
|
||||
- git
|
||||
- systemd_notifier
|
||||
- backups-cleanup-timer
|
||||
- docker-volume-backup-cleanup
|
||||
|
@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=pull remote backups
|
||||
OnFailure=systemd-notifier@%n.service
|
||||
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
3
roles/docker-volume-backup-cleanup/README.md
Normal file
3
roles/docker-volume-backup-cleanup/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Docker Volume Backup Cleanup
|
||||
This script cleans up failed docker backups.
|
||||
It uses https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup as base.
|
5
roles/docker-volume-backup-cleanup/handlers/main.yml
Normal file
5
roles/docker-volume-backup-cleanup/handlers/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: "reload docker-volume-backup-cleanup.service daemon"
|
||||
systemd:
|
||||
name: docker-volume-backup-cleanup.service
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
3
roles/docker-volume-backup-cleanup/meta/main.yml
Normal file
3
roles/docker-volume-backup-cleanup/meta/main.yml
Normal file
@ -0,0 +1,3 @@
|
||||
dependencies:
|
||||
- git
|
||||
- systemd_notifier
|
18
roles/docker-volume-backup-cleanup/tasks/main.yml
Normal file
18
roles/docker-volume-backup-cleanup/tasks/main.yml
Normal file
@ -0,0 +1,18 @@
|
||||
- name: pull docker-volume-backup-cleanup.git
|
||||
git:
|
||||
repo: "https://github.com/kevinveenbirkenbach/docker-volume-backup-cleanup.git"
|
||||
dest: "{{docker_volume_backup_cleanup_folder}}"
|
||||
update: yes
|
||||
register: git_result
|
||||
ignore_errors: true
|
||||
|
||||
- name: Warn if repo is not reachable
|
||||
debug:
|
||||
msg: "Warning: Repository is not reachable."
|
||||
when: git_result.failed
|
||||
|
||||
- name: configure docker-volume-backup-cleanup.service
|
||||
template:
|
||||
src: docker-volume-backup-cleanup.service.j2
|
||||
dest: /etc/systemd/system/docker-volume-backup-cleanup.service
|
||||
notify: reload docker-volume-backup-cleanup.service daemon
|
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=Cleans up failed docker volume backups
|
||||
OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/bin/sh -c '/usr/bin/yes | /usr/bin/bash {{docker_volume_backup_cleanup_folder}}cleanup.sh {{docker_volume_backup_cleanup_machine_id}} {{docker_volume_backup_cleanup_trigger_directory}}'
|
1
roles/docker-volume-backup-cleanup/vars/main.yml
Normal file
1
roles/docker-volume-backup-cleanup/vars/main.yml
Normal file
@ -0,0 +1 @@
|
||||
docker_volume_backup_cleanup_folder: "{{path_administrator_scripts}}docker-volume-backup-cleanup/"
|
@ -1,12 +1,12 @@
|
||||
- name: "reload docker-volume-backup.service"
|
||||
systemd:
|
||||
name: docker-volume-backup.service
|
||||
state: reloaded
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
||||
- name: "restart docker-volume-backup.timer"
|
||||
systemd:
|
||||
name: docker-volume-backup.timer
|
||||
state: restarted
|
||||
state: started
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@ -2,3 +2,4 @@ dependencies:
|
||||
- git
|
||||
- backups-provider
|
||||
- systemd_notifier
|
||||
- docker-volume-backup-cleanup
|
@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=docker volume backup
|
||||
OnFailure=systemd-notifier@%n.service
|
||||
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
Loading…
Reference in New Issue
Block a user