Renamed to backup and cleanup roles

This commit is contained in:
2023-11-16 17:07:28 +01:00
parent 0d4eb75afe
commit c70f0b2580
59 changed files with 125 additions and 125 deletions

View File

@@ -0,0 +1,12 @@
- name: "reload backup-docker-to-local.service"
systemd:
name: backup-docker-to-local.service
enabled: yes
daemon_reload: yes
- name: "restart backup-docker-to-local.timer"
systemd:
name: backup-docker-to-local.timer
state: started
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,5 @@
dependencies:
- git
- backups-provider
- systemd_notifier
- cleanup-failed-docker-backups

View File

@@ -0,0 +1,36 @@
- name: install pandas system wide
community.general.pacman:
name:
- lsof
- python-pandas
state: present
- name: pull backup-docker-to-local.git
git:
repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git"
dest: "{{docker_volume_backup_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 backup-docker-to-local.service
template:
src: backup-docker-to-local.service.j2
dest: /etc/systemd/system/backup-docker-to-local.service
notify: reload backup-docker-to-local.service
- name: configure backup-docker-to-local.timer.tpl
template: src=backup-docker-to-local.timer.j2 dest=/etc/systemd/system/backup-docker-to-local.timer
notify: restart backup-docker-to-local.timer
- name: create {{docker_volume_backup_folder}}databases.csv
copy:
src: "{{ inventory_dir }}/files/{{ inventory_hostname }}{{docker_volume_backup_folder}}databases.csv"
dest: "{{docker_volume_backup_folder}}databases.csv"
owner: root
group: root

View File

@@ -0,0 +1,7 @@
[Unit]
Description=docker volume backup
OnFailure=systemd-notifier@%n.service cleanup-failed-docker-backups.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python {{docker_volume_backup_folder}}backup-docker-to-local.py

View File

@@ -0,0 +1,10 @@
[Unit]
Description=backups the docker volumes
[Timer]
OnCalendar={{on_calendar_docker_volume_backup}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=false
[Install]
WantedBy=timers.target

View File

@@ -0,0 +1 @@
docker_volume_backup_folder: "{{path_administrator_scripts}}backup-docker-to-local/"