Skip to content

Commit c4b8538

Browse files
authoredOct 28, 2021
fix(redhat): use correct vhostdir, sitesdir and logrotate script for redhat family (#376)
* fix(redhat): use correct dirs for redhat family Red hat family distributions do not implement sites-enabled nor vhosts.d directories and all virtual hosts are under /etc/httpd/conf.d Redhat based distros don't have /etc/init.d/httpd to rotate logs. Default for them uses systemctl reload to rotate logs
1 parent ea777fd commit c4b8538

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed
 

‎apache/config/logrotate.sls

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@ apache-config-logrotate-file-managed:
88
file.managed:
99
- name: {{ apache.logrotatedir }}
1010
- makedirs: True
11+
{%- if grains.os_family == "RedHat" %}
12+
- contents: |
13+
{{ apache.logdir }}/*log {
14+
missingok
15+
notifempty
16+
sharedscripts
17+
delaycompress
18+
postrotate
19+
/bin/systemctl reload {{ apache.service.name }}.service > /dev/null 2>/dev/null || true
20+
endscript
21+
}
22+
{% else %}
1123
- contents: |
1224
{{ apache.logdir }}/*.log {
1325
daily
@@ -29,3 +41,4 @@ apache-config-logrotate-file-managed:
2941
fi; \
3042
endscript
3143
}
44+
{% endif %}

‎apache/osfamilymap.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,19 @@ RedHat:
7474
mod_geoip: mod_geoip
7575
mod_geoip_database: GeoIP
7676

77-
vhostdir: /etc/httpd/vhosts.d
77+
vhostdir: /etc/httpd/conf.d
7878
confdir: /etc/httpd/conf.d
7979
modulesdir: /usr/lib64/httpd/modules
8080
confext: .conf
8181
default_site: default
82-
default_site_ssl: default-ssl
82+
default_site_ssl: ssl
8383
logdir: /var/log/httpd
8484
logrotatedir: /etc/logrotate.d/httpd
8585
wwwdir: /var/www
8686
default_charset: UTF-8
8787
use_require: false
8888
moddir: /etc/httpd/conf.modules.d
89-
sitesdir: /etc/httpd/sites-enabled
89+
sitesdir: /etc/httpd/conf.d
9090

9191
Suse:
9292
pkg:

‎test/integration/default/controls/config_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
moddir = '/etc/apache2/mods-enabled'
1717
sitesdir = '/etc/apache2/vhosts.d'
1818
when 'redhat', 'fedora'
19-
vhostdir = '/etc/httpd/vhosts.d'
19+
vhostdir = '/etc/httpd/conf.d'
2020
logrotatedir = '/etc/logrotate.d/httpd'
2121
moddir = '/etc/httpd/conf.modules.d'
22-
sitesdir = '/etc/httpd/sites-enabled'
22+
sitesdir = '/etc/httpd/conf.d'
2323
when 'gentoo'
2424
vhostdir = '/etc/apache2/vhosts.d'
2525
logrotatedir = '/etc/logrotate.d/apache2'

‎test/integration/modules/controls/config_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
moddir = '/etc/apache2/mods-enabled'
1919
sitesdir = '/etc/apache2/vhosts.d'
2020
when 'redhat', 'fedora'
21-
vhostdir = '/etc/httpd/vhosts.d'
21+
vhostdir = '/etc/httpd/conf.d'
2222
logrotatedir = '/etc/logrotate.d/httpd'
2323
logdir = '/var/log/httpd'
2424
moddir = '/etc/httpd/conf.modules.d'
25-
sitesdir = '/etc/httpd/sites-enabled'
25+
sitesdir = '/etc/httpd/conf.d'
2626
apachectl = 'httpd -t'
2727
when 'gentoo'
2828
vhostdir = '/etc/apache2/vhosts.d'

0 commit comments

Comments
 (0)
Please sign in to comment.