From 55534b7abc0ee7ae3d46eba1c31a73ec573c49a6 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 26 Dec 2023 03:31:30 +0100 Subject: [PATCH] Optimized code performance --- roles/cleanup-failed-docker-backups/tasks/main.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/cleanup-failed-docker-backups/tasks/main.yml b/roles/cleanup-failed-docker-backups/tasks/main.yml index 3dec4397..b36c0f18 100644 --- a/roles/cleanup-failed-docker-backups/tasks/main.yml +++ b/roles/cleanup-failed-docker-backups/tasks/main.yml @@ -19,15 +19,16 @@ notify: reload cleanup-failed-docker-backups.service daemon when: run_once_cleanup_failed_docker_backups is not defined -- name: run the cleanup_failed_docker_backups tasks once - set_fact: - run_once_cleanup_failed_docker_backups: true - when: run_once_cleanup_failed_docker_backups is not defined - - name: create cleanup-failed-docker-backups.timer template: src: cleanup-failed-docker-backups.timer.j2 dest: /etc/systemd/system/cleanup-failed-docker-backups.timer register: cleanup_failed_docker_backups_timer changed_when: cleanup_failed_docker_backups_timer.changed or activate_all_timers | bool - notify: restart cleanup-failed-docker-backups.timer \ No newline at end of file + notify: restart cleanup-failed-docker-backups.timer + when: run_once_cleanup_failed_docker_backups is not defined + +- name: run the cleanup_failed_docker_backups tasks once + set_fact: + run_once_cleanup_failed_docker_backups: true + when: run_once_cleanup_failed_docker_backups is not defined \ No newline at end of file