mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-12-22 18:35:03 +01:00
Created role for systemd timers
This commit is contained in:
parent
6cc48f9dc5
commit
973e667b4f
6
roles/systemd-timer/handlers/main.yml
Normal file
6
roles/systemd-timer/handlers/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
- name: "restart timer"
|
||||
systemd:
|
||||
name: "{{service_name}}.timer"
|
||||
state: restarted
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
7
roles/systemd-timer/tasks/main.yml
Normal file
7
roles/systemd-timer/tasks/main.yml
Normal 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
|
10
roles/systemd-timer/templates/dummy.timer.j2
Normal file
10
roles/systemd-timer/templates/dummy.timer.j2
Normal 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
|
Loading…
Reference in New Issue
Block a user