Created role for systemd timers

This commit is contained in:
Kevin Veen-Birkenbach 2024-01-04 11:40:39 +01:00
parent 6cc48f9dc5
commit 973e667b4f
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,6 @@
- name: "restart timer"
systemd:
name: "{{service_name}}.timer"
state: restarted
enabled: yes
daemon_reload: yes

View File

@ -0,0 +1,7 @@
- name: create {{service_name}}.timer
template:
src: dummy.timer.j2
dest: "/etc/systemd/system/{{service_name}}.timer"
register: dummy_timer
changed_when: dummy_timer.changed or activate_all_timers | bool
notify: restart timer

View File

@ -0,0 +1,10 @@
[Unit]
Description=Timer to start {{service_name}}.service
[Timer]
OnCalendar={{on_calendar}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=false
[Install]
WantedBy=timers.target