fix(redhat): use correct logrotate config on redhat family distros

Redhat based distros don't have /etc/init.d/httpd to rotate logs.
Default for them uses systemctl reload to rotate logs
This commit is contained in:
l00d3r 2021-10-21 19:08:36 +03:00
parent b2b44b60ce
commit f96cd02e55

View file

@ -8,6 +8,18 @@ apache-config-logrotate-file-managed:
file.managed:
- name: {{ apache.logrotatedir }}
- makedirs: True
{%- if grains.os_family == "RedHat" %}
- contents: |
{{ apache.logdir }}/*log {
missingok
notifempty
sharedscripts
delaycompress
postrotate
/bin/systemctl reload {{ apache.service.name }}.service > /dev/null 2>/dev/null || true
endscript
}
{% else %}
- contents: |
{{ apache.logdir }}/*.log {
daily
@ -29,3 +41,4 @@ apache-config-logrotate-file-managed:
fi; \
endscript
}
{% endif %}