From ab2460445467ef70cf0762f7827ef4b6988b1ec6 Mon Sep 17 00:00:00 2001 From: Seena Fallah Date: Thu, 20 Aug 2020 04:20:22 +0430 Subject: [PATCH] Run logrotate only logrotate config changes (#302) --- handlers/main.yml | 3 +++ tasks/conf/logrotate.yml | 6 +----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 8463e38..0b13edd 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -40,3 +40,6 @@ name: unitd state: started enabled: yes + +- name: "(Config: All OSs) Run Logrotate" + command: logrotate -f /etc/logrotate.d/nginx diff --git a/tasks/conf/logrotate.yml b/tasks/conf/logrotate.yml index ffff9ea..b6dff35 100644 --- a/tasks/conf/logrotate.yml +++ b/tasks/conf/logrotate.yml @@ -31,8 +31,4 @@ template: src: "logrotate/nginx.j2" dest: "/etc/logrotate.d/nginx" - register: nginx_logrotate_result - -- name: "(Config: All OSs) Run Logrotate" - command: logrotate -f /etc/logrotate.d/nginx - changed_when: nginx_logrotate_result.changed + notify: "(Config: All OSs) Run Logrotate"