mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-25 14:11:03 +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"
|
- name: "reload pull-remote-backups service"
|
||||||
systemd:
|
systemd:
|
||||||
name: pull-remote-backups.service
|
name: pull-remote-backups.service
|
||||||
state: reloaded
|
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
- name: "restart pull-remote-backups timer"
|
- name: "restart pull-remote-backups timer"
|
||||||
systemd:
|
systemd:
|
||||||
name: pull-remote-backups.timer
|
name: pull-remote-backups.timer
|
||||||
state: restarted
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
@ -2,3 +2,4 @@ dependencies:
|
|||||||
- git
|
- git
|
||||||
- systemd_notifier
|
- systemd_notifier
|
||||||
- backups-cleanup-timer
|
- backups-cleanup-timer
|
||||||
|
- docker-volume-backup-cleanup
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=pull remote backups
|
Description=pull remote backups
|
||||||
OnFailure=systemd-notifier@%n.service
|
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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"
|
- name: "reload docker-volume-backup.service"
|
||||||
systemd:
|
systemd:
|
||||||
name: docker-volume-backup.service
|
name: docker-volume-backup.service
|
||||||
state: reloaded
|
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
|
||||||
- name: "restart docker-volume-backup.timer"
|
- name: "restart docker-volume-backup.timer"
|
||||||
systemd:
|
systemd:
|
||||||
name: docker-volume-backup.timer
|
name: docker-volume-backup.timer
|
||||||
state: restarted
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
|
@ -2,3 +2,4 @@ dependencies:
|
|||||||
- git
|
- git
|
||||||
- backups-provider
|
- backups-provider
|
||||||
- systemd_notifier
|
- systemd_notifier
|
||||||
|
- docker-volume-backup-cleanup
|
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=docker volume backup
|
Description=docker volume backup
|
||||||
OnFailure=systemd-notifier@%n.service
|
OnFailure=systemd-notifier@%n.service docker-volume-backup-cleanup.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
Loading…
Reference in New Issue
Block a user