From ad7b407172f158303c9eee137a8a1a256fa15604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Thu, 23 Sep 2021 21:40:24 +0200 Subject: [PATCH] setup_archlinux: Install timer to reboot system --- roles/setup_archlinux/files/reboot.service | 6 ++++++ roles/setup_archlinux/files/reboot.timer | 8 ++++++++ roles/setup_archlinux/tasks/main.yml | 18 ++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 roles/setup_archlinux/files/reboot.service create mode 100644 roles/setup_archlinux/files/reboot.timer diff --git a/roles/setup_archlinux/files/reboot.service b/roles/setup_archlinux/files/reboot.service new file mode 100644 index 0000000..7e1a2a7 --- /dev/null +++ b/roles/setup_archlinux/files/reboot.service @@ -0,0 +1,6 @@ +[Unit] +Description=System reboot + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl reboot diff --git a/roles/setup_archlinux/files/reboot.timer b/roles/setup_archlinux/files/reboot.timer new file mode 100644 index 0000000..4fd8cfe --- /dev/null +++ b/roles/setup_archlinux/files/reboot.timer @@ -0,0 +1,8 @@ +[Unit] +Description=System reboot timer + +[Timer] +OnCalendar=Mon *-*-* 05:30:00 + +[Install] +WantedBy=timers.target diff --git a/roles/setup_archlinux/tasks/main.yml b/roles/setup_archlinux/tasks/main.yml index ed8c8c7..96f208a 100644 --- a/roles/setup_archlinux/tasks/main.yml +++ b/roles/setup_archlinux/tasks/main.yml @@ -9,3 +9,21 @@ name: systemd-timesyncd enabled: true state: started + +- name: Install reboot service + ansible.builtin.copy: + src: "{{ item }}" + dest: "/etc/systemd/system/{{ item }}" + owner: root + group: root + mode: 0644 + with_items: + - reboot.service + - reboot.timer + +- name: Enable reboot timer + ansible.builtin.systemd: + name: reboot.timer + enabled: true + state: started + daemon_reload: true -- 2.44.0