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,10 +2,4 @@
systemd:
name: health-btrfs.service
enabled: yes
daemon_reload: yes
- name: "restart health-btrfs.timer"
systemd:
name: health-btrfs.timer
state: restarted
enabled: yes
daemon_reload: yes
daemon_reload: yes

View File

@@ -15,10 +15,12 @@
dest: /etc/systemd/system/health-btrfs.service
notify: reload health-btrfs.service
- name: create health-btrfs.timer
template:
src: health-btrfs.timer.j2
dest: "/etc/systemd/system/health-btrfs.timer"
register: health_btrs_timer
changed_when: health_btrs_timer.changed or activate_all_timers | bool
notify: restart health-btrfs.timer
- name: set service_name to the name of the current role
set_fact:
service_name: "{{ role_name }}"
- name: "include role for systemd-timer for {{service_name}}"
include_role:
name: systemd-timer
vars:
on_calendar: "{{on_calendar_health_btrfs}}"

View File

@@ -1,10 +0,0 @@
[Unit]
Description=starts health-btrfs.service
[Timer]
OnCalendar={{on_calendar_health_btrfs}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=false
[Install]
WantedBy=timers.target