Check for cron jobs hourly if 'hourly' is defined for logrotate
Fixes: PROD-33745
Change-Id: Ibdb90537fa2598964018db7b4aa0af2e2fb54417
diff --git a/logrotate/server.sls b/logrotate/server.sls
index a5de796..35a78d7 100644
--- a/logrotate/server.sls
+++ b/logrotate/server.sls
@@ -39,4 +39,17 @@
- require:
- pkg: logrotate_packages
+logrotate_script_hourly_create:
+ file.symlink:
+ - name: /etc/cron.hourly/logrotate
+ - target: /etc/cron.daily/logrotate
+ - user: root
+ - group: root
+ - onlyif: {{'grep -qR hourly ' + server.config_dir }}
+
+logrotate_script_hourly_absent:
+ file.absent:
+ - name: /etc/cron.hourly/logrotate
+ - unless: {{'grep -qR hourly ' + server.config_dir }}
+
{%- endif %}