mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Renamed to backup and cleanup roles
This commit is contained in:
12
roles/backup-docker-to-local/handlers/main.yml
Normal file
12
roles/backup-docker-to-local/handlers/main.yml
Normal 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
|
5
roles/backup-docker-to-local/meta/main.yml
Normal file
5
roles/backup-docker-to-local/meta/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
dependencies:
|
||||
- git
|
||||
- backups-provider
|
||||
- systemd_notifier
|
||||
- cleanup-failed-docker-backups
|
36
roles/backup-docker-to-local/tasks/main.yml
Normal file
36
roles/backup-docker-to-local/tasks/main.yml
Normal 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
|
@@ -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
|
@@ -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
|
1
roles/backup-docker-to-local/vars/main.yml
Normal file
1
roles/backup-docker-to-local/vars/main.yml
Normal file
@@ -0,0 +1 @@
|
||||
docker_volume_backup_folder: "{{path_administrator_scripts}}backup-docker-to-local/"
|
Reference in New Issue
Block a user