refactored to timer routine

This commit is contained in:
2024-01-04 13:27:07 +01:00
parent 973e667b4f
commit 40f6f7dc4f
43 changed files with 152 additions and 335 deletions

View File

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

View File

@@ -34,11 +34,16 @@
notify: reload backup-docker-to-local.service
when: run_once_backup_docker_to_local is not defined
- 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
register: backup_docker_to_local_timer
changed_when: backup_docker_to_local_timer.changed or activate_all_timers | bool
notify: restart backup-docker-to-local.timer
- name: set service_name to the name of the current role
set_fact:
service_name: "{{ role_name }}"
when: run_once_backup_docker_to_local is not defined
- name: "include role for systemd-timer for {{service_name}}"
include_role:
name: systemd-timer
vars:
on_calendar: "{{on_calendar_backup_docker_to_local}}"
when: run_once_backup_docker_to_local is not defined
- name: seed database values

View File

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