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

@@ -2,11 +2,4 @@
systemd:
name: cleanup-failed-docker-backups.service
enabled: yes
daemon_reload: yes
- name: "restart cleanup-failed-docker-backups.timer"
systemd:
name: cleanup-failed-docker-backups.timer
state: restarted
enabled: yes
daemon_reload: yes

View File

@@ -19,13 +19,16 @@
notify: reload cleanup-failed-docker-backups.service daemon
when: run_once_cleanup_failed_docker_backups is not defined
- name: create cleanup-failed-docker-backups.timer
template:
src: cleanup-failed-docker-backups.timer.j2
dest: /etc/systemd/system/cleanup-failed-docker-backups.timer
register: cleanup_failed_docker_backups_timer
changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers | bool
notify: restart cleanup-failed-docker-backups.timer
- name: set service_name to the name of the current role
set_fact:
service_name: "{{ role_name }}"
when: run_once_cleanup_failed_docker_backups is not defined
- name: "include role for systemd-timer for {{service_name}}"
include_role:
name: systemd-timer
vars:
on_calendar: "{{on_calendar_cleanup_failed_docker}}"
when: run_once_cleanup_failed_docker_backups is not defined
- name: run the cleanup_failed_docker_backups tasks once

View File

@@ -1,10 +0,0 @@
[Unit]
Description=starts cleanup-failed-docker-backups.service
[Timer]
OnCalendar={{on_calendar_cleanup_failed_docker}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=true
[Install]
WantedBy=timers.target