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