Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(systemd): nightly reboot #1

Open
wants to merge 1 commit into
base: initial
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- name: Reload systemd configuration
service:
daemon_reload: True
21 changes: 21 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,24 @@
template:
src: start-waydroid.sh.j2
dest: /usr/local/bin/start-waydroid.sh

- name: Create reboot service
template:
src: reboot.service.j2
dest: /etc/systemd/system/reboot.service
notify:
- Reload systemd configuration

- name: Create reboot timer
template:
src: reboot.timer.j2
dest: /etc/systemd/system/reboot.timer
notify:
- Reload systemd configuration


- name: Enable reboot timer
systemd:
name: reboot.timer
enabled: True
state: started
7 changes: 7 additions & 0 deletions templates/reboot.service.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# {{ansible_managed}}
[Unit]
Description=Reboot the system

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl reboot
11 changes: 11 additions & 0 deletions templates/reboot.timer.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# {{ansible_managed}}
[Unit]
Description=Schedule nightly reboot for the system
Requisite=reboot.service

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true

[Install]
WantedBy=timers.target