From e199c1e7f66d79d9d6f4022d4dfd62e30b0943d9 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 4 Apr 2024 15:45:53 +0200 Subject: [PATCH] Solved system-timer bugs --- roles/cleanup-backups-timer/tasks/main.yml | 4 ++-- roles/systemd-timer/handlers/main.yml | 6 ------ roles/systemd-timer/tasks/main.yml | 10 ++++++++-- 3 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 roles/systemd-timer/handlers/main.yml diff --git a/roles/cleanup-backups-timer/tasks/main.yml b/roles/cleanup-backups-timer/tasks/main.yml index 489b4a46..566fd2a8 100644 --- a/roles/cleanup-backups-timer/tasks/main.yml +++ b/roles/cleanup-backups-timer/tasks/main.yml @@ -1,6 +1,6 @@ -- name: set service_name to the name of the current role +- name: set service_name to cleanup-backups set_fact: - service_name: "{{ role_name }}" + service_name: "cleanup-backups" when: run_once_cleanup_backups_timer is not defined - name: "include role for systemd-timer for {{service_name}}" diff --git a/roles/systemd-timer/handlers/main.yml b/roles/systemd-timer/handlers/main.yml deleted file mode 100644 index 5cbd784b..00000000 --- a/roles/systemd-timer/handlers/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -- name: "restart timer" - systemd: - name: "{{service_name}}.cymais.timer" - state: restarted - enabled: yes - daemon_reload: yes \ No newline at end of file diff --git a/roles/systemd-timer/tasks/main.yml b/roles/systemd-timer/tasks/main.yml index 3d196d7f..42d95104 100644 --- a/roles/systemd-timer/tasks/main.yml +++ b/roles/systemd-timer/tasks/main.yml @@ -3,5 +3,11 @@ src: dummy.timer.j2 dest: "/etc/systemd/system/{{service_name}}.cymais.timer" register: dummy_timer - changed_when: dummy_timer.changed or activate_all_timers | bool - notify: restart timer \ No newline at end of file + +- name: "restart timer" + systemd: + daemon_reload: yes + name: "{{service_name}}.cymais.timer" + state: restarted + enabled: yes + when: dummy_timer.changed or activate_all_timers | bool \ No newline at end of file