mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
refactored to timer routine
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
- name: "restart cleanup-backups.timer"
|
||||
systemd:
|
||||
name: cleanup-backups.timer
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
when: run_once_cleanup_backup_timer is not defined
|
||||
|
||||
- name: run the cleanup_backup_timer tasks once
|
||||
set_fact:
|
||||
run_once_cleanup_backup_timer: true
|
||||
when: run_once_cleanup_backup_timer is not defined
|
@@ -1,10 +1,13 @@
|
||||
- name: create cleanup-backups.timer
|
||||
template:
|
||||
src: "cleanup-backups.timer.j2"
|
||||
dest: "/etc/systemd/system/cleanup-backups.timer"
|
||||
register: cleanup_backups_timer
|
||||
changed_when: cleanup_backups_timer.changed or activate_all_timers | bool
|
||||
notify: restart cleanup-backups.timer
|
||||
- name: set service_name to the name of the current role
|
||||
set_fact:
|
||||
service_name: "{{ role_name }}"
|
||||
when: run_once_cleanup_backups_timer is not defined
|
||||
|
||||
- name: "include role for systemd-timer for {{service_name}}"
|
||||
include_role:
|
||||
name: systemd-timer
|
||||
vars:
|
||||
on_calendar: "{{on_calendar_cleanup_backups}}"
|
||||
when: run_once_cleanup_backups_timer is not defined
|
||||
|
||||
- name: run the cleanup_backups_timer tasks once
|
||||
|
@@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=starts cleanup-backups.service
|
||||
|
||||
[Timer]
|
||||
OnCalendar={{on_calendar_cleanup_backups}}
|
||||
RandomizedDelaySec={{randomized_delay_sec}}
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
Reference in New Issue
Block a user