Add logrotate meta configuration for Salt
- parametrize interval and rotate
Related: PROD-29848
Change-Id: I2c8f24da62c808e59ef36de9461a4957667e3a61
diff --git a/salt/meta/logrotate.yml b/salt/meta/logrotate.yml
new file mode 100644
index 0000000..561038a
--- /dev/null
+++ b/salt/meta/logrotate.yml
@@ -0,0 +1,27 @@
+## Default: Weekly rotation with 7 rotations kept
+{%- from "salt/map.jinja" import master, minion with context %}
+
+{%- if master.get('enabled', False) %}
+ {%- set log_interval = master.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = master.get('logrotate', {}).get('rotate', 7) %}
+{%- elif minion.get('enabled', False) %}
+ {%- set log_interval = minion.get('logrotate', {}).get('interval', 'weekly') %}
+ {%- set log_rotation = minion.get('logrotate', {}).get('rotate', 7) %}
+{%- endif %}
+
+{%- if master.get('enabled', False) or minion.get('enabled', False) %}
+job:
+ salt-common:
+ - files:
+ {%- if master.get('enabled', False) %}
+ - /var/log/salt/master
+ {%- endif %}
+ - /var/log/salt/minion
+ - /var/log/salt/key
+ options:
+ - {{ log_interval }}
+ - rotate: {{ log_rotation }}
+ - missingok
+ - compress
+ - notifempty
+{%- endif %}