mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-12-26 12:05:09 +01:00
Finished backup to swappable implementation
This commit is contained in:
parent
cdf0f30a76
commit
1b4d726fd0
@ -30,7 +30,7 @@ This software allows to setup the docker following applications:
|
||||
#### Native Applications
|
||||
|
||||
This software shipts the following tools which are natively setup on the server:
|
||||
- [Backups Cleanup](./roles/server_native-backups-cleanup/README.md) - Cleans up old backups
|
||||
- [Backups Cleanup](./roles/independent_backups-cleanup-timer/README.md) - Cleans up old backups
|
||||
- [Btrfs Health Check](./roles/server_native-btrfs-health-check/README.md) - Checks the health of Btrfs file systems
|
||||
- [Docker Health Check](./roles/server_native-docker-health-check/) - Checks the health of docker containers
|
||||
- [Docker Reverse Proxy](./roles/server_native-docker-reverse-proxy/README.md) - Docker Reverse Proxy Solution
|
||||
|
@ -1,3 +1,4 @@
|
||||
dependencies:
|
||||
- independent_user-administrator
|
||||
- independent_systemd-email
|
||||
- independent_backups-cleanup-service
|
||||
|
@ -2,6 +2,7 @@
|
||||
Description=backing up data
|
||||
OnFailure=systemd-email@%n.service
|
||||
ConditionPathExists={{backup_to_swappable_destination_path}}
|
||||
Wants=backups-cleanup.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
@ -1,4 +1,4 @@
|
||||
# role server_native-backups-cleanup
|
||||
# role independent_backups-cleanup-timer
|
||||
|
||||
Cleans up old backups
|
||||
|
@ -17,11 +17,10 @@ def is_directory_used_by_another_process(directory_path):
|
||||
command= "lsof " + directory_path
|
||||
process = subprocess.Popen([command], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
output, error = process.communicate()
|
||||
if error:
|
||||
raise Exception(error.strip())
|
||||
if output:
|
||||
return True
|
||||
return False
|
||||
# @See https://stackoverflow.com/questions/29841984/non-zero-exit-code-for-lsof
|
||||
if process.wait() > bool(0):
|
||||
return False
|
||||
return True
|
||||
|
||||
for host_backup_directory_name in os.listdir(args.backups_folder_path):
|
||||
host_backup_directory_path = os.path.join(args.backups_folder_path, host_backup_directory_name)
|
@ -4,9 +4,3 @@
|
||||
state: reloaded
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
- name: "restart backups-cleanup.timer"
|
||||
systemd:
|
||||
name: backups-cleanup.timer
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
@ -24,9 +24,3 @@
|
||||
src: "backups-cleanup.service.j2"
|
||||
dest: "/etc/systemd/system/backups-cleanup.service"
|
||||
notify: reload backups-cleanup.service
|
||||
|
||||
- name: create backups-cleanup.timer
|
||||
template:
|
||||
src: "backups-cleanup.timer.j2"
|
||||
dest: "/etc/systemd/system/backups-cleanup.timer"
|
||||
notify: restart backups-cleanup.timer
|
3
roles/independent_backups-cleanup-timer/README.md
Normal file
3
roles/independent_backups-cleanup-timer/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# role independent_backups-cleanup-timer
|
||||
|
||||
Timer for cleaning up old backups
|
@ -0,0 +1,6 @@
|
||||
- name: "restart backups-cleanup.timer"
|
||||
systemd:
|
||||
name: backups-cleanup.timer
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
2
roles/independent_backups-cleanup-timer/meta/main.yml
Normal file
2
roles/independent_backups-cleanup-timer/meta/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- independent_backups-cleanup-service
|
5
roles/independent_backups-cleanup-timer/tasks/main.yml
Normal file
5
roles/independent_backups-cleanup-timer/tasks/main.yml
Normal file
@ -0,0 +1,5 @@
|
||||
- name: create backups-cleanup.timer
|
||||
template:
|
||||
src: "backups-cleanup.timer.j2"
|
||||
dest: "/etc/systemd/system/backups-cleanup.timer"
|
||||
notify: restart backups-cleanup.timer
|
@ -1,4 +1,4 @@
|
||||
dependencies:
|
||||
- server_native-git
|
||||
- independent_systemd-email
|
||||
- server_native-backups-cleanup
|
||||
- independent_backups-cleanup-timer
|
||||
|
@ -1,3 +1,3 @@
|
||||
dependencies:
|
||||
- server_native-backups-provider-user
|
||||
- server_native-backups-cleanup
|
||||
- independent_backups-cleanup-timer
|
||||
|
Loading…
Reference in New Issue
Block a user